From 53527ba0e3c72428d3d362fa66131e23188ae359 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 22 Jul 2018 12:19:58 -0400 Subject: [PATCH] Sim: add support for spoiler joystick binding --- Nasal/libraries.nas | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Nasal/libraries.nas b/Nasal/libraries.nas index a046043d..28272cb8 100644 --- a/Nasal/libraries.nas +++ b/Nasal/libraries.nas @@ -409,18 +409,30 @@ controls.stepSpoilers = func(step) { } var deploySpeedbrake = func { - if (getprop("/controls/flight/speedbrake") < 0.5) { - setprop("/controls/flight/speedbrake", 0.5); - } else if (getprop("/controls/flight/speedbrake") < 1.0) { - setprop("/controls/flight/speedbrake", 1.0); + if (getprop("/gear/gear[1]/wow") == 1 or getprop("/gear/gear[2]/wow") == 1) { + if (getprop("/controls/flight/speedbrake") < 1.0) { + setprop("/controls/flight/speedbrake", 1.0); + } + } else { + if (getprop("/controls/flight/speedbrake") < 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") < 1.0) { + setprop("/controls/flight/speedbrake", 1.0); + } } } var retractSpeedbrake = func { - if (getprop("/controls/flight/speedbrake") > 0.5) { - setprop("/controls/flight/speedbrake", 0.5); - } else if (getprop("/controls/flight/speedbrake") > 0.0) { - setprop("/controls/flight/speedbrake", 0.0); + if (getprop("/gear/gear[1]/wow") == 1 or getprop("/gear/gear[2]/wow") == 1) { + if (getprop("/controls/flight/speedbrake") > 0.0) { + setprop("/controls/flight/speedbrake", 0.0); + } + } else { + if (getprop("/controls/flight/speedbrake") > 0.5) { + setprop("/controls/flight/speedbrake", 0.5); + } else if (getprop("/controls/flight/speedbrake") > 0.0) { + setprop("/controls/flight/speedbrake", 0.0); + } } }