6) and string.match(word, "*[0-9][0-9]KT")) {
# We've got the wind definition word. Now to split it up.
# Format is nnnmmKT or nnnmmGppKT
# Direction is easy - the first 3 characters.
var dir = chr(word[0]) ~ chr(word[1]) ~ chr(word[2]);
if (dir == "VRB") {
setprop("/local-weather/tmp/tile-orientation-deg", 360.0 * rand());
setprop("/local-weather/tmp/gust-angular-variation-deg", 180.0);
setprop("/local-weather/tmp/gust-frequency-hz", 0.001);
} else {
setprop("/local-weather/tmp/tile-orientation-deg", dir);
setprop("/local-weather/tmp/gust-angular-variation-deg", 0.0);
setprop("/local-weather/tmp/gust-frequency-hz", 0.0);
}
# Next two are the base wind
var spd = chr(word[3]) ~ chr(word[4]);
setprop("/local-weather/tmp/windspeed-kt", spd);
var gst = 0;
if ((size(word) > 7) and (chr(word[5]) == 'G')) {
# Gusty case
gst = chr(word[6]) ~ chr(word[7]);
}
if ((gst > spd) and (spd > 0)) {
setprop("/local-weather/tmp/gust-relative-strength", (gst - spd) / spd);
setprop("/local-weather/tmp/gust-frequency-hz", 0.7);
} else {
setprop("/local-weather/tmp/gust-relative-strength", 0.0);
}
}
}
if (local_weather_props != nil) {
# The local weather properties need to be set now, so they can
# be configured by the user if they select Advanced Settings
props.copy(local_weather_props, props.globals.getNode("/local-weather/tmp", 1));
} else {
# If no local weather properties have been set, we'll read from the scenario
# METAR
setprop("/local-weather/tmp/tile-type", "manual");
setprop("/local-weather/tmp/tile-management", "METAR");
}
me.refresh();
},
metarListener : func( n ) {
var metar = getprop("environment/metar/data");
if( metar == nil or metar == "" ) metar = "NIL";
metar = normalize_string(metar);
logprint(LOG_DEBUG, "new METAR: " ~ metar );
setprop( me.base ~ "/metar-string", metar );
gui.dialog_update( "weather-conditions", "metar-string" );
},
};
var controller = GlobalWeatherDialogController.new( cmdarg() );
controller.open();
]]>
weatherfalsefalsevbox3hbox1truetruehboxvbox1vboxlefthboxlefttable0