Use z/Z to control Max. Vis. when using Detailed Weather
Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
parent
92bfb39f50
commit
9b697adb4f
1 changed files with 43 additions and 8 deletions
|
@ -18,14 +18,46 @@ var decreaseVisibility = func {
|
|||
}
|
||||
|
||||
var adjustVisibility = func( factor ) {
|
||||
var val = visibilityProp.getValue() * factor;
|
||||
var val = 0;
|
||||
var aux_val = 0;
|
||||
var local = getprop("sim/gui/dialogs/metar/mode/local-weather");
|
||||
var global = getprop("sim/gui/dialogs/metar/mode/global-weather");
|
||||
var max_aux_vis = 12.429216196;
|
||||
var min_aux_vis = 9.90348;
|
||||
|
||||
if(global)
|
||||
{
|
||||
val = visibilityProp.getValue() * factor;
|
||||
|
||||
if( val < 1.0 ) val = getprop("/environment/visibility-m");
|
||||
|
||||
if( val > 30 ) {
|
||||
visibilityProp.setDoubleValue(val);
|
||||
visibilityOverrideProp.setBoolValue(1);
|
||||
}
|
||||
|
||||
gui.popupTip(sprintf("Visibility: %.0f m", val));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (factor == 1.1)
|
||||
factor = 1.001;
|
||||
else
|
||||
factor = 0.999;
|
||||
|
||||
aux_val = auxvisibilityProp.getValue() * factor;
|
||||
|
||||
if( aux_val <= min_aux_vis)
|
||||
auxvisibilityProp.setDoubleValue(min_aux_vis);
|
||||
elsif(aux_val >= max_aux_vis)
|
||||
auxvisibilityProp.setDoubleValue(max_aux_vis);
|
||||
else
|
||||
auxvisibilityProp.setDoubleValue(aux_val);
|
||||
|
||||
gui.popupTip(sprintf("Max Visibility: %.0f m", getprop("/local-weather/config/max-vis-range-m")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
##
|
||||
# Handler. Reset visibility to default.
|
||||
|
@ -38,8 +70,11 @@ var resetVisibility = func {
|
|||
|
||||
var visibilityProp = nil;
|
||||
var visibilityOverrideProp = nil;
|
||||
var auxvisibilityProp = nil;
|
||||
|
||||
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||
print ("environment init");
|
||||
visibilityProp = props.globals.initNode("/environment/config/presets/visibility-m", 0, "DOUBLE" );
|
||||
visibilityOverrideProp = props.globals.initNode("/environment/config/presets/visibility-m-override", 0, "BOOL" );
|
||||
auxvisibilityProp = props.globals.initNode("/local-weather/config/aux-max-vis-range-m", 0, "DOUBLE" );
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue