| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <PropertyList> |
| 4 | <name>tanker</name> |
| 5 | <x>-10</x> |
| 6 | <layout>vbox</layout> |
| 7 | |
| 8 | <nasal> |
| 9 | <open> |
| 10 | var dlgRoot = cmdarg(); |
| 11 | |
| 12 | var tankers = props.globals.getNode("/sim/ai/tankers/", 1).getChildren("tanker"); |
| 13 | var types = props.globals.getNode("/systems/refuel/", 1).getChildren("type"); |
| 14 | var tanker_node = props.globals.getNode("/sim/gui/dialogs/tanker/tanker", 1); |
| 15 | |
| 16 | # Force default speed of 250kts |
| 17 | setprop("/sim/gui/dialogs/tanker/tanker/speed-kts", 250.0); |
| 18 | |
| 19 | if (size(types) == 0) { |
| 20 | # This really shouldn't happen, as Nasal/tanker.nas disables this menu item |
| 21 | # if no refueling type is available. |
| 22 | gui.popupTip("Air to air refueling unavailable in this aircraft", 5); |
| 23 | fgcommand("dialog-close", props.Node.new({ "dialog-name" : "tanker"})); |
| 24 | } |
| 25 | |
| 26 | |
| 27 | if (size(tankers) > 0) { |
| 28 | var combo = gui.findElementByName(dlgRoot, "tanker-combo"); |
| 29 | var idx = 0; |
| 30 | foreach (var t; tankers) { |
| 31 | foreach(var type; types) { |
| 32 | if (type.getValue() == t.getNode("type", 1).getValue()) { |
| 33 | combo.getChild("value", idx, 1).setValue(t.getNode("name", 1).getValue()); |
| 34 | idx += 1; |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | var select_tanker = func() { |
| 41 | var name = getprop("/sim/gui/dialogs/tanker/selected-tanker"); |
| 42 | |
| 43 | foreach (var t; tankers) { |
| 44 | if (name == t.getNode("name", 1).getValue()) { |
| 45 | props.copy(t, tanker_node); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | var generate_tanker = func() { |
| 51 | if (tanker_node.getNode("name", 1).getValue()) { |
| 52 | tanker.request_new(tanker_node); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | </open> |
| 57 | </nasal> |
| 58 | |
| 59 | <group> |
| 60 | <layout>hbox</layout> |
| 61 | |
| 62 | <text> |
| 63 | <label>Air-to-Air Refueling Tanker</label> |
| 64 | </text> |
| 65 | |
| 66 | <empty><stretch>1</stretch></empty> |
| 67 | |
| 68 | <button> |
| 69 | <legend>X</legend> |
| 70 | <key>Esc</key> |
| 71 | <pref-width>20</pref-width> |
| 72 | <pref-height>20</pref-height> |
| 73 | <binding> |
| 74 | <command>dialog-close</command> |
| 75 | </binding> |
| 76 | </button> |
| 77 | </group> |
| 78 | |
| 79 | <hrule/> |
| 80 | |
| 81 | <group> |
| 82 | <layout>table</layout> |
| 83 | |
| 84 | <text> |
| 85 | <row>0</row> |
| 86 | <col>0</col> |
| 87 | <halign>right</halign> |
| 88 | <label>Tanker:</label> |
| 89 | </text> |
| 90 | |
| 91 | <combo> |
| 92 | <name>tanker-combo</name> |
| 93 | <row>0</row> |
| 94 | <col>1</col> |
| 95 | <colspan>2</colspan> |
| 96 | <halign>left</halign> |
| 97 | <property>/sim/gui/dialogs/tanker/selected-tanker</property> |
| 98 | <editable>false</editable> |
| 99 | <pref-width>200</pref-width> |
| 100 | <halign>fill</halign> |
| 101 | <binding> |
| 102 | <command>dialog-apply</command> |
| 103 | <object-name>tanker-combo</object-name> |
| 104 | </binding> |
| 105 | <binding> |
| 106 | <command>nasal</command> |
| 107 | <script>select_tanker();</script> |
| 108 | </binding> |
| 109 | </combo> |
| 110 | |
| 111 | <text> |
| 112 | <row>1</row> |
| 113 | <col>0</col> |
| 114 | <halign>right</halign> |
| 115 | <label>Type:</label> |
| 116 | </text> |
| 117 | |
| 118 | <text> |
| 119 | <row>1</row> |
| 120 | <col>1</col> |
| 121 | <visible> |
| 122 | <equals> |
| 123 | <property>/sim/gui/dialogs/tanker/tanker/type</property> |
| 124 | <value>probe</value> |
| 125 | </equals> |
| 126 | </visible> |
| 127 | <colspan>3</colspan> |
| 128 | <halign>left</halign> |
| 129 | <label>Drogue and Probe</label> |
| 130 | </text> |
| 131 | |
| 132 | <text> |
| 133 | <row>1</row> |
| 134 | <col>1</col> |
| 135 | <visible> |
| 136 | <equals> |
| 137 | <property>/sim/gui/dialogs/tanker/tanker/type</property> |
| 138 | <value>boom</value> |
| 139 | </equals> |
| 140 | </visible> |
| 141 | <colspan>3</colspan> |
| 142 | <halign>left</halign> |
| 143 | <label>Boom</label> |
| 144 | </text> |
| 145 | |
| 146 | <text> |
| 147 | <row>2</row> |
| 148 | <col>0</col> |
| 149 | <halign>right</halign> |
| 150 | <label>Speed:</label> |
| 151 | </text> |
| 152 | |
| 153 | <slider> |
| 154 | <name>tanker-speed</name> |
| 155 | <row>2</row> |
| 156 | <col>1</col> |
| 157 | <halign>fill</halign> |
| 158 | <min>100</min> |
| 159 | <max>350</max> |
| 160 | <live>true</live> |
| 161 | <property>/sim/gui/dialogs/tanker/tanker/speed-kts</property> |
| 162 | <binding> |
| 163 | <command>dialog-apply</command> |
| 164 | <object-name>tanker-speed</object-name> |
| 165 | </binding> |
| 166 | </slider> |
| 167 | |
| 168 | <text> |
| 169 | <row>2</row> |
| 170 | <col>2</col> |
| 171 | <halign>left</halign> |
| 172 | <format>%2.0fkts</format> |
| 173 | <label>250</label> |
| 174 | <property>/sim/gui/dialogs/tanker/tanker/speed-kts</property> |
| 175 | <live>true</live> |
| 176 | </text> |
| 177 | |
| 178 | <text> |
| 179 | <row>3</row> |
| 180 | <col>0</col> |
| 181 | <halign>right</halign> |
| 182 | <label>Contact radius:</label> |
| 183 | </text> |
| 184 | |
| 185 | <slider> |
| 186 | <name>contact-radius</name> |
| 187 | <row>3</row> |
| 188 | <col>1</col> |
| 189 | <halign>fill</halign> |
| 190 | <min>1</min> |
| 191 | <max>100</max> |
| 192 | <property>/systems/refuel/contact-radius-m</property> |
| 193 | <binding> |
| 194 | <command>dialog-apply</command> |
| 195 | <object-name>contact-radius</object-name> |
| 196 | </binding> |
| 197 | </slider> |
| 198 | |
| 199 | <text> |
| 200 | <row>3</row> |
| 201 | <col>2</col> |
| 202 | <halign>left</halign> |
| 203 | <format>%2.0fm</format> |
| 204 | <property>/systems/refuel/contact-radius-m</property> |
| 205 | <live>true</live> |
| 206 | </text> |
| 207 | |
| 208 | <text> |
| 209 | <row>4</row> |
| 210 | <col>0</col> |
| 211 | <halign>right</halign> |
| 212 | <label>Report refueling:</label> |
| 213 | </text> |
| 214 | |
| 215 | <checkbox> |
| 216 | <name>report-contact</name> |
| 217 | <row>4</row> |
| 218 | <col>1</col> |
| 219 | <halign>left</halign> |
| 220 | <property>/systems/refuel/report-contact</property> |
| 221 | <binding> |
| 222 | <command>dialog-apply</command> |
| 223 | <object-name>report-contact</object-name> |
| 224 | </binding> |
| 225 | </checkbox> |
| 226 | |
| 227 | </group> |
| 228 | |
| 229 | <hrule/> |
| 230 | |
| 231 | <group> |
| 232 | <layout>hbox</layout> |
| 233 | <default-padding>5</default-padding> |
| 234 | |
| 235 | <empty><stretch>true</stretch></empty> |
| 236 | |
| 237 | <button> |
| 238 | <legend>Request</legend> |
| 239 | <equal>true</equal> |
| 240 | <binding> |
| 241 | <command>nasal</command> |
| 242 | <script>generate_tanker();</script> |
| 243 | </binding> |
| 244 | </button> |
| 245 | |
| 246 | <empty><stretch>true</stretch></empty> |
| 247 | |
| 248 | <button> |
| 249 | <legend>Get Position</legend> |
| 250 | <equal>true</equal> |
| 251 | <binding> |
| 252 | <command>nasal</command> |
| 253 | <script>tanker.report()</script> |
| 254 | </binding> |
| 255 | </button> |
| 256 | |
| 257 | <empty><stretch>true</stretch></empty> |
| 258 | |
| 259 | <button> |
| 260 | <legend>Close</legend> |
| 261 | <equal>true</equal> |
| 262 | <key>Esc</key> |
| 263 | <binding> |
| 264 | <command>dialog-close</command> |
| 265 | </binding> |
| 266 | </button> |
| 267 | |
| 268 | <empty><stretch>true</stretch></empty> |
| 269 | |
| 270 | </group> |
| 271 | |
| 272 | </PropertyList> |