1
0
Fork 0

New Nasal code, with lots of input binding handlers in controls.nas.

Move the "tip popup" code from view.nas to a new gui.nas module, and
  make it generically useful.
Wire up flap steppings for the 747 as an example of per-aircraft
  flaps.
Realtime-based property slewing, to eliminate dependence of trim and
  view direction rates on frame rate.
This commit is contained in:
andy 2003-12-22 20:05:18 +00:00
parent d47f83ebc9
commit b2909de010
6 changed files with 354 additions and 356 deletions

172
Nasal/controls.nas Normal file
View file

@ -0,0 +1,172 @@
startEngine = func {
sel = props.globals.getNode("/sim/input/selected");
engs = props.globals.getNode("/controls/engines").getChildren("engine");
for(i=0; i<size(engs); i=i+1) {
select = sel.getChild("engine", i);
if(select != nil and select.getValue()) {
engs[i].getNode("starter").setBoolValue(1);
}
}
}
selectEngine = func {
sel = props.globals.getNode("/sim/input/selected").getChildren("engine");
foreach(node; sel) { node.setBoolValue(node.getIndex() == arg[0]); }
}
selectAllEngines = func {
sel = props.globals.getNode("/sim/input/selected").getChildren("engine");
foreach(node; sel) { node.setBoolValue(1); }
}
stepMagnetos = func {
change = arg[0];
engs = props.globals.getNode("/controls/engines").getChildren("engine");
sel = props.globals.getNode("/sim/input/selected");
for(i=0; i<size(engs); i=i+1) {
select = sel.getChild("engine", i);
if(select != nil and select.getValue()) {
mag = engs[i].getNode("magnetos", 1);
mag.setIntValue(mag.getValue() + change);
}
}
}
centerFlightControls = func {
setprop("/controls/flight/elevator", 0);
setprop("/controls/flight/aileron", 0);
setprop("/controls/flight/rudder", 0);
}
throttleMouse = func {
if(!getprop("/devices/status/mice/mouse[0]/button[1]")) { return; }
val = (cmdarg().getNode("offset").getValue() * -4
+ getprop("/controls/engines/engine/throttle"));
if(size(arg) > 0) { val = -val; }
props.setAll("/controls/engines/engine", "throttle", val);
}
# Joystick axis handlers (uses cmdarg). Shouldn't be called from
# other contexts.
throttleAxis = func {
val = cmdarg().getNode("setting").getValue();
if(size(arg) > 0) { val = -val; }
props.setAll("/controls/engines/engine", "throttle", (1 - val)/2);
}
mixtureAxis = func {
val = cmdarg().getNode("setting").getValue();
if(size(arg) > 0) { val = -val; }
props.setAll("/controls/engines/engine", "mixture", (1 - val)/2);
}
propellerAxis = func {
val = cmdarg().getNode("setting").getValue();
if(size(arg) > 0) { val = -val; }
props.setAll("/controls/engines/engine", "propeller-pitch", (1 - val)/2);
}
##
# Wrapper around stepProps() which emulates the "old" flap behavior for
# configurations that aren't using the new mechanism.
#
stepFlaps = func {
if(props.globals.getNode("/sim/flaps") != nil) {
stepProps("/controls/flight/flaps", "/sim/flaps", arg[0]);
return;
}
# Hard-coded flaps movement in 3 equal steps:
val = 0.3333334 * arg[0] + getprop("/controls/flight/flaps");
if(val > 1) { val = 1 } elsif(val < 0) { val = 0 }
setprop("/controls/flight/flaps", val);
}
##
# Steps through an "array" of property settings. The first argument
# specifies a destination property. The second is a string containing
# a global property tree. This tree should contain an array of
# indexed <setting> children. This function will maintain a
# <current-setting> child, which contains the index of the currently
# active setting. The third argument specifies an integer delta,
# indicating how many steps to move through the setting array.
# Note that because of the magic of the property system, this
# mechanism works for all scalar property types (bool, int, double,
# string).
#
# TODO: This interface could easily be extended to allow for wrapping,
# in addition to clamping, allowing a "cycle" of settings to be
# defined. It could also be hooked up with the interpolate() call,
# which would allow the removal of the transition-time feature from
# YASim. Finally, other pre-existing features (the views and engine
# magnetos, for instance), work similarly but not compatibly, and
# could be integrated.
#
stepProps = func {
dst = props.globals.getNode(arg[0]);
array = props.globals.getNode(arg[1]);
delta = arg[2];
if(dst == nil or array == nil) { return; }
sets = array.getChildren("setting");
curr = array.getNode("current-setting", 1).getValue();
if(curr == nil) { curr = 0; }
curr = curr + delta;
if (curr < 0) { curr = 0; }
elsif(curr >= size(sets)) { curr = size(sets) - 1; }
array.getNode("current-setting").setIntValue(curr);
dst.setValue(sets[curr].getValue());
}
##
# "Slews" a property smoothly, without dependence on the simulator
# frame rate. The first argument is the property name. The second is
# a rate, in units per second.
#
slewProp = func {
prop = arg[0];
delta = arg[1] * getprop("/sim/time/delta-realtime-sec");
setprop(prop, getprop(prop) + delta);
}
# Standard trim rate, in units per second. Remember that the full
# range of a trim axis is 2.0. Should probably read this out of a
# property...
TRIM_RATE = 0.045;
##
# Handlers. These are suitable for binding to repeatable button press
# events. They are *not* good for binding to the keyboard, since (at
# least) X11 synthesizes its own key repeats.
#
elevatorTrim = func {
slewProp("/controls/flight/elevator-trim", arg[0] * TRIM_RATE); }
aileronTrim = func {
slewProp("/controls/flight/aileron-trim", arg[0] * TRIM_RATE); }
rudderTrim = func {
slewProp("/controls/flight/rudder-trim", arg[0] * TRIM_RATE); }
THROTTLE_RATE = 0.33;
adjThrottle = func {
adjEngControl("throttle", arg[0]); }
adjMixture = func {
adjEngControl("mixture", arg[0]); }
adjPropeller = func {
adjEngControl("propeller-pitch", arg[0]); }
adjEngControl = func {
engs = props.globals.getNode("/controls/engines").getChildren("engine");
delta = arg[1] * THROTTLE_RATE * getprop("/sim/time/delta-reltime-sec");
foreach(e; engs) {
node = e.getNode(arg[0], 1);
node.setValue(node.getValue + delta);
}
}
##
# Joystick axis handlers. Don't call from other contexts.
#
elevatorTrimAxis = func { elevatorTrim(cmdarg().getNode("value").getValue()); }
aileronTrimAxis = func { aileronTrim(cmdarg().getNode("value").getValue()); }
rudderTrimAxis = func { rudderTrim(cmdarg().getNode("value").getValue()); }

69
Nasal/gui.nas Normal file
View file

@ -0,0 +1,69 @@
##
# Pop up a "tip" dialog for a moment, then remove it. The delay in
# seconds can be specified as the second argument. The default is 1
# second. Note that the tip dialog is a shared resource. If
# someone else comes along and wants to pop a tip up before your delay
# is finished, you lose. :)
#
popupTip = func {
msg = arg[0];
delay = if(size(arg) > 1) {arg[1]} else {DELAY};
labelNode.setValue(msg);
# The "width" value here is a hardcoded hack that assumes 9 pixels
# as a "typical" character width and adds some extra for the
# widgets to play with. Bah. Pui needs a layout engine...
width = 9 * size(msg) + 40;
popupNode.getNode("width").setIntValue(width);
popupNode.getNode("x").setIntValue((screenWProp.getValue() - width)/2);
popupNode.getNode("y").setIntValue(screenHProp.getValue() - 140);
popdown();
fgcommand("dialog-new", popupNode);
fgcommand("dialog-show", tipArg);
currTimer = currTimer + 1;
thisTimer = currTimer;
settimer(func { if(currTimer == thisTimer) { popdown() } }, DELAY);
}
########################################################################
# Private Stuff:
########################################################################
##
# Initialize property nodes via a timer, to insure the props module is
# loaded. See notes in view.nas
#
screenWProp = screenHProp = popupNode = labelNode = tipArg = nil;
INIT = func {
screenWProp = props.globals.getNode("/sim/startup/xsize");
screenHProp = props.globals.getNode("/sim/startup/ysize");
# Set up the dialog property node:
tmpl = { name : "PopTip", modal : 0,
x : 100, y : 100, width : 120, height : 40,
text : { x : 10, y : 6, label : "NOTE" } };
popupNode = props.Node.new(tmpl);
labelNode = popupNode.getNode("text/label");
fgcommand("dialog-new", popupNode);
# Cache the command argument for popup/popdown
tipArg = props.Node.new({ "dialog-name" : "PopTip" });
}
settimer(INIT, 0);
##
# How many seconds do we show the tip?
#
DELAY = 1.0;
##
# Pop down the tip dialog, if it is visible.
#
popdown = func { fgcommand("dialog-close", tipArg); }
# Marker for the "current" timer. This value gets stored in the
# closure of the timer function, and is used to check that there
# hasn't been a more recent timer set that should override.
currTimer = 0;

View file

@ -132,3 +132,20 @@ wrapNode = func { { parents : [Node], _g : arg[0] } }
#
props.globals = wrapNode(_globals());
##
# Sets all indexed property children to a single value. arg[0]
# specifies a property name (e.g. /controls/engines/engine), arg[1] a
# path under each node of that name to set (e.g. "throttle"), arg[2]
# is the value.
#
setAll = func {
node = props.globals.getNode(arg[0]);
if(node == nil) { return; }
name = node.getName();
node = node.getParent();
if(node == nil) { return; }
children = node.getChildren();
foreach(c; children) {
c.getNode(arg[1], 1).setValue(arg[2]);
}
}

View file

@ -20,24 +20,9 @@
# dependencies between modules.
#
fovProp = nil;
screenProp = nil;
popupNode = nil;
labelNode = nil;
fovDialog = nil;
INIT = func {
fovProp = props.globals.getNode("/sim/current-view/field-of-view");
screenProp = props.globals.getNode("/sim/startup/xsize");
# Set up the dialog property node:
tmpl = { name : "fov", modal : 0, width : 120, height : 40,
text : { x : 10, y : 6, label : "FOV:" } };
popupNode = props.Node.new(tmpl);
text = popupNode.getNode("text", 1);
labelNode = popupNode.getNode("text/label");
fgcommand("dialog-new", popupNode);
# Cache the command argument for popup/popdown
fovDialog = props.Node.new({ "dialog-name" : "fov" });
}
settimer(INIT, 0);
@ -53,10 +38,9 @@ settimer(INIT, 0);
STEPS = 40;
ACUITY = 1/60; # Maximum angle subtended by one pixel (== 1 arc minute)
max = min = mul = 0;
calcMul = func {
max = 120; # Fixed at 120 degrees
min = screenProp.getValue() * ACUITY;
min = getprop("/sim/startup/xsize") * ACUITY;
mul = math.exp(math.ln(max/min) / STEPS);
}
@ -79,7 +63,7 @@ increase = func {
if(val == max) { return; }
if(val > max) { val = max }
fovProp.setDoubleValue(val);
popup(val);
gui.popupTip("FOV: " ~ format(val));
}
##
@ -88,22 +72,58 @@ increase = func {
decrease = func {
calcMul();
val = fovProp.getValue() / mul;
if(val == min) { return; }
#if(val < min) { val = min } # Comment out for now.
msg = "FOV: " ~ format(val);
if(val < min) { msg = msg ~ " (overzoom)"; }
fovProp.setDoubleValue(val);
popup(val);
gui.popupTip(msg);
}
##
# Pop up the "fov" dialog for a moment.
# Handler. Reset view to default.
#
popdown = func { fgcommand("dialog-close", fovDialog); }
popup = func {
# Make sure it isn't already showing, initialize it, show it,
# and kill it automatically after a second
popdown();
labelNode.setValue("FOV: " ~ format(arg[0]));
fgcommand("dialog-show", fovDialog);
settimer(popdown, 1);
resetView = func {
setprop("/sim/current-view/goal-heading-offset-deg",
getprop("/sim/current-view/config/heading-offset-deg"));
setprop("/sim/current-view/goal-pitch-offset-deg",
getprop("/sim/current-view/config/pitch-offset-deg"));
setprop("/sim/current-view/field-of-view",
getprop("/sim/current-view/config/field-of-view-deg"))
}
##
# Handler. Step to the next view.
#
stepView = func {
curr = getprop("/sim/current-view/view-number");
views = props.globals.getNode("/sim").getChildren("view");
curr = curr + arg[0];
if (curr < 0) { curr = size(views) - 1; }
elsif(curr >= size(views)) { curr = 0; }
setprop("/sim/current-view/view-number", curr);
# And pop up a nice reminder
gui.popupTip(views[curr].getNode("name").getValue());
}
##
# Standard view "slew" rate, in degrees/sec.
#
VIEW_PAN_RATE = 60;
##
# Pans the view horizontally. The argument specifies a relative rate
# (or number of "steps" -- same thing) to the standard rate.
#
panViewDir = func {
controls.slewProp("/sim/current-view/goal-heading-offset-deg",
arg[0] * VIEW_PAN_RATE);
}
##
# Pans the view vertically. The argument specifies a relative rate
# (or number of "steps" -- same thing) to the standard rate.
#
panViewPitch = func {
controls.slewProp("/sim/current-view/goal-pitch-offset-deg",
arg[0] * VIEW_PAN_RATE);
}

View file

@ -159,90 +159,24 @@ calculated by adding 256 to the GLUT key value in glut.h.
<key n="32">
<name>SPACE</name>
<desc>Fire Starter on Selected Engine(s)</desc>
<binding>
<condition>
<property>/sim/input/selected/engine[0]</property>
</condition>
<command>property-assign</command>
<property>/controls/engines/engine[0]/starter</property>
<value type="bool">true</value>
<command>nasal</command>
<script>controls.startEngine()</script>
</binding>
<binding>
<condition>
<property>/sim/input/selected/engine[1]</property>
</condition>
<command>property-assign</command>
<property>/controls/engines/engine[1]/starter</property>
<value type="bool">true</value>
</binding>
<binding>
<condition>
<property>/sim/input/selected/engine[2]</property>
</condition>
<command>property-assign</command>
<property>/controls/engines/engine[2]/starter</property>
<value type="bool">true</value>
</binding>
<binding>
<condition>
<property>/sim/input/selected/engine[3]</property>
</condition>
<command>property-assign</command>
<property>/controls/engines/engine[3]/starter</property>
<value type="bool">true</value>
</binding>
<mod-up>
<binding>
<command>property-assign</command>
<property>/controls/engines/engine[0]/starter</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/engines/engine[1]/starter</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/engines/engine[2]/starter</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/engines/engine[3]/starter</property>
<value type="bool">false</value>
<command>nasal</command>
<script>props.setAll("/controls/engines/engine", "starter", 0)</script>
</binding>
</mod-up>
</key>
<key n="33">
<name>!</name>
<desc>Select first engine</desc>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[0]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[1]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[2]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[3]</property>
<value type="bool">false</value>
<command>nasal</command>
<script>controls.selectEngine(0)</script>
</binding>
</key>
@ -250,24 +184,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>#</name>
<desc>Select third engine</desc>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[0]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[1]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[2]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[3]</property>
<value type="bool">false</value>
<command>nasal</command>
<script>controls.selectEngine(2)</script>
</binding>
</key>
@ -275,24 +193,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>$</name>
<desc>Select fourth engine</desc>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[0]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[1]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[2]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[3]</property>
<value type="bool">true</value>
<command>nasal</command>
<script>controls.selectEngine(3)</script>
</binding>
</key>
@ -424,19 +326,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>5</name>
<desc>Center aileron, elevator, and rudder.</desc>
<binding>
<command>property-assign</command>
<property>/controls/flight/aileron</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/elevator</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/rudder</property>
<value type="double">0.0</value>
<command>nasal</command>
<script>controls.centerFlightControls()</script>
</binding>
</key>
@ -516,24 +407,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>@</name>
<desc>Select second engine</desc>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[0]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[1]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[2]</property>
<value type="bool">false</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[3]</property>
<value type="bool">false</value>
<command>nasal</command>
<script>controls.selectEngine(1)</script>
</binding>
</key>
@ -600,12 +475,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>V</name>
<desc>Scroll in reverse through views.</desc>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/view-number</property>
<step type="int">-1</step>
<min type="int">0</min>
<max type="int">5</max>
<wrap type="bool">true</wrap>
<command>nasal</command>
<script>view.stepView(-1)</script>
</binding>
</key>
@ -639,9 +510,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>[</name>
<desc>Decrease flaps.</desc>
<binding>
<command>property-adjust</command>
<property>/controls/flight/flaps</property>
<step type="double">-0.34</step>
<command>nasal</command>
<script>controls.stepFlaps(-1)</script>
</binding>
</key>
@ -649,9 +519,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>]</name>
<desc>Increase flaps.</desc>
<binding>
<command>property-adjust</command>
<property>/controls/flight/flaps</property>
<step type="double">0.34</step>
<command>nasal</command>
<script>controls.stepFlaps(1)</script>
</binding>
</key>
@ -670,36 +539,13 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>b</name>
<desc>Apply all brakes.</desc>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">1.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">1.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[2]/brake</property>
<value type="double">1.0</value>
<command>nasal</command>
<script>props.setAll("/controls/gear/wheel", "brake", 1)</script>
</binding>
<mod-up>
<desc>Release all brakes.</desc>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[0]/brake</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[1]/brake</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/gear/wheel[2]/brake</property>
<value type="double">0.0</value>
<command>nasal</command>
<script>props.setAll("/controls/gear/wheel", "brake", 0)</script>
</binding>
</mod-up>
</key>
@ -708,34 +554,15 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>c</name>
<desc>Toggle 3D/2D cockpit</desc>
<binding>
<condition>
<property>/sim/allow-toggle-cockpit</property>
</condition>
<command>property-assign</command>
<property>/sim/current-view/heading-offset-deg</property>
<value type="double">0</value>
</binding>
<binding>
<condition>
<property>/sim/allow-toggle-cockpit</property>
</condition>
<command>property-assign</command>
<property>/sim/current-view/pitch-offset-deg</property>
<value type="double">0</value>
</binding>
<binding>
<condition>
<property>/sim/allow-toggle-cockpit</property>
</condition>
<command>property-toggle</command>
<property>/sim/view/internal</property>
</binding>
<binding>
<condition>
<property>/sim/allow-toggle-cockpit</property>
</condition>
<command>property-toggle</command>
<property>/sim/virtual-cockpit</property>
<command>nasal</command>
<script>
if(getprop("/sim/allow-toggle-cockpit")) {
setprop("/sim/current-view/heading-offset-deg", 0);
setprop("/sim/current-view/pitch-offset-deg", 0);
setprop("/sim/view/internal", !getprop("/sim/view/internal"));
setprop("/sim/virtual-cockpit", !getprop("/sim/virtual-cockpit"));
}
</script>
</binding>
</key>
@ -853,14 +680,10 @@ calculated by adding 256 to the GLUT key value in glut.h.
<key n="118">
<name>v</name>
<desc>Cycle view</desc>
<desc>Scroll in reverse through views.</desc>
<desc>Scroll through views.</desc>
<binding>
<command>property-adjust</command>
<property>/sim/current-view/view-number</property>
<step type="int">1</step>
<min type="int">0</min>
<max type="int">6</max>
<wrap type="bool">true</wrap>
<command>nasal</command>
<script>view.stepView(1)</script>
</binding>
</key>
@ -885,40 +708,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>{</name>
<desc>Decrease Magneto on Selected Engine</desc>
<binding>
<desc>first engine</desc>
<condition>
<property>/sim/input/selected/engine[0]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[0]/magnetos</property>
<step type="int">-1</step>
</binding>
<binding>
<desc>second engine</desc>
<condition>
<property>/sim/input/selected/engine[1]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[1]/magnetos</property>
<step type="int">-1</step>
</binding>
<binding>
<desc>third engine</desc>
<condition>
<property>/sim/input/selected/engine[2]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[2]/magnetos</property>
<step type="int">-1</step>
</binding>
<binding>
<desc>fourth engine</desc>
<condition>
<property>/sim/input/selected/engine[3]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[3]/magnetos</property>
<step type="int">-1</step>
<command>nasal</command>
<script>controls.stepMagnetos(-1)</script>
</binding>
</key>
@ -926,40 +717,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>}</name>
<desc>Increase Magneto on Selected Engine</desc>
<binding>
<desc>first engine</desc>
<condition>
<property>/sim/input/selected/engine[0]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[0]/magnetos</property>
<step type="int">1</step>
</binding>
<binding>
<desc>second engine</desc>
<condition>
<property>/sim/input/selected/engine[1]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[1]/magnetos</property>
<step type="int">1</step>
</binding>
<binding>
<desc>third engine</desc>
<condition>
<property>/sim/input/selected/engine[2]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[2]/magnetos</property>
<step type="int">1</step>
</binding>
<binding>
<desc>fourth engine</desc>
<condition>
<property>/sim/input/selected/engine[3]</property>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine[3]/magnetos</property>
<step type="int">1</step>
<command>nasal</command>
<script>controls.stepMagnetos(1)</script>
</binding>
</key>
@ -967,24 +726,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>~</name>
<desc>Select all engines</desc>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[0]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[1]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[2]</property>
<value type="bool">true</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/input/selected/engine[3]</property>
<value type="bool">true</value>
<command>nasal</command>
<script>controls.selectAllEngines()</script>
</binding>
</key>
@ -1145,19 +888,8 @@ calculated by adding 256 to the GLUT key value in glut.h.
<name>Keypad 5</name>
<desc>Center aileron, elevator, and rudder.</desc>
<binding>
<command>property-assign</command>
<property>/controls/flight/aileron</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/elevator</property>
<value type="double">0.0</value>
</binding>
<binding>
<command>property-assign</command>
<property>/controls/flight/rudder</property>
<value type="double">0.0</value>
<command>nasal</command>
<script>controls.centerFlightControls()</script>
</binding>
</key>

View file

@ -157,20 +157,8 @@ The current mode for each mouse is held in the
<!-- Middle button pressed: control throttle -->
<binding>
<condition>
<and>
<not>
<property>/devices/status/mice/mouse[0]/button[0]</property>
</not>
<property>/devices/status/mice/mouse[0]/button[1]</property>
</and>
</condition>
<command>property-adjust</command>
<property>/controls/engines/engine/throttle</property>
<factor type="double">-4.0</factor>
<min type="double">0.0</min>
<max type="double">1.0</max>
<wrap type="bool">false</wrap>
<command>nasal</command>
<script>controls.throttleMouse()</script>
</binding>
</y-axis>