Sim: add support for spoiler joystick binding
This commit is contained in:
parent
21062e9ba2
commit
17a12bad59
4 changed files with 56 additions and 33 deletions
|
@ -314,28 +314,28 @@
|
|||
<!-- Multiplayer properties -->
|
||||
<multiplay>
|
||||
<generic>
|
||||
<float n="0" alias="/controls/lighting/dome-norm" />
|
||||
<float n="1" alias="/gear/gear[0]/steering-norm" />
|
||||
<float n="2" alias="/engines/engine[0]/reverser-pos-norm" />
|
||||
<float n="3" alias="/engines/engine[1]/reverser-pos-norm" />
|
||||
<float n="4" alias="/fdm/jsbsim/hydraulics/elevator-l/final-deg" />
|
||||
<float n="5" alias="/fdm/jsbsim/hydraulics/elevator-r/final-deg" />
|
||||
<float n="6" alias="/fdm/jsbsim/hydraulics/aileron-l/final-deg" />
|
||||
<float n="7" alias="/fdm/jsbsim/hydraulics/aileron-r/final-deg" />
|
||||
<float n="8" alias="/fdm/jsbsim/hydraulics/rudder/final-deg" />
|
||||
<float n="9" alias="/fdm/jsbsim/hydraulics/elevator-trim/final-deg" />
|
||||
<float n="11" alias="/fdm/jsbsim/fcs/slat-pos-norm" />
|
||||
<int n="2" alias="/controls/lighting/landing-lights[0]" />
|
||||
<int n="3" alias="/controls/lighting/landing-lights[1]" />
|
||||
<int n="4" alias="/controls/lighting/landing-lights[2]" />
|
||||
<int n="5" alias="/sim/model/lights/nav-lights" />
|
||||
<int n="6" alias="/sim/model/lights/logo-lights" />
|
||||
<int n="7" alias="/sim/model/lights/strobe/state" />
|
||||
<int n="8" alias="/controls/lighting/wing-lights" />
|
||||
<int n="9" alias="/sim/model/lights/beacon/state" />
|
||||
<int n="10" alias="/engines/engine[0]/contrail" />
|
||||
<int n="11" alias="/engines/engine[1]/contrail" />
|
||||
<int n="12" alias="/sharklet" />
|
||||
<float n="0" alias="/controls/lighting/dome-norm"/>
|
||||
<float n="1" alias="/gear/gear[0]/steering-norm"/>
|
||||
<float n="2" alias="/engines/engine[0]/reverser-pos-norm"/>
|
||||
<float n="3" alias="/engines/engine[1]/reverser-pos-norm"/>
|
||||
<float n="4" alias="/fdm/jsbsim/hydraulics/elevator-l/final-deg"/>
|
||||
<float n="5" alias="/fdm/jsbsim/hydraulics/elevator-r/final-deg"/>
|
||||
<float n="6" alias="/fdm/jsbsim/hydraulics/aileron-l/final-deg"/>
|
||||
<float n="7" alias="/fdm/jsbsim/hydraulics/aileron-r/final-deg"/>
|
||||
<float n="8" alias="/fdm/jsbsim/hydraulics/rudder/final-deg"/>
|
||||
<float n="9" alias="/fdm/jsbsim/hydraulics/elevator-trim/final-deg"/>
|
||||
<float n="11" alias="/fdm/jsbsim/fcs/slat-pos-norm"/>
|
||||
<int n="2" alias="/controls/lighting/landing-lights[0]"/>
|
||||
<int n="3" alias="/controls/lighting/landing-lights[1]"/>
|
||||
<int n="4" alias="/controls/lighting/landing-lights[2]"/>
|
||||
<int n="5" alias="/sim/model/lights/nav-lights"/>
|
||||
<int n="6" alias="/sim/model/lights/logo-lights"/>
|
||||
<int n="7" alias="/sim/model/lights/strobe/state"/>
|
||||
<int n="8" alias="/controls/lighting/wing-lights"/>
|
||||
<int n="9" alias="/sim/model/lights/beacon/state"/>
|
||||
<int n="10" alias="/engines/engine[0]/contrail"/>
|
||||
<int n="11" alias="/engines/engine[1]/contrail"/>
|
||||
<int n="12" alias="/sharklet"/>
|
||||
</generic>
|
||||
</multiplay>
|
||||
|
||||
|
@ -379,25 +379,25 @@
|
|||
<payload>
|
||||
<weight n="0">
|
||||
<name>Cockpit Crew</name>
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[0]" />
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[0]"/>
|
||||
<min-lb type="double">200</min-lb>
|
||||
<max-lb type="double">440</max-lb>
|
||||
</weight>
|
||||
<weight n="1">
|
||||
<name>Passengers</name>
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[1]" />
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[1]"/>
|
||||
<min-lb type="double">1500</min-lb>
|
||||
<max-lb type="double">27000</max-lb>
|
||||
</weight>
|
||||
<weight n="2">
|
||||
<name>Forward Cargo</name>
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[2]" />
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[2]"/>
|
||||
<min-lb type="double">300</min-lb>
|
||||
<max-lb type="double">8765</max-lb>
|
||||
</weight>
|
||||
<weight n="3">
|
||||
<name>Aft Cargo</name>
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[3]" />
|
||||
<weight-lb alias="/fdm/jsbsim/inertia/pointmass-weight-lbs[3]"/>
|
||||
<min-lb type="double">300</min-lb>
|
||||
<max-lb type="double">8765</max-lb>
|
||||
</weight>
|
||||
|
@ -540,7 +540,6 @@
|
|||
<elevator-input>0</elevator-input>
|
||||
<elevator-trim-fdm>0.0</elevator-trim-fdm>
|
||||
<flap-pos type="int">0</flap-pos>
|
||||
<ground-spoilers-armed type="bool">0</ground-spoilers-armed>
|
||||
<rudder-trim-fdm>0.0</rudder-trim-fdm>
|
||||
<speedbrake-arm>0</speedbrake-arm>
|
||||
<slats>0</slats>
|
||||
|
@ -1370,7 +1369,7 @@
|
|||
</and>
|
||||
</condition>
|
||||
<command>property-cycle</command>
|
||||
<property>controls/flight/speedbrake</property>
|
||||
<property>/controls/flight/speedbrake</property>
|
||||
<value>0.0</value>
|
||||
<value>1.0</value>
|
||||
</binding>
|
||||
|
@ -1392,14 +1391,14 @@
|
|||
</and>
|
||||
</condition>
|
||||
<command>property-cycle</command>
|
||||
<property>controls/flight/speedbrake</property>
|
||||
<property>/controls/flight/speedbrake</property>
|
||||
<value>0.0</value>
|
||||
<value>0.5</value>
|
||||
<value>1.0</value>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>property-assign</command>
|
||||
<property>controls/flight/speedbrake-arm</property>
|
||||
<property>/controls/flight/speedbrake-arm</property>
|
||||
<value>0</value>
|
||||
</binding>
|
||||
</key>
|
||||
|
|
|
@ -4935,9 +4935,8 @@
|
|||
<animation>
|
||||
<type>rotate</type>
|
||||
<object-name>SpdBrk</object-name>
|
||||
<property>controls/flight/speedbrake</property>
|
||||
<property>fdm/jsbsim/spoilers/speedbrake-nul</property>
|
||||
<factor>45</factor>
|
||||
<!--offset-deg>10</offset-deg-->
|
||||
<axis>
|
||||
<object-name>SpdBrk.axis</object-name>
|
||||
</axis>
|
||||
|
|
|
@ -399,6 +399,31 @@ var flaptimer = maketimer(0.5, func {
|
|||
}
|
||||
});
|
||||
|
||||
controls.stepSpoilers = func(step) {
|
||||
setprop("/controls/flight/speedbrake-arm", 0);
|
||||
if (step == 1) {
|
||||
deploySpeedbrake();
|
||||
} else if (step == -1) {
|
||||
retractSpeedbrake();
|
||||
}
|
||||
}
|
||||
|
||||
var deploySpeedbrake = func {
|
||||
if (getprop("/controls/flight/speedbrake") < 0.5) {
|
||||
setprop("/controls/flight/speedbrake", 0.5);
|
||||
} else if (getprop("/controls/flight/speedbrake") < 1.0) {
|
||||
setprop("/controls/flight/speedbrake", 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
var retractSpeedbrake = func {
|
||||
if (getprop("/controls/flight/speedbrake") > 0.5) {
|
||||
setprop("/controls/flight/speedbrake", 0.5);
|
||||
} else if (getprop("/controls/flight/speedbrake") > 0.0) {
|
||||
setprop("/controls/flight/speedbrake", 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
var slewProp = func(prop, delta) {
|
||||
delta *= getprop("/sim/time/delta-realtime-sec");
|
||||
setprop(prop, getprop(prop) + delta);
|
||||
|
|
|
@ -1 +1 @@
|
|||
4604
|
||||
4605
|
Reference in a new issue