1
0
Fork 0
fgdata/Nasal/weather_scenario.nas
Torsten Dreyer cdb21a52e4 GlobalWeather: (better) support for weather-scenario
- handle /environment/weather-scenario property on startup
- try to detect predefined scenario on startup of global
weather dialog box and select the corresponding entry in
the scenario combo box.
2011-01-17 21:05:01 +01:00

27 lines
921 B
Text

# Set the global weather according to the defined
# scenario in /environment/weather-scenario
#
var initialize_weather_scenario = func {
getprop( "/environment/params/metar-updates-environment", 0 ) == 0 and return;
getprop( "/environment/realwx/enabled", 0 ) and return;
getprop( "/environment/metar/data", "" ) != "" and return;
# preset configured scenario
var scn = getprop("/environment/weather-scenario", "");
var wsn = props.globals.getNode( "/environment/weather-scenarios" );
if( wsn != nil ) {
var scenarios = wsn.getChildren("scenario");
forindex (var i; scenarios ) {
if( scenarios[i].getNode("name").getValue() == scn ) {
setprop("/environment/metar/data", scenarios[i].getNode("metar").getValue() );
break;
}
}
}
};
_setlistener("/sim/signals/nasal-dir-initialized", func {
initialize_weather_scenario();
delete(globals, "weather_scenario");
});