Pilatus PC 12/47 : Adding a livery "Orange", improved dashboard.
[fg:toms-fgdata.git] / Aircraft / PC-12 / Nasal / engines-yasim.nas
1 #Initialise\r
2 var engine1 = engines.Turboprop.new(0, 0, 0.2);\r
3 \r
4 engine1.init();\r
5 \r
6 props.globals.initNode("/sim/autostart/started", 0, "BOOL");\r
7 \r
8 var eng1fuelon = func { setprop("/controls/engines/engine[0]/cutoff", 0); }\r
9 \r
10 var eng1fueloff = func { setprop("/controls/engines/engine[0]/cutoff", 1); }\r
11 \r
12 var eng1starter = func { setprop("/controls/engines/engine[0]/starter", 1); }\r
13 \r
14 var eng1start = func {\r
15   eng1fueloff();\r
16   eng1starter();\r
17   settimer(eng1fuelon, 2);\r
18 }\r
19 \r
20 var engstart = func {\r
21   settimer(eng1start, 2);\r
22 }\r
23 \r
24 var engstop = func {\r
25   eng1fueloff();\r
26   setprop("/controls/engines/engine[0]/throttle", 0);\r
27 }\r
28 \r
29 var autostart = func {\r
30   var startstatus = getprop("/sim/autostart/started");\r
31   if ( startstatus == 0 ) {\r
32     gui.popupTip("Autostarting...");\r
33     setprop("/sim/model/autostart", 1);\r
34     setprop("/sim/autostart/started", 1);\r
35     setprop("/controls/electric/battery-switch", 1);\r
36     settimer(engstart, 0.4);\r
37     gui.popupTip("Starting Engines");\r
38   }\r
39   if ( startstatus == 1 ) {\r
40     gui.popupTip("Shutting Down...");\r
41     setprop("/sim/model/autostart", 0);\r
42     setprop("/sim/autostart/started", 0);\r
43     engstop();\r
44   }\r
45 }\r
46 \r
47 var autostop = func {\r
48    engstop();\r
49 }\r