Smoking / strobe auto

This commit is contained in:
Jonathan Redpath 2018-11-19 14:18:06 +00:00
parent 1c40db195e
commit a04037a602
5 changed files with 124 additions and 38 deletions

View file

@ -652,6 +652,8 @@
<overhead-panel-norm type="double">0</overhead-panel-norm>
<main-panel-pedestal-norm type="double">0</main-panel-pedestal-norm>
<strobe type="bool">0</strobe>
<no-smoking-sign type="bool">1</no-smoking-sign>
<seatbelt-sign type="bool">0</seatbelt-sign>
<taxi-light-switch type="float">0</taxi-light-switch>
</lighting>
<OH>
@ -679,11 +681,12 @@
<switches>
<cart type="bool">0</cart>
<!-- Smoking is bad :P -->
<no-smoking-sign type="bool">1</no-smoking-sign>
<seatbelt-sign type="bool">0</seatbelt-sign>
<no-smoking-sign type="double">0.5</no-smoking-sign>
<seatbelt-sign type="double">0.0</seatbelt-sign>
<annun-test>0</annun-test>
<windowprobeheat type="double">0.5</windowprobeheat>
<qnh-knb>100000</qnh-knb>
<strobe type="double">0.0</strobe>
</switches>
<tray n="0">
<lefttrayext type="double">0</lefttrayext>

View file

@ -4461,10 +4461,30 @@
<object-name>StrobeLtSwtch</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<property>controls/lighting/strobe</property>
<command>property-cycle</command>
<property>controls/switches/strobe</property>
<value>0.0</value>
<value>0.5</value>
<value>1.0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/switch1", 1);</script>
</binding>
</action>
<action>
<button>1</button>
<button>4</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/switches/strobe</property>
<value>1.0</value>
<value>0.5</value>
<value>0.0</value>
</binding>
<binding>
<command>nasal</command>
@ -4472,14 +4492,16 @@
</binding>
</action>
</animation>
<animation>
<name>Strobe lights rotate</name>
<type>rotate</type>
<object-name>StrobeLtSwtch</object-name>
<property>controls/lighting/strobe</property>
<property>controls/switches/strobe</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
<entry><ind>0.0</ind><dep>35</dep></entry>
<entry><ind>0.5</ind><dep>0</dep></entry>
<entry><ind>1.0</ind><dep>-35</dep></entry>
</interpolation>
<axis>
<x>0</x>
@ -5609,10 +5631,30 @@
<object-name>SeatBeltSwtch</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<command>property-adjust</command>
<property>controls/switches/seatbelt-sign</property>
<step>1</step>
<min>0</min>
<max>1</max>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/switch1", 1);</script>
</binding>
</action>
<action>
<button>1</button>
<button>4</button>
<repeatable>false</repeatable>
<binding>
<command>property-adjust</command>
<property>controls/switches/seatbelt-sign</property>
<step>-1</step>
<min>0</min>
<max>1</max>
</binding>
<binding>
<command>nasal</command>
@ -5628,6 +5670,7 @@
<property>controls/switches/seatbelt-sign</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>0.5</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
</interpolation>
<axis>
@ -5648,10 +5691,30 @@
<object-name>NoSmokingSwtch</object-name>
<action>
<button>0</button>
<button>3</button>
<repeatable>false</repeatable>
<binding>
<command>property-toggle</command>
<command>property-cycle</command>
<property>controls/switches/no-smoking-sign</property>
<value>0.0</value>
<value>0.5</value>
<value>1.0</value>
</binding>
<binding>
<command>nasal</command>
<script>setprop("/sim/sounde/switch1", 1);</script>
</binding>
</action>
<action>
<button>1</button>
<button>4</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>controls/switches/no-smoking-sign</property>
<value>1.0</value>
<value>0.5</value>
<value>0.0</value>
</binding>
<binding>
<command>nasal</command>
@ -5666,6 +5729,7 @@
<property>controls/switches/no-smoking-sign</property>
<interpolation>
<entry><ind>0</ind><dep>35</dep></entry>
<entry><ind>0.5</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>-35</dep></entry>
</interpolation>
<axis>

View file

@ -33,11 +33,11 @@ setprop("/engines/engine[1]/oil-qt-actual", qty2);
# Lights #
##########
var beacon_switch = props.globals.getNode("/controls/switches/beacon", 2);
var beacon_switch = props.globals.getNode("/controls/switches/beacon", 1);
var beacon = aircraft.light.new("/sim/model/lights/beacon", [0.1, 1], "/controls/lighting/beacon");
var strobe_switch = props.globals.getNode("/controls/switches/strobe", 2);
var strobe_switch = props.globals.getNode("/controls/switches/strobe", 1);
var strobe_light = props.globals.getNode("/controls/lighting/strobe", 1);
var strobe = aircraft.light.new("/sim/model/lights/strobe", [0.05, 0.06, 0.05, 1], "/controls/lighting/strobe");
var tail_strobe_switch = props.globals.getNode("/controls/switches/tailstrobe", 2);
var tail_strobe = aircraft.light.new("/sim/model/lights/tailstrobe", [0.1, 1], "/controls/lighting/strobe");
var logo_lights = getprop("/sim/model/lights/logo-lights");
var nav_lights = props.globals.getNode("/sim/model/lights/nav-lights");
@ -109,19 +109,19 @@ setlistener("/sim/sounde/switch1", func {
}, 0.05);
});
setlistener("/controls/switches/seatbelt-sign", func {
setlistener("/controls/lighting/seatbelt-sign", func {
props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(1);
settimer(func {
props.globals.getNode("/sim/sounde/seatbelt-sign").setBoolValue(0);
}, 2);
});
}, 0, 0);
setlistener("/controls/switches/no-smoking-sign", func {
setlistener("/controls/lighting/no-smoking-sign", func {
props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(1);
settimer(func {
props.globals.getNode("/sim/sounde/no-smoking-sign").setBoolValue(0);
}, 1);
});
}, 0, 0);
#########
# Doors #
@ -520,6 +520,47 @@ var lightsLoop = maketimer(0.2, func {
} else {
nav_lights.setBoolValue(0);
}
# strobe
strobe_sw = strobe_switch.getValue();
if (strobe_sw == 1) {
strobe_light.setValue(1);
} elsif (strobe_sw == 0.5 and getprop("/gear/gear[1]/wow") == 0 and getprop("/gear/gear[2]/wow") == 0) {
# todo: use lgciu output 5
strobe_light.setValue(1);
} else {
strobe_light.setValue(0);
}
# signs
if (getprop("/systems/pressurization/cabinalt-norm") > 11300) {
setprop("/controls/lighting/seatbelt-sign", 1);
setprop("/controls/lighting/no-smoking-sign", 1);
} else {
if (getprop("controls/switches/seatbelt-sign") == 1) {
if (getprop("/controls/lighting/seatbelt-sign") == 0) {
setprop("/controls/lighting/seatbelt-sign", 1);
}
} elsif (getprop("controls/switches/seatbelt-sign") == 0) {
if (getprop("/controls/lighting/seatbelt-sign") == 1) {
setprop("/controls/lighting/seatbelt-sign", 0);
}
}
if (getprop("controls/switches/no-smoking-sign") == 1) {
if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1);
}
} elsif (getprop("controls/switches/no-smoking-sign") == 0.5 and getprop("gear/gear[0]/position-norm") != 0) {
if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1);
}
} else {
setprop("/controls/lighting/no-smoking-sign", 0); # sign stays on in cabin but sound still occurs
}
}
});
var lTray = func {

View file

@ -870,28 +870,6 @@
</volume>
</gear>
<gear>
<name>gearding</name>
<mode>once</mode>
<path>nosmoko.wav</path> <!-- since it is trigered by smoking sign logic then the sound must be smoking sign sound -->
<condition>
<and>
<equals>
<property>gear/gear[0]/position-norm</property>
<value>0</value>
</equals>
<equals>
<property>gear/gear[1]/position-norm</property>
<value>0</value>
</equals>
<equals>
<property>gear/gear[2]/position-norm</property>
<value>0</value>
</equals>
</and>
</condition>
</gear>
<wind>
<path>FL2070/320wind.wav</path>
<mode>looped</mode>

Binary file not shown.