Debian Codegraph @

Aircraft/c172p/Nasal/interior-lighting.nas

raw
1 # Copyright (C) 2015 onox
2 # Wayne Bragg/c172p-detailed 2015
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # Dome lights
18 var toggle_domelight = func {
19 var old_value = getprop("/sim/model/c172p/lighting/dome-norm");
20 var new_value = math.mod(old_value + 1, 4);
21 setprop("/sim/model/c172p/lighting/dome-norm", new_value);
22 if (new_value == 0) {
23 setprop("/controls/switches/dome-red", 0);
24 setprop("/controls/switches/dome-white", 0);
25 }
26 if (new_value == 1) {
27 setprop("/controls/switches/dome-red", 1);
28 setprop("/controls/switches/dome-white", 0);
29 }
30 if (new_value == 2) {
31 setprop("/controls/switches/dome-red", 2);
32 setprop("/controls/switches/dome-white", 0);
33 }
34 if (new_value == 3) {
35 setprop("/controls/switches/dome-red", 2);
36 setprop("/controls/switches/dome-white", 1);
37 }
38 };