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"> |
|
128 |
<desc>Brakes on ground, change view or fire gun if exists on air</desc> |
|
129 |
<binding> |
|
130 |
<condition> |
|
131 |
<and> |
|
132 |
<property>/gear/gear[1]/wow</property> |
|
133 |
<property>/gear/gear[2]/wow</property> |
|
134 |
</and> |
|
135 |
</condition> |
|
136 |
<command>nasal</command> |
|
137 |
<script>controls.applyBrakes(1)</script> |
|
138 |
</binding> |
|
139 |
<binding> |
|
140 |
<condition> |
|
141 |
<not> |
|
142 |
<and> |
|
143 |
<property>/gear/gear[1]/wow</property> |
|
144 |
<property>/gear/gear[2]/wow</property> |
|
145 |
</and> |
|
146 |
</not> |
|
147 |
</condition> |
|
148 |
<command>nasal</command> |
|
149 |
<script>button0(1)</script> |
|
150 |
</binding> |
|
151 |
<mod-up> |
|
152 |
<binding> |
|
153 |
<condition> |
|
154 |
<not> |
|
155 |
<and> |
|
156 |
<property>/gear/gear[1]/wow</property> |
|
157 |
<property>/gear/gear[2]/wow</property> |
|
158 |
</and> |
|
159 |
</not> |
|
160 |
</condition> |
|
161 |
<command>nasal</command> |
|
162 |
<script>button0(0)</script> |
|
163 |
</binding> |
|
164 |
<binding> |
|
165 |
<condition> |
|
166 |
<and> |
|
167 |
<property>/gear/gear[1]/wow</property> |
|
168 |
<property>/gear/gear[2]/wow</property> |
|
169 |
</and> |
|
170 |
</condition> |
|
171 |
<command>nasal</command> |
|
172 |
<script>controls.applyBrakes(0)</script> |
|
173 |
</binding> |
|
174 |
</mod-up> |
|
175 |
</button> |
|
176 | ||
177 |
<button n="1"> |
|
178 |
<desc>PTT - Push To Talk (via VoIP)</desc> |
|
179 |
<binding> |
|
180 |
<command>nasal</command> |
|
181 |
<script> |
|
182 |
var m = get_modifiers(); |
|
183 |
if (m == 4) aircraft.autotrim.start(); |
|
184 |
else space(1, m); |
|
185 |
</script> |
|
186 |
</binding> |
|
187 |
<mod-up> |
|
188 |
<binding> |
|
189 |
<command>nasal</command> |
|
190 |
<script> |
|
191 |
var m = get_modifiers(); |
|
192 |
if (m == 4) aircraft.autotrim.stop(); |
|
193 |
else space(0, m); |
|
194 |
</script> |
|
195 |
</binding> |
|
196 |
</mod-up> |
|
197 |
</button> |
|
198 | ||
199 |
<button n="4"> |
|
200 |
<desc>Elevator trim down</desc> |
|
201 |
<repeatable type="bool">true</repeatable> |
|
202 |
<binding> |
|
203 |
<command>property-adjust</command> |
|
204 |
<property>/controls/flight/elevator-trim</property> |
|
205 |
<step type="double">-0.002</step> |
|
206 |
</binding> |
|
207 |
</button> |
|
208 | ||
209 |
<button n="5"> |
|
210 |
<desc>Elevator trim up</desc> |
|
211 |
<repeatable type="bool">true</repeatable> |
|
212 |
<binding> |
|
213 |
<command>property-adjust</command> |
|
214 |
<property>/controls/flight/elevator-trim</property> |
|
215 |
<step type="double">0.002</step> |
|
216 |
</binding> |
|
217 |
</button> |
|
218 | ||
219 |
<button n="6"> |
|
220 |
<desc>Flaps up</desc> |
|
221 |
<repeatable>false</repeatable> |
|
222 |
<binding> |
|
223 |
<command>nasal</command> |
|
224 |
<script>controls.flapsDown(-1)</script> |
|
225 |
</binding> |
|
226 |
<mod-up> |
|
227 |
<binding> |
|
228 |
<command>nasal</command> |
|
229 |
<script>controls.flapsDown(0)</script> |
|
230 |
</binding> |
|
231 |
</mod-up> |
|
232 |
</button> |
|
233 | ||
234 |
<button n="7"> |
|
235 |
<desc>Flaps down</desc> |
|
236 |
<repeatable>false</repeatable> |
|
237 |
<binding> |
|
238 |
<command>nasal</command> |
|
239 |
<script>controls.flapsDown(1)</script> |
|
240 |
</binding> |
|
241 |
<mod-up> |
|
242 |
<binding> |
|
243 |
<command>nasal</command> |
|
244 |
<script>controls.flapsDown(0)</script> |
|
245 |
</binding> |
|
246 |
</mod-up> |
|
247 |
</button> |
|
248 | ||
249 | ||
250 |
<button n="2"> |
|
251 |
<desc>Aileron trim left</desc> |
|
252 |
<repeatable>true</repeatable> |
|
253 |
<binding> |
|
254 |
<command>nasal</command> |
|
255 |
<script>controls.applyBrakes(1, -1)</script> |
|
256 |
</binding> |
|
257 |
<mod-up> |
|
258 |
<binding> |
|
259 |
<command>nasal</command> |
|
260 |
<script>controls.applyBrakes(0, -1)</script> |
|
261 |
</binding> |
|
262 |
</mod-up> |
|
263 |
<binding> |
|
264 |
<condition> |
|
265 |
<not> |
|
266 |
<property>/rotors/tail/rpm</property> |
|
267 |
</not> |
|
268 |
</condition> |
|
269 |
<command>property-adjust</command> |
|
270 |
<property>/controls/flight/aileron-trim</property> |
|
271 |
<step type="double">-0.001</step> |
|
272 |
</binding> |
|
273 |
<desc>Rudder for helis</desc> |
|
274 |
<binding> |
|
275 |
<condition> |
|
276 |
<property>/rotors/tail/rpm</property> |
|
277 |
</condition> |
|
278 |
<command>property-adjust</command> |
|
279 |
<property>/controls/flight/rudder</property> |
|
280 |
<step type="double">-0.01</step> |
|
281 |
</binding> |
|
282 |
</button> |
|
283 | ||
284 |
<button n="3"> |
|
285 |
<desc>Aileron trim right</desc> |
|
286 |
<repeatable>true</repeatable> |
|
287 |
<binding> |
|
288 |
<command>nasal</command> |
|
289 |
<script>controls.applyBrakes(1, 1)</script> |
|
290 |
</binding> |
|
291 |
<mod-up> |
|
292 |
<binding> |
|
293 |
<command>nasal</command> |
|
294 |
<script>controls.applyBrakes(0, 1)</script> |
|
295 |
</binding> |
|
296 |
</mod-up> |
|
297 |
<binding> |
|
298 |
<condition> |
|
299 |
<not> |
|
300 |
<property>/rotors/tail/rpm</property> |
|
301 |
</not> |
|
302 |
</condition> |
|
303 |
<command>property-adjust</command> |
|
304 |
<property>/controls/flight/aileron-trim</property> |
|
305 |
<step type="double">0.001</step> |
|
306 |
</binding> |
|
307 |
<desc>Rudder for helis</desc> |
|
308 |
<binding> |
|
309 |
<condition> |
|
310 |
<property>/rotors/tail/rpm</property> |
|
311 |
</condition> |
|
312 |
<command>property-adjust</command> |
|
313 |
<property>/controls/flight/rudder</property> |
|
314 |
<step type="double">0.01</step> |
|
315 |
</binding> |
|
316 |
</button> |
|
317 | ||
318 |
</PropertyList> |