Re-order initialization and fix a couple of bugs.
This commit is contained in:
parent
757c2314dd
commit
acef95d90c
1 changed files with 18 additions and 16 deletions
|
@ -117,24 +117,11 @@ var check_params = func() {
|
|||
_setlistener("/sim/signals/fdm-initialized",
|
||||
func {
|
||||
fdm = getprop("/sim/flight-model");
|
||||
check_params();
|
||||
running_redout = getprop("/sim/rendering/redout/enabled");
|
||||
running_compression = getprop("/sim/rendering/headshake/enabled");
|
||||
internal = getprop("/sim/current-view/internal");
|
||||
lp_black = aircraft.lowpass.new(0.2);
|
||||
lp_red = aircraft.lowpass.new(0.25);
|
||||
run();
|
||||
|
||||
setlistener("/sim/rendering/redout/enabled", func(n) {
|
||||
if ((running_redout == 0) and n.getBoolValue())
|
||||
{
|
||||
running_redout = 1;
|
||||
run();
|
||||
}
|
||||
else
|
||||
{
|
||||
running_redout = n.getBoolValue();
|
||||
}
|
||||
}, 1);
|
||||
|
||||
setlistener("/sim/rendering/redout/parameters", func {
|
||||
# one parameter has changed, read them all in again
|
||||
|
@ -145,6 +132,10 @@ _setlistener("/sim/signals/fdm-initialized",
|
|||
internal = n.getBoolValue();
|
||||
});
|
||||
|
||||
setlistener("/sim/rendering/headshake/rate-m-g", func(n) {
|
||||
compression_rate = n.getValue();
|
||||
}, 1);
|
||||
|
||||
setlistener("/sim/rendering/headshake/enabled", func(n) {
|
||||
if ((running_compression == 0) and n.getBoolValue())
|
||||
{
|
||||
|
@ -157,8 +148,19 @@ _setlistener("/sim/signals/fdm-initialized",
|
|||
}
|
||||
}, 1);
|
||||
|
||||
setlistener("/sim/rendering/headshake/rate-m-g", func(n) {
|
||||
compression_rate = n.getValue();
|
||||
setlistener("/sim/rendering/redout/enabled", func(n) {
|
||||
if ((running_redout == 0) and n.getBoolValue())
|
||||
{
|
||||
running_redout = 1;
|
||||
run();
|
||||
}
|
||||
else
|
||||
{
|
||||
running_redout = n.getBoolValue();
|
||||
}
|
||||
}, 1);
|
||||
|
||||
# Now we've set up the listeners (which will have triggered), run it.
|
||||
run();
|
||||
}
|
||||
);
|
Loading…
Reference in a new issue