Make reverse thrust also respect selected engines
The simple toggle, bound to Del, engages reverse on the selected engine, but if it is engaged on either, disengages it on both, so you don't get stuck in reverse when selecting engine. I also removed the check of weight-on-wheels from the disengage case, so you don't get stuck if somehow the aircraft still becomes airborne after selecting reverse on the ground. The finer control, bound to F1 and F2, only controls the selected engines now. Previous version disengaged reverse for both engines when either reached zero throttle-rev, which does not seem to be founded in reality and does not make much sense. You can always use Del to disengage reverse on both engines.
This commit is contained in:
parent
9e82967df1
commit
837d2a16d3
1 changed files with 49 additions and 40 deletions
|
@ -138,15 +138,19 @@ var toggleFastRevThrust = func {
|
|||
var state1 = getprop("systems/thrust/state1");
|
||||
var state2 = getprop("systems/thrust/state2");
|
||||
if (state1 == "IDLE" and state2 == "IDLE" and getprop("controls/engines/engine[0]/reverser") == "0" and getprop("controls/engines/engine[1]/reverser") == "0" and getprop("gear/gear[1]/wow") == 1 and getprop("gear/gear[2]/wow") == 1) {
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
|
||||
setprop("controls/engines/engine[0]/reverser", 1);
|
||||
setprop("controls/engines/engine[1]/reverser", 1);
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0.65);
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0.65);
|
||||
setprop("fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
|
||||
setprop("fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
|
||||
} else if ((getprop("controls/engines/engine[0]/reverser") == "1") or (getprop("controls/engines/engine[1]/reverser") == "1") and (getprop("gear/gear[1]/wow") == 1) and (getprop("gear/gear[2]/wow") == 1)) {
|
||||
if (getprop("sim/input/selected/engine[0]") == 1) {
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
|
||||
setprop("controls/engines/engine[0]/reverser", 1);
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0.65);
|
||||
setprop("fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
|
||||
}
|
||||
if (getprop("sim/input/selected/engine[1]") == 1) {
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
|
||||
setprop("controls/engines/engine[1]/reverser", 1);
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0.65);
|
||||
setprop("fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
|
||||
}
|
||||
} else if ((getprop("controls/engines/engine[0]/reverser") == "1") or (getprop("controls/engines/engine[1]/reverser") == "1")) {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0);
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0);
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
|
||||
|
@ -159,54 +163,59 @@ var toggleFastRevThrust = func {
|
|||
}
|
||||
|
||||
var doRevThrust = func {
|
||||
if (getprop("controls/engines/engine[0]/reverser") == "1" and getprop("controls/engines/engine[1]/reverser") == "1" and getprop("gear/gear[1]/wow") == 1 and getprop("gear/gear[2]/wow") == 1) {
|
||||
var pos1 = getprop("controls/engines/engine[0]/throttle-rev");
|
||||
var pos2 = getprop("controls/engines/engine[1]/throttle-rev");
|
||||
if (pos1 < 0.649) {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", pos1 + 0.15);
|
||||
if (getprop("gear/gear[1]/wow") != 1 and getprop("gear/gear[2]/wow") != 1) {
|
||||
# Can't select reverse if not on the ground
|
||||
return;
|
||||
}
|
||||
if (getprop("sim/input/selected/engine[0]") == 1 and getprop("controls/engines/engine[0]/reverser") == "1") {
|
||||
var pos = getprop("controls/engines/engine[0]/throttle-rev");
|
||||
if (pos < 0.649) {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", pos + 0.15);
|
||||
}
|
||||
if (pos2 < 0.649) {
|
||||
setprop("controls/engines/engine[1]/throttle-rev", pos2 + 0.15);
|
||||
}
|
||||
if (getprop("sim/input/selected/engine[1]") == 1 and getprop("controls/engines/engine[1]/reverser") == "1") {
|
||||
var pos = getprop("controls/engines/engine[1]/throttle-rev");
|
||||
if (pos < 0.649) {
|
||||
setprop("controls/engines/engine[1]/throttle-rev", pos + 0.15);
|
||||
}
|
||||
}
|
||||
var state1 = getprop("systems/thrust/state1");
|
||||
var state2 = getprop("systems/thrust/state2");
|
||||
if (state1 == "IDLE" and state2 == "IDLE" and getprop("controls/engines/engine[0]/reverser") == "0" and getprop("controls/engines/engine[1]/reverser") == "0" and getprop("gear/gear[1]/wow") == 1 and getprop("gear/gear[2]/wow") == 1) {
|
||||
if (getprop("sim/input/selected/engine[0]") == 1 and state1 == "IDLE" and getprop("controls/engines/engine[0]/reverser") == "0") {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0.05);
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0.05);
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 1, 1.4);
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
|
||||
setprop("controls/engines/engine[0]/reverser", 1);
|
||||
setprop("controls/engines/engine[1]/reverser", 1);
|
||||
setprop("fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 3.14);
|
||||
}
|
||||
if (getprop("sim/input/selected/engine[1]") == 1 and state2 == "IDLE" and getprop("controls/engines/engine[1]/reverser") == "0") {
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0.05);
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 1, 1.4);
|
||||
setprop("controls/engines/engine[1]/reverser", 1);
|
||||
setprop("fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 3.14);
|
||||
}
|
||||
}
|
||||
|
||||
var unRevThrust = func {
|
||||
if (getprop("controls/engines/engine[0]/reverser") == "1" or getprop("controls/engines/engine[1]/reverser") == "1") {
|
||||
var pos1 = getprop("controls/engines/engine[0]/throttle-rev");
|
||||
var pos2 = getprop("controls/engines/engine[1]/throttle-rev");
|
||||
if (pos1 > 0.051) {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", pos1 - 0.15);
|
||||
if (getprop("sim/input/selected/engine[0]") == 1 and getprop("controls/engines/engine[0]/reverser") == "1") {
|
||||
var pos = getprop("controls/engines/engine[0]/throttle-rev");
|
||||
if (pos > 0.051) {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", pos - 0.15);
|
||||
} else {
|
||||
unRevThrust_b();
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0);
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
|
||||
setprop("fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
|
||||
setprop("controls/engines/engine[0]/reverser", 0);
|
||||
}
|
||||
if (pos2 > 0.051) {
|
||||
setprop("controls/engines/engine[1]/throttle-rev", pos2 - 0.15);
|
||||
}
|
||||
if (getprop("sim/input/selected/engine[1]") == 1 and getprop("controls/engines/engine[1]/reverser") == "1") {
|
||||
var pos = getprop("controls/engines/engine[1]/throttle-rev");
|
||||
if (pos > 0.051) {
|
||||
setprop("controls/engines/engine[1]/throttle-rev", pos - 0.15);
|
||||
} else {
|
||||
unRevThrust_b();
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0);
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
|
||||
setprop("fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
|
||||
setprop("controls/engines/engine[1]/reverser", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var unRevThrust_b = func {
|
||||
setprop("controls/engines/engine[0]/throttle-rev", 0);
|
||||
setprop("controls/engines/engine[1]/throttle-rev", 0);
|
||||
interpolate("/engines/engine[0]/reverser-pos-norm", 0, 1.0);
|
||||
interpolate("/engines/engine[1]/reverser-pos-norm", 0, 1.0);
|
||||
setprop("fdm/jsbsim/propulsion/engine[0]/reverser-angle-rad", 0);
|
||||
setprop("fdm/jsbsim/propulsion/engine[1]/reverser-angle-rad", 0);
|
||||
setprop("controls/engines/engine[0]/reverser", 0);
|
||||
setprop("controls/engines/engine[1]/reverser", 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue