1
0
Fork 0
A320-family/Nasal/Libraries/shake.nas

30 lines
805 B
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A3XX Shaking
2020-04-18 05:36:46 +00:00
# Copyright (c) 2020 Josh Davidson (Octal450)
2019-10-14 16:48:35 +00:00
var shakeEffectA3XX = props.globals.initNode("/systems/shake/effect", 0, "BOOL");
var shakeA3XX = props.globals.initNode("/systems/shake/shaking", 0, "DOUBLE");
var sf = 0;
var theShakeEffect = func {
if (shakeEffectA3XX.getBoolValue()) {
2020-05-03 17:34:38 +00:00
sf = pts.Gear.rollspeed[0].getValue() / 94000;
2019-10-14 16:48:35 +00:00
interpolate("/systems/shake/shaking", sf, 0.03);
settimer(func {
interpolate("/systems/shake/shaking", -sf * 2, 0.03);
}, 0.06);
settimer(func {
interpolate("/systems/shake/shaking", sf, 0.03);
}, 0.12);
settimer(theShakeEffect, 0.09);
} else {
2020-05-03 17:34:38 +00:00
shakeA3XX.setValue(0);
shakeEffectA3XX.setBoolValue(0);
2019-10-14 16:48:35 +00:00
}
}
2020-05-03 17:34:38 +00:00
setlistener("/systems/shake/effect", func {
if (shakeEffectA3XX.getBoolValue()) {
2019-10-14 16:48:35 +00:00
theShakeEffect();
}
2020-05-03 17:34:38 +00:00
}, 0, 0);