tanker-10vbox
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);
}
}
hbox11table0