1
0
Fork 0

Add thrust reverser to joystick bindings.

This can either be a button (which toggles) or an axis (variable)
This commit is contained in:
Richard Harrison 2019-05-01 13:43:16 +02:00
parent adb6553cc0
commit 2a748fdc70
4 changed files with 37 additions and 0 deletions

View file

@ -93,6 +93,16 @@ _setlistener("/controls/engines/mixture-all", func{
_setlistener("/controls/engines/propeller-pitch-all", func{
setForAllEnginesProperty("propeller-pitch");
},0,0);
_setlistener("/controls/engines/reverser-all", func{
setForAllEnginesProperty("reverser");
},0,0);
var reverserTogglePosition = func {
if (getprop("/controls/engines/reverser-all"))
setprop("/controls/engines/reverser-all", 0);
else
setprop("/controls/engines/reverser-all", 1);
}
# Joystick axis handlers (use cmdarg). Shouldn't be called from
# other contexts. A non-null argument reverses the axis direction.

View file

@ -285,6 +285,7 @@ var axisBindings = [
PropertyScaleAxis.new("Throttle Engine 1", "/controls/engines/engine[1]/throttle") ,
PropertyScaleAxis.new("Mixture Engine 1", "/controls/engines/engine[1]/mixture") ,
PropertyScaleAxis.new("Propeller Pitch Engine 1", "/controls/engines/engine[1]/propeller-pitch"),
PropertyScaleAxis.new("Reverser All Engines", "/controls/engines/reverser-all") ,
NasalLowHighAxis.new("View (horizontal)",
"setprop(\"/sim/current-view/goal-heading-offset-deg\", getprop(\"/sim/current-view/goal-heading-offset-deg\") + 2);",
@ -549,6 +550,7 @@ var buttonBindings = [
NasalButton.new("Gear Up", "controls.gearDown(-1);",0),
NasalButton.new("Gear Down", "controls.gearDown(1);",0),
NasalButton.new("Gear Toggle", "controls.gearTogglePosition(1);",0),
NasalButton.new("Reverser Toggle", "controls.reverserTogglePosition();",0),
NasalHoldButton.new("Spoilers Retract", "controls.stepSpoilers(-1);", "controls.stepSpoilers(0);"),
NasalHoldButton.new("Spoilers Deploy", "controls.stepSpoilers(1);", "controls.stepSpoilers(0);"),
NasalHoldButton.new("Brakes", "controls.applyBrakes(1);", "controls.applyBrakes(0);"),

View file

@ -365,6 +365,19 @@ var assignAxis = func(cmd) {
</binding>
</button>
<button>
<row>10</row>
<col>1</col>
<halign>fill</halign>
<legend>Reverser All Engines</legend>
<binding>
<command>nasal</command>
<script>
assignAxis("Reverser All Engines");
</script>
</binding>
</button>
<text>
<row>0</row>
<col>2</col>

View file

@ -350,6 +350,18 @@ var assignButton = func(cmd) {
</script>
</binding>
</button>
<button>
<row>6</row>
<col>2</col>
<halign>fill</halign>
<legend>All Reverser Toggle</legend>
<binding>
<command>nasal</command>
<script>
assignButton("Reverser Toggle");
</script>
</binding>
</button>
<text>
<row>0</row>