ajout conf perso pour flight...
|
1 |
<?xml version="1.0"?> |
2 | ||
3 |
<!-- |
|
4 |
************************************************************************ |
|
5 |
* Bindings for Microsoft SideWinder Joystick. |
|
6 |
* |
|
7 |
* |
|
8 |
* Axis 0: ailerons in air, rudder on ground if not heli |
|
9 |
* Axis 1: elevator |
|
10 |
* Axis 2: throttle |
|
11 |
* |
|
12 |
* Button 1: all brakes on ground, heli view in air |
|
13 |
* Button 2: Push To Talk with FGCOM |
|
14 |
* Button 3: left aileron trim for aircrafts, left pedal for helis |
|
15 |
* Button 4: right aileron trim for aircrafts, right pedal for helis |
|
16 |
* Button 5: elevator trim up |
|
17 |
* Button 6: elevator trim down |
|
18 |
* Button 7: flaps up |
|
19 |
* Button 8: flaps down |
|
20 | ||
21 |
************************************************************************ |
|
22 |
$Id: sidewinder.xml,v 1.5 2005/06/22 13:08:02 mfranz Exp $ |
|
23 |
modified by zakharov |
|
24 |
--> |
|
25 | ||
26 |
<PropertyList> |
|
27 |
<nasal> |
|
28 |
<script><![CDATA[ |
|
controles de vol par la sour...
|
29 |
var skipFlightControls = props.globals.getNode("/sim/mouse/skip-flight-controls-mode"); |
30 |
setlistener("/sim/signals/fdm-initilized", func { |
|
31 |
skipFlightControls.setBoolValue(1); |
|
32 |
print("JOYSTICK set mouse flight control OFF: ", skipFlightControls.getValue()); |
|
33 |
}, 1 ); |
|
34 |
setlistener("/sim/signals/save", func { |
|
35 |
skipFlightControls.setBoolValue(0); |
|
36 |
print("JOYSTICK save mouse flight control ON: ", skipFlightControls.getValue()); |
|
37 |
} ); |
|
38 | ||
ajout conf perso pour flight...
|
39 |
var shift = props.globals.getNode("/devices/status/keyboard/shift"); |
40 |
var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl"); |
|
41 |
var alt = props.globals.getNode("/devices/status/keyboard/alt"); |
|
mode déplacement de vue auto
|
42 |
var previousMouseMode = 0; |
ajout conf perso pour flight...
|
43 | |
44 |
var get_modifiers = func { |
|
45 |
shift.getValue() + 2 * ctrl.getValue() + 4 * alt.getValue(); |
|
46 |
} |
|
47 | ||
48 |
var space_release = func {} |
|
49 |
var space = func(state, mod) { |
|
50 |
if (!state) { |
|
51 |
space_release(); |
|
52 |
return space_release = func {}; |
|
53 |
} |
|
54 |
if (mod == 0 or mod == 1) { |
|
55 |
controls.ptt(mod + 1); |
|
56 |
space_release = func { controls.ptt(0) } |
|
57 |
} |
|
58 |
} |
|
59 | ||
60 |
var button0 = func {} |
|
61 |
var gunned = props.globals.getNode("/controls/armament/trigger"); |
|
62 |
if (gunned != nil) |
|
63 |
button0 = func (v) { |
|
64 |
setprop("/ai/submodels/trigger", v); |
|
65 |
setprop("/controls/armament/trigger", v); |
|
cosmetics
|
66 |
} |
ajout conf perso pour flight...
|
67 |
else |
mode déplacement de vue auto
|
68 |
button0 = func (v) { |
69 |
if (v) { |
|
70 |
previousMouseMode = getprop("/devices/status/mice/mouse[0]/mode"); |
|
71 |
setprop("/devices/status/mice/mouse[0]/mode", 2); |
|
72 |
} |
|
73 |
else setprop("/devices/status/mice/mouse[0]/mode", previousMouseMode); |
|
74 |
setprop("/sim/current-view/view-number", v); |
|
75 |
} |
|
ajout conf perso pour flight...
|
76 |
]]></script> |
77 |
</nasal> |
|
78 | ||
79 |
<name>Microsoft SideWinder Joystick</name> |
|
80 | ||
81 |
<axis n="0"> |
|
82 |
<desc>Rudder if not heli (auto-coordination), on ground and in air</desc> |
|
83 |
<binding> |
|
84 |
<condition> |
|
85 |
<not> |
|
fix gestion gouverne de dire...
|
86 |
<property>/rotors/rotor/brake</property> |
ajout conf perso pour flight...
|
87 |
</not> |
88 |
</condition> |
|
89 |
<command>property-scale</command> |
|
90 |
<property>/controls/flight/rudder</property> |
|
91 |
<squared type="bool">true</squared> |
|
92 |
</binding> |
|
93 |
<desc>Aileron, only in air</desc> |
|
94 |
<binding> |
|
95 |
<condition> |
|
96 |
<not> |
|
97 |
<and> |
|
98 |
<property>/gear/gear[1]/wow</property> |
|
99 |
<property>/gear/gear[2]/wow</property> |
|
100 |
</and> |
|
101 |
</not> |
|
102 |
</condition> |
|
103 |
<command>property-scale</command> |
|
104 |
<property>/controls/flight/aileron</property> |
|
105 |
<squared type="bool">true</squared> |
|
106 |
</binding> |
|
107 |
</axis> |
|
108 | ||
109 |
<axis n="1"> |
|
110 |
<desc>Elevator</desc> |
|
111 |
<binding> |
|
112 |
<command>property-scale</command> |
|
113 |
<property>/controls/flight/elevator</property> |
|
114 |
<factor type="double">-1.0</factor> |
|
115 |
<squared type="bool">true</squared> |
|
116 |
</binding> |
|
117 |
</axis> |
|
118 | ||
119 |
<axis n="2"> |
|
120 |
<desc>Throttle</desc> |
|
121 |
<binding> |
|
122 |
<command>nasal</command> |
|
123 |
<script>controls.throttleAxis()</script> |
|
124 |
</binding> |
|
125 |
</axis> |
|
126 | ||
127 |
<button n="0"> |
|
improve breaks
|
128 |
<desc>Brakes near ground, change view or fire gun if exists on air</desc> |
ajout conf perso pour flight...
|
129 |
<binding> |
130 |
<condition> |
|
improve breaks
|
131 |
<less-than> |
132 |
<property>/position/gear-agl-m</property> |
|
133 |
<value>3</value> |
|
134 |
</less-than> |
|
ajout conf perso pour flight...
|
135 |
</condition> |
136 |
<command>nasal</command> |
|
137 |
<script>controls.applyBrakes(1)</script> |
|
138 |
</binding> |
|
139 |
<binding> |
|
140 |
<condition> |
|
improve breaks
|
141 |
<greater-than> |
142 |
<property>/position/gear-agl-m</property> |
|
143 |
<value>3</value> |
|
144 |
</greater-than> |
|
ajout conf perso pour flight...
|
145 |
</condition> |
146 |
<command>nasal</command> |
|
147 |
<script>button0(1)</script> |
|
148 |
</binding> |
|
149 |
<mod-up> |
|
150 |
<binding> |
|
151 |
<condition> |
|
improve breaks
|
152 |
<less-than> |
153 |
<property>/position/gear-agl-m</property> |
|
154 |
<value>3</value> |
|
155 |
</less-than> |
|
ajout conf perso pour flight...
|
156 |
</condition> |
157 |
<command>nasal</command> |
|
improve breaks
|
158 |
<script>controls.applyBrakes(0)</script> |
ajout conf perso pour flight...
|
159 |
</binding> |
160 |
<binding> |
|
161 |
<condition> |
|
improve breaks
|
162 |
<greater-than> |
163 |
<property>/position/gear-agl-m</property> |
|
164 |
<value>3</value> |
|
165 |
</greater-than> |
|
ajout conf perso pour flight...
|
166 |
</condition> |
167 |
<command>nasal</command> |
|
improve breaks
|
168 |
<script>button0(0)</script> |
ajout conf perso pour flight...
|
169 |
</binding> |
170 |
</mod-up> |
|
171 |
</button> |
|
172 | ||
173 |
<button n="1"> |
|
174 |
<desc>PTT - Push To Talk (via VoIP)</desc> |
|
175 |
<binding> |
|
176 |
<command>nasal</command> |
|
177 |
<script> |
|
178 |
var m = get_modifiers(); |
|
179 |
if (m == 4) aircraft.autotrim.start(); |
|
180 |
else space(1, m); |
|
181 |
</script> |
|
182 |
</binding> |
|
183 |
<mod-up> |
|
184 |
<binding> |
|
185 |
<command>nasal</command> |
|
186 |
<script> |
|
187 |
var m = get_modifiers(); |
|
188 |
if (m == 4) aircraft.autotrim.stop(); |
|
189 |
else space(0, m); |
|
190 |
</script> |
|
191 |
</binding> |
|
192 |
</mod-up> |
|
193 |
</button> |
|
194 | ||
195 |
<button n="4"> |
|
196 |
<desc>Elevator trim down</desc> |
|
197 |
<repeatable type="bool">true</repeatable> |
|
198 |
<binding> |
|
199 |
<command>property-adjust</command> |
|
200 |
<property>/controls/flight/elevator-trim</property> |
|
201 |
<step type="double">-0.002</step> |
|
202 |
</binding> |
|
203 |
</button> |
|
204 | ||
205 |
<button n="5"> |
|
206 |
<desc>Elevator trim up</desc> |
|
207 |
<repeatable type="bool">true</repeatable> |
|
208 |
<binding> |
|
209 |
<command>property-adjust</command> |
|
210 |
<property>/controls/flight/elevator-trim</property> |
|
211 |
<step type="double">0.002</step> |
|
212 |
</binding> |
|
213 |
</button> |
|
214 | ||
215 |
<button n="6"> |
|
216 |
<desc>Flaps up</desc> |
|
217 |
<repeatable>false</repeatable> |
|
218 |
<binding> |
|
219 |
<command>nasal</command> |
|
220 |
<script>controls.flapsDown(-1)</script> |
|
221 |
</binding> |
|
222 |
<mod-up> |
|
223 |
<binding> |
|
224 |
<command>nasal</command> |
|
225 |
<script>controls.flapsDown(0)</script> |
|
226 |
</binding> |
|
227 |
</mod-up> |
|
228 |
</button> |
|
229 | ||
230 |
<button n="7"> |
|
231 |
<desc>Flaps down</desc> |
|
232 |
<repeatable>false</repeatable> |
|
233 |
<binding> |
|
234 |
<command>nasal</command> |
|
235 |
<script>controls.flapsDown(1)</script> |
|
236 |
</binding> |
|
237 |
<mod-up> |
|
238 |
<binding> |
|
239 |
<command>nasal</command> |
|
240 |
<script>controls.flapsDown(0)</script> |
|
241 |
</binding> |
|
242 |
</mod-up> |
|
243 |
</button> |
|
244 | ||
245 | ||
246 |
<button n="2"> |
|
247 |
<desc>Aileron trim left</desc> |
|
248 |
<repeatable>true</repeatable> |
|
249 |
<binding> |
|
250 |
<command>nasal</command> |
|
251 |
<script>controls.applyBrakes(1, -1)</script> |
|
252 |
</binding> |
|
253 |
<mod-up> |
|
254 |
<binding> |
|
255 |
<command>nasal</command> |
|
256 |
<script>controls.applyBrakes(0, -1)</script> |
|
257 |
</binding> |
|
258 |
</mod-up> |
|
259 |
<binding> |
|
260 |
<condition> |
|
261 |
<not> |
|
262 |
<property>/rotors/tail/rpm</property> |
|
263 |
</not> |
|
264 |
</condition> |
|
265 |
<command>property-adjust</command> |
|
266 |
<property>/controls/flight/aileron-trim</property> |
|
267 |
<step type="double">-0.001</step> |
|
268 |
</binding> |
|
269 |
<desc>Rudder for helis</desc> |
|
270 |
<binding> |
|
271 |
<condition> |
|
272 |
<property>/rotors/tail/rpm</property> |
|
273 |
</condition> |
|
274 |
<command>property-adjust</command> |
|
275 |
<property>/controls/flight/rudder</property> |
|
276 |
<step type="double">-0.01</step> |
|
277 |
</binding> |
|
278 |
</button> |
|
279 | ||
280 |
<button n="3"> |
|
281 |
<desc>Aileron trim right</desc> |
|
282 |
<repeatable>true</repeatable> |
|
283 |
<binding> |
|
284 |
<command>nasal</command> |
|
285 |
<script>controls.applyBrakes(1, 1)</script> |
|
286 |
</binding> |
|
287 |
<mod-up> |
|
288 |
<binding> |
|
289 |
<command>nasal</command> |
|
290 |
<script>controls.applyBrakes(0, 1)</script> |
|
291 |
</binding> |
|
292 |
</mod-up> |
|
293 |
<binding> |
|
294 |
<condition> |
|
295 |
<not> |
|
296 |
<property>/rotors/tail/rpm</property> |
|
297 |
</not> |
|
298 |
</condition> |
|
299 |
<command>property-adjust</command> |
|
300 |
<property>/controls/flight/aileron-trim</property> |
|
301 |
<step type="double">0.001</step> |
|
302 |
</binding> |
|
303 |
<desc>Rudder for helis</desc> |
|
304 |
<binding> |
|
305 |
<condition> |
|
306 |
<property>/rotors/tail/rpm</property> |
|
307 |
</condition> |
|
308 |
<command>property-adjust</command> |
|
309 |
<property>/controls/flight/rudder</property> |
|
310 |
<step type="double">0.01</step> |
|
311 |
</binding> |
|
312 |
</button> |
|
313 | ||
314 |
</PropertyList> |