also let adjEngControl return value (average of selected engines)
This commit is contained in:
parent
b417e152e6
commit
886cf8b382
1 changed files with 6 additions and 2 deletions
|
@ -166,8 +166,8 @@ var stepProps = func {
|
||||||
#
|
#
|
||||||
var slewProp = func(prop, delta) {
|
var slewProp = func(prop, delta) {
|
||||||
delta *= getprop("/sim/time/delta-realtime-sec");
|
delta *= getprop("/sim/time/delta-realtime-sec");
|
||||||
setprop(prop, var val = getprop(prop) + delta);
|
setprop(prop, getprop(prop) + delta);
|
||||||
return val;
|
return getprop(prop); # must read again because of clamping
|
||||||
}
|
}
|
||||||
|
|
||||||
# Standard trim rate, in units per second. Remember that the full
|
# Standard trim rate, in units per second. Remember that the full
|
||||||
|
@ -200,12 +200,16 @@ var adjPropeller = func {
|
||||||
|
|
||||||
var adjEngControl = func {
|
var adjEngControl = func {
|
||||||
var delta = arg[1] * THROTTLE_RATE * getprop("/sim/time/delta-realtime-sec");
|
var delta = arg[1] * THROTTLE_RATE * getprop("/sim/time/delta-realtime-sec");
|
||||||
|
var (value, count) = (0, 0);
|
||||||
foreach(var e; engines) {
|
foreach(var e; engines) {
|
||||||
if(e.selected.getValue()) {
|
if(e.selected.getValue()) {
|
||||||
var node = e.controls.getNode(arg[0], 1);
|
var node = e.controls.getNode(arg[0], 1);
|
||||||
node.setValue(node.getValue() + delta);
|
node.setValue(node.getValue() + delta);
|
||||||
|
value += node.getValue(); # must read again because of clamping
|
||||||
|
count += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return value / count;
|
||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in a new issue