add mod-up action to magneto keys, and ignore that in the controls wrapper;
This allows to implement car-like combined magneto/starter switches.
This commit is contained in:
parent
b5243cd3f5
commit
217cbcae34
3 changed files with 27 additions and 10 deletions
|
@ -626,9 +626,11 @@ var livery = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# formation
|
# formation
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# A modification of the Livery Class. This Class maintains formation
|
# A modification of the livery class. This class maintains formation
|
||||||
# XML files (see Blackburn Buccaneer for an example). Files are regular
|
# XML files (see Blackburn Buccaneer for an example). Files are regular
|
||||||
# PropertyList XML files whose properties are copied to the
|
# PropertyList XML files whose properties are copied to the
|
||||||
# main tree (whereby the node types are ignored).
|
# main tree (whereby the node types are ignored).
|
||||||
|
@ -637,21 +639,20 @@ var livery = {
|
||||||
# formation.init(<formation-dir> [, <name-path> [, <sort-path>]]);
|
# formation.init(<formation-dir> [, <name-path> [, <sort-path>]]);
|
||||||
#
|
#
|
||||||
# <formation-dir> ... directory with livery XML files, relative to $FG_ROOT
|
# <formation-dir> ... directory with livery XML files, relative to $FG_ROOT
|
||||||
# <name-path> ... property path to the livery name in the livery files
|
# <name-path> ... property path to the livery name in the livery files
|
||||||
# and the property tree (default: /sim/model/formation/name)
|
# and the property tree (default: /sim/model/formation/name)
|
||||||
# <sort-path> ... property path to the sort criterion (default: same as
|
# <sort-path> ... property path to the sort criterion (default: same as
|
||||||
# <name-path> -- that is: alphabetic sorting)
|
# <name-path> -- that is: alphabetic sorting)
|
||||||
#
|
#
|
||||||
# EXAMPLE:
|
# EXAMPLE:
|
||||||
# aircraft.formation.init("Aircraft/Buccaneer/Formations",
|
# aircraft.formation.init("Aircraft/Buccaneer/Formations",
|
||||||
# "sim/model/formation/variant",
|
# "sim/model/formation/variant",
|
||||||
# "sim/model/formation/index"); # optional
|
# "sim/model/formation/index"); # optional
|
||||||
#
|
#
|
||||||
# aircraft.formation.dialog.toggle();
|
# aircraft.formation.dialog.toggle();
|
||||||
# aircraft.formation.select("take off");
|
# aircraft.formation.select("take off");
|
||||||
# aircraft.formation.next();
|
# aircraft.formation.next();
|
||||||
#
|
#
|
||||||
|
|
||||||
var formation = {
|
var formation = {
|
||||||
init : func(formation_dir, name_path = "sim/model/formation/name", sort_path = nil) {
|
init : func(formation_dir, name_path = "sim/model/formation/name", sort_path = nil) {
|
||||||
me.dir = formation_dir;
|
me.dir = formation_dir;
|
||||||
|
@ -707,6 +708,8 @@ var formation = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# steering
|
# steering
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Class that implements differential braking depending on rudder position.
|
# Class that implements differential braking depending on rudder position.
|
||||||
|
|
|
@ -28,6 +28,8 @@ var selectAllEngines = func {
|
||||||
}
|
}
|
||||||
|
|
||||||
var stepMagnetos = func(change) {
|
var stepMagnetos = func(change) {
|
||||||
|
if (!change)
|
||||||
|
return;
|
||||||
foreach(var e; engines) {
|
foreach(var e; engines) {
|
||||||
if(e.selected.getValue()) {
|
if(e.selected.getValue()) {
|
||||||
var mag = e.controls.getNode("magnetos", 1);
|
var mag = e.controls.getNode("magnetos", 1);
|
||||||
|
@ -54,8 +56,8 @@ var throttleMouse = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Joystick axis handlers (uses cmdarg). Shouldn't be called from
|
# Joystick axis handlers (use cmdarg). Shouldn't be called from
|
||||||
# other contexts. A non-null argument inverts the direction of the axis.
|
# other contexts. A non-null argument reverses the axis direction.
|
||||||
var axisHandler = func(pre, post) {
|
var axisHandler = func(pre, post) {
|
||||||
func(invert = 0) {
|
func(invert = 0) {
|
||||||
var val = cmdarg().getNode("setting").getValue();
|
var val = cmdarg().getNode("setting").getValue();
|
||||||
|
|
12
keyboard.xml
12
keyboard.xml
|
@ -1044,6 +1044,12 @@ top down before the key bindings are parsed.
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>controls.stepMagnetos(-1)</script>
|
<script>controls.stepMagnetos(-1)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controls.stepMagnetos(0)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
<key n="125">
|
<key n="125">
|
||||||
|
@ -1053,6 +1059,12 @@ top down before the key bindings are parsed.
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>controls.stepMagnetos(1)</script>
|
<script>controls.stepMagnetos(1)</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>controls.stepMagnetos(0)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
<key n="126">
|
<key n="126">
|
||||||
|
|
Loading…
Add table
Reference in a new issue