1
0
Fork 0

Stuart BUCHANAN: make adjEngControl() only work for selected engines

mf:
- some minor modifications to Stuart's version  :-)
- select all engines per default. This may seem less realistic (who starts
  all engines on the b29 at once?), but it'll prevent oodles of bug reports.
  And those who want it realistic shouldn't rely on engine 1 being selected
  by default, anyway, but rather actively select every single engine.
  Also: this new behavior is in line with the original intentions (see cvs
  log to preferences.xml -r1.51)
This commit is contained in:
mfranz 2006-03-04 18:21:06 +00:00
parent cb7bfa3599
commit 9d2216d5bc
2 changed files with 18 additions and 5 deletions

View file

@ -203,10 +203,13 @@ adjPropeller = func {
adjEngControl = func {
engs = props.globals.getNode("/controls/engines").getChildren("engine");
selected = props.globals.getNode("/sim/input/selected");
delta = arg[1] * THROTTLE_RATE * getprop("/sim/time/delta-realtime-sec");
foreach(e; engs) {
node = e.getNode(arg[0], 1);
node.setValue(node.getValue() + delta);
if(selected.getChild("engine", e.getIndex(), 1).getBoolValue()) {
node = e.getNode(arg[0], 1);
node.setValue(node.getValue() + delta);
}
}
}
@ -321,6 +324,9 @@ elevatorTrimAxis = func { elevatorTrim(cmdarg().getNode("value").getValue()); }
aileronTrimAxis = func { aileronTrim(cmdarg().getNode("value").getValue()); }
rudderTrimAxis = func { rudderTrim(cmdarg().getNode("value").getValue()); }
##
# Gear handling.
#
gearDown = func {
if (arg[0] < 0) {
setprop("/controls/gear/gear-down", 0);
@ -330,6 +336,9 @@ gearDown = func {
}
gearToggle = func { gearDown(getprop("/controls/gear/gear-down") > 0 ? -1 : 1); }
##
# Brake handling.
#
fullBrakeTime = 0.5;
applyBrakes = func(v, which = 0) {
if (which <= 0) { interpolate("/controls/gear/brake-left", v, fullBrakeTime); }

View file

@ -177,9 +177,13 @@ Started September 2000 by David Megginson, david@megginson.com
<input>
<selected>
<engine n="0" type="bool">true</engine>
<engine n="1" type="bool">false</engine>
<engine n="2" type="bool">false</engine>
<engine n="3" type="bool">false</engine>
<engine n="1" type="bool">true</engine>
<engine n="2" type="bool">true</engine>
<engine n="3" type="bool">true</engine>
<engine n="4" type="bool">true</engine>
<engine n="5" type="bool">true</engine>
<engine n="6" type="bool">true</engine>
<engine n="7" type="bool">true</engine>
</selected>
</input>