| 1 |
<?xml version="1.0"?> |
| 2 |
|
| 3 |
|
| 4 |
<PropertyList> |
| 5 |
<name>multiplayer</name> |
| 6 |
<layout>vbox</layout> |
| 7 |
<resizable>false</resizable> |
| 8 |
|
| 9 |
<nasal> |
| 10 |
<open> |
| 11 |
<![CDATA[ |
| 12 |
if ((getprop("/sim/multiplay/selected-server") == nil) or |
| 13 |
(getprop("/sim/multiplay/selected-server") == "" ) ){ |
| 14 |
var tx = getprop("/sim/multiplay/txhost"); |
| 15 |
var dlg = cmdarg(); |
| 16 |
var servers = cmdarg().getChildren("group")[1].getChildren("combo")[0].getChildren("value"); |
| 17 |
foreach (var s; servers) { |
| 18 |
var server = s.getValue(); |
| 19 |
var host = split(" ", server)[0]; |
| 20 |
if (host == tx) { |
| 21 |
setprop("/sim/multiplay/selected-server", server); |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
if (getprop("/sim/multiplay/rxport") == nil or getprop("/sim/multiplay/rxport") == 0) |
| 26 |
setprop("/sim/multiplay/rxport",5000); |
| 27 |
|
| 28 |
if (getprop("/sim/multiplay/txport") == nil or getprop("/sim/multiplay/txport") == 0) |
| 29 |
setprop("/sim/multiplay/txport",5000); |
| 30 |
|
| 31 |
if (getprop("/sim/multiplay/protocol-version") == 2) |
| 32 |
setprop("/sim/gui/dialogs/multiplay/protocol-version", "Visible to only 2017+"); |
| 33 |
else |
| 34 |
setprop("/sim/gui/dialogs/multiplay/protocol-version", "Visible to all"); |
| 35 |
|
| 36 |
var servers = props.globals.getNode("/sim/gui/dialogs/multiplay/servers", 1); |
| 37 |
var updateServers = func(n) { |
| 38 |
if( !n.getValue() ) return; |
| 39 |
servers.removeChildren("value"); |
| 40 |
# get the results list from the server |
| 41 |
var serverlist = props.globals.getNode("/sim/multiplay/server-list", 1); |
| 42 |
|
| 43 |
var i=0; |
| 44 |
foreach (var s; serverlist.getChildren("server")) { |
| 45 |
|
| 46 |
# prepare some default values |
| 47 |
s.initNode("online", 1, "BOOL" ); |
| 48 |
s.initNode("location", "unknown", "STRING" ); |
| 49 |
s.initNode("name", s.getNode("hostname").getValue(), "STRING" ); |
| 50 |
if (!s.getNode("online").getBoolValue()) { |
| 51 |
continue; # skip offline servers |
| 52 |
} |
| 53 |
|
| 54 |
# label is name and location, for the moment |
| 55 |
# should we include the number of users? or wait until we |
| 56 |
# have a better UI toolkit? |
| 57 |
var nm = s.getNode("hostname").getValue() ~ " - " ~ s.getNode("location").getValue(); |
| 58 |
servers.getNode("value[" ~ i ~ "]", 1).setValue(nm); |
| 59 |
i += 1; |
| 60 |
} |
| 61 |
|
| 62 |
gui.dialog_update("multiplayer", "host"); |
| 63 |
} |
| 64 |
|
| 65 |
var static_serverList = [ |
| 66 |
['mpserver01.flightgear.org', 'Frankfurt, Germany'], |
| 67 |
['mpserver02.flightgear.org', 'Kansas, USA'], |
| 68 |
['mpserver03.flightgear.org', 'Germany'], |
| 69 |
['mpserver04.flightgear.org', 'United Kingdom'], |
| 70 |
['mpserver05.flightgear.org', 'Chicago, USA'], |
| 71 |
['mpserver07.flightgear.org', 'Wisconsin, USA'], |
| 72 |
['mpserver08.flightgear.org', 'Frankfurt am Main, Germany'], |
| 73 |
['mpserver09.flightgear.org', 'Koln, Germany'], |
| 74 |
['mpserver10.flightgear.org', 'Montpellier, France'], |
| 75 |
['mpserver11.flightgear.org', 'Vilnius, Lithuania'], |
| 76 |
['mpserver12.flightgear.org', 'Amsterdam, Netherlands'], |
| 77 |
['mpserver13.flightgear.org', 'Grenoble, France'] |
| 78 |
]; |
| 79 |
|
| 80 |
var updateServersFailed = func(n) { |
| 81 |
if( !n.getValue() ) return; |
| 82 |
debug.dump("Failed to retrieve server list!"); |
| 83 |
|
| 84 |
servers.removeChildren("value"); |
| 85 |
var i=0; |
| 86 |
foreach (var s; static_serverList) { |
| 87 |
# create the node the PUI combo |
| 88 |
var nm = s[0] ~ " - " ~ s[1]; |
| 89 |
servers.getNode("value[" ~ i ~ "]", 1).setValue(nm); |
| 90 |
i += 1; |
| 91 |
} |
| 92 |
|
| 93 |
gui.dialog_update("multiplayer", "host"); |
| 94 |
} |
| 95 |
|
| 96 |
# listen for results arriving |
| 97 |
setlistener("/sim/multiplay/got-servers", updateServers); |
| 98 |
setlistener("/sim/multiplay/get-servers-failure", updateServersFailed); |
| 99 |
fgcommand("multiplayer-refreshserverlist"); |
| 100 |
]]> |
| 101 |
</open> |
| 102 |
|
| 103 |
<close> |
| 104 |
</close> |
| 105 |
</nasal> |
| 106 |
|
| 107 |
|
| 108 |
<group> |
| 109 |
<layout>hbox</layout> |
| 110 |
|
| 111 |
<text> |
| 112 |
<label>Multiplayer Settings</label> |
| 113 |
</text> |
| 114 |
|
| 115 |
<empty><stretch>1</stretch></empty> |
| 116 |
|
| 117 |
<button> |
| 118 |
<legend>X</legend> |
| 119 |
<key>Esc</key> |
| 120 |
<pref-width>20</pref-width> |
| 121 |
<pref-height>20</pref-height> |
| 122 |
<binding> |
| 123 |
<command>dialog-close</command> |
| 124 |
</binding> |
| 125 |
</button> |
| 126 |
</group> |
| 127 |
<hrule/> |
| 128 |
|
| 129 |
|
| 130 |
<group> |
| 131 |
<layout>table</layout> |
| 132 |
<halign>center</halign> |
| 133 |
|
| 134 |
<text> |
| 135 |
<row>0</row> |
| 136 |
<col>0</col> |
| 137 |
<label> Options:</label> |
| 138 |
<halign>right</halign> |
| 139 |
</text> |
| 140 |
<checkbox> |
| 141 |
<row>0</row> |
| 142 |
<col>1</col> |
| 143 |
<colspan>2</colspan> |
| 144 |
<halign>left</halign> |
| 145 |
<name>hide-replay</name> |
| 146 |
<label>Hide replay sessions over MP (less annoying to other players)</label> |
| 147 |
<property>/sim/multiplay/freeze-on-replay</property> |
| 148 |
<binding> |
| 149 |
<command>dialog-apply</command> |
| 150 |
<object-name>hide-replay</object-name> |
| 151 |
</binding> |
| 152 |
</checkbox> |
| 153 |
|
| 154 |
<checkbox> |
| 155 |
<row>1</row> |
| 156 |
<col>1</col> |
| 157 |
<colspan>2</colspan> |
| 158 |
<halign>left</halign> |
| 159 |
<name>ai-traffic</name> |
| 160 |
<label>Show AI Traffic (mixing MP and AI traffic may be confusing)</label> |
| 161 |
<property>/sim/traffic-manager/enabled</property> |
| 162 |
<binding> |
| 163 |
<command>dialog-apply</command> |
| 164 |
<object-name>ai-traffic</object-name> |
| 165 |
</binding> |
| 166 |
</checkbox> |
| 167 |
|
| 168 |
<checkbox> |
| 169 |
<row>2</row> |
| 170 |
<col>1</col> |
| 171 |
<colspan>2</colspan> |
| 172 |
<halign>left</halign> |
| 173 |
<name>mpcarrier-auto-attach</name> |
| 174 |
<label>Automatically enable AI scenarios and attach to multiplayer carriers</label> |
| 175 |
<property>/sim/mp-carriers/auto-attach</property> |
| 176 |
<binding> |
| 177 |
<command>property-toggle</command> |
| 178 |
<property>/sim/mp-carriers/auto-attach</property> |
| 179 |
</binding> |
| 180 |
</checkbox> |
| 181 |
|
| 182 |
<checkbox> |
| 183 |
<row>3</row> |
| 184 |
<col>1</col> |
| 185 |
<colspan>2</colspan> |
| 186 |
<halign>left</halign> |
| 187 |
<name>mpcarrier-latch-always</name> |
| 188 |
<label>Always latch MP and AI carrier.</label> |
| 189 |
<property>/sim/mp-carriers/latch-always</property> |
| 190 |
<binding> |
| 191 |
<command>property-toggle</command> |
| 192 |
<property>/sim/mp-carriers/latch-always</property> |
| 193 |
</binding> |
| 194 |
</checkbox> |
| 195 |
|
| 196 |
<checkbox> |
| 197 |
<row>4</row> |
| 198 |
<col>1</col> |
| 199 |
<colspan>2</colspan> |
| 200 |
<halign>left</halign> |
| 201 |
<name>hot</name> |
| 202 |
<label>Enable collisions with other players</label> |
| 203 |
<property>/sim/multiplay/hot</property> |
| 204 |
<binding> |
| 205 |
<command>dialog-apply</command> |
| 206 |
<object-name>hot</object-name> |
| 207 |
</binding> |
| 208 |
<live>true</live> |
| 209 |
</checkbox> |
| 210 |
|
| 211 |
<checkbox> |
| 212 |
<row>5</row> |
| 213 |
<col>1</col> |
| 214 |
<colspan>2</colspan> |
| 215 |
<halign>left</halign> |
| 216 |
<visible> |
| 217 |
<property>sim/multiplay/transmit-filter-property-base-available</property> |
| 218 |
</visible> |
| 219 |
<property>sim/multiplay/transmit-filter-property-base</property> |
| 220 |
<live>true</live> |
| 221 |
<label>Emesary only multiplayer mode</label> |
| 222 |
<binding> |
| 223 |
<command>property-toggle</command> |
| 224 |
<property>sim/multiplay/transmit-filter-property-base</property> |
| 225 |
</binding> |
| 226 |
</checkbox> |
| 227 |
|
| 228 |
|
| 229 |
<checkbox> |
| 230 |
<row>6</row> |
| 231 |
<col>1</col> |
| 232 |
<colspan>2</colspan> |
| 233 |
<halign>left</halign> |
| 234 |
<property>sim/error-report/mp-report-enabled</property> |
| 235 |
<live>true</live> |
| 236 |
<label>Report problems with other pilots' models</label> |
| 237 |
<binding> |
| 238 |
<command>property-toggle</command> |
| 239 |
<property>sim/error-report/mp-report-enabled</property> |
| 240 |
</binding> |
| 241 |
</checkbox> |
| 242 |
|
| 243 |
<text> |
| 244 |
<row>7</row> |
| 245 |
<col>0</col> |
| 246 |
<halign>right</halign> |
| 247 |
<label> Callsign:</label> |
| 248 |
</text> |
| 249 |
<input> |
| 250 |
<row>7</row> |
| 251 |
<col>1</col> |
| 252 |
<halign>left</halign> |
| 253 |
<property>/sim/multiplay/callsign</property> |
| 254 |
<enable> |
| 255 |
<not> |
| 256 |
<property>/sim/multiplay/online</property> |
| 257 |
</not> |
| 258 |
</enable> |
| 259 |
</input> |
| 260 |
<group> |
| 261 |
<layout>hbox</layout> |
| 262 |
<row>7</row> |
| 263 |
<col>1</col> |
| 264 |
<text> |
| 265 |
<width>2</width> |
| 266 |
<halign>right</halign> |
| 267 |
<label>rxPort</label> |
| 268 |
</text> |
| 269 |
<input> |
| 270 |
<pref-width>50</pref-width> |
| 271 |
<halign>left</halign> |
| 272 |
<property>/sim/multiplay/rxport</property> |
| 273 |
<enable> |
| 274 |
<not> |
| 275 |
<property>/sim/multiplay/online</property> |
| 276 |
</not> |
| 277 |
</enable> |
| 278 |
</input> |
| 279 |
</group> |
| 280 |
|
| 281 |
|
| 282 |
<combo> |
| 283 |
<name>host</name> |
| 284 |
<halign>left</halign> |
| 285 |
<row>8</row> |
| 286 |
<col>1</col> |
| 287 |
<colspan>2</colspan> |
| 288 |
<pref-width>350</pref-width> |
| 289 |
<property>/sim/multiplay/selected-server</property> |
| 290 |
<editable>true</editable> |
| 291 |
|
| 292 |
<properties>/sim/gui/dialogs/multiplay/servers</properties> |
| 293 |
</combo> |
| 294 |
|
| 295 |
<text> |
| 296 |
<row>9</row> |
| 297 |
<col>0</col> |
| 298 |
<halign>right</halign> |
| 299 |
<label>Server:</label> |
| 300 |
</text> |
| 301 |
<text> |
| 302 |
<visible> |
| 303 |
<not><property>/sim/multiplay/online</property></not> |
| 304 |
</visible> |
| 305 |
<row>9</row> |
| 306 |
<col>1</col> |
| 307 |
<halign>left</halign> |
| 308 |
<label>Not connected</label> |
| 309 |
</text> |
| 310 |
<text> |
| 311 |
<row>9</row> |
| 312 |
<col>1</col> |
| 313 |
<visible> |
| 314 |
<property>/sim/multiplay/online</property> |
| 315 |
</visible> |
| 316 |
<halign>left</halign> |
| 317 |
<label>MMMMMMMMMMMMMMMMM</label> |
| 318 |
<format>Connected to %s</format> |
| 319 |
<property>/sim/multiplay/txhost</property> |
| 320 |
<live>true</live> |
| 321 |
</text> |
| 322 |
</group> |
| 323 |
|
| 324 |
|
| 325 |
<hrule/> |
| 326 |
<group> |
| 327 |
<layout>hbox</layout> |
| 328 |
<default-padding>10</default-padding> |
| 329 |
<empty><stretch>true</stretch></empty> |
| 330 |
|
| 331 |
<button> |
| 332 |
<legend>Connect</legend> |
| 333 |
<equal>true</equal> |
| 334 |
<enable> |
| 335 |
<not> |
| 336 |
<property>/sim/multiplay/online</property> |
| 337 |
</not> |
| 338 |
</enable> |
| 339 |
<binding> |
| 340 |
<command>dialog-apply</command> |
| 341 |
</binding> |
| 342 |
<binding> |
| 343 |
<command>nasal</command> |
| 344 |
<script> |
| 345 |
fgcommand("multiplayer-connect", props.Node.new({ |
| 346 |
"servername": getprop("/sim/multiplay/selected-server"), |
| 347 |
"rxport": getprop("/sim/multiplay/rxport"), |
| 348 |
"txport": getprop("/sim/multiplay/txport") |
| 349 |
})); |
| 350 |
</script> |
| 351 |
</binding> |
| 352 |
</button> |
| 353 |
|
| 354 |
<button> |
| 355 |
<legend>Disconnect</legend> |
| 356 |
<equal>true</equal> |
| 357 |
<enable> |
| 358 |
<property>/sim/multiplay/online</property> |
| 359 |
</enable> |
| 360 |
<binding> |
| 361 |
<command>dialog-apply</command> |
| 362 |
</binding> |
| 363 |
<binding> |
| 364 |
<command>multiplayer-disconnect</command> |
| 365 |
<subsystem>mp</subsystem> |
| 366 |
</binding> |
| 367 |
</button> |
| 368 |
|
| 369 |
<button> |
| 370 |
<row>1</row><col>2</col> |
| 371 |
<legend>Server Status</legend> |
| 372 |
<binding> |
| 373 |
<command>open-browser</command> |
| 374 |
<path>http://mpmap01.flightgear.org/mpstatus/</path> |
| 375 |
</binding> |
| 376 |
</button> |
| 377 |
|
| 378 |
<button> |
| 379 |
<legend>Close</legend> |
| 380 |
<default>true</default> |
| 381 |
<equal>true</equal> |
| 382 |
<binding> |
| 383 |
<command>dialog-close</command> |
| 384 |
</binding> |
| 385 |
</button> |
| 386 |
|
| 387 |
<empty><stretch>true</stretch></empty> |
| 388 |
</group> |
| 389 |
|
| 390 |
</PropertyList> |