tanker -10 vbox var dlgRoot = cmdarg(); var tankers = props.globals.getNode("/sim/ai/tankers/", 1).getChildren("tanker"); var types = props.globals.getNode("/systems/refuel/", 1).getChildren("type"); var tanker_node = props.globals.getNode("/sim/gui/dialogs/tanker/tanker", 1); # Force default speed of 250kts setprop("/sim/gui/dialogs/tanker/tanker/speed-kts", 250.0); if (size(types) == 0) { # This really shouldn't happen, as Nasal/tanker.nas disables this menu item # if no refueling type is available. gui.popupTip("Air to air refueling unavailable in this aircraft", 5); fgcommand("dialog-close", props.Node.new({ "dialog-name" : "tanker"})); } if (size(tankers) > 0) { var combo = gui.findElementByName(dlgRoot, "tanker-combo"); var idx = 0; foreach (var t; tankers) { foreach(var type; types) { if (type.getValue() == t.getNode("type", 1).getValue()) { combo.getChild("value", idx, 1).setValue(t.getNode("name", 1).getValue()); idx += 1; } } } } var select_tanker = func() { var name = getprop("/sim/gui/dialogs/tanker/selected-tanker"); foreach (var t; tankers) { if (name == t.getNode("name", 1).getValue()) { props.copy(t, tanker_node); } } } var generate_tanker = func() { if (tanker_node.getNode("name", 1).getValue()) { tanker.request_new(tanker_node); } } hbox 1 1 table 0 0 right tanker-combo 0 1 2 left /sim/gui/dialogs/tanker/selected-tanker false 200 fill dialog-apply tanker-combo nasal 1 0 right 1 1 /sim/gui/dialogs/tanker/tanker/type probe 3 left 1 1 /sim/gui/dialogs/tanker/tanker/type boom 3 left 2 0 right tanker-speed 2 1 fill 100 350 true /sim/gui/dialogs/tanker/tanker/speed-kts dialog-apply tanker-speed 2 2 left %2.0fkts /sim/gui/dialogs/tanker/tanker/speed-kts true 3 0 right contact-radius 3 1 fill 1 100 /systems/refuel/contact-radius-m dialog-apply contact-radius 3 2 left %2.0fm /systems/refuel/contact-radius-m true 4 0 right report-contact 4 1 left /systems/refuel/report-contact dialog-apply report-contact hbox 5 true true true true