Skip to content

Commit

Permalink
Merge pull request #415 from Juanvvc/bug-413
Browse files Browse the repository at this point in the history
Bug 413
  • Loading branch information
gilbertohasnofb committed Jul 12, 2015
2 parents 09115bd + 81c93e5 commit 874b89f
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 39 deletions.
41 changes: 23 additions & 18 deletions Models/c172p.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,21 @@
"Aircraft/c172p/Models/Liveries", 10,
func { print("c172p livery update") });

var rplayer = cmdarg();

# Beacon and strobes lighting
var lighting_beacon_enabled = rplayer.getNode("sim/multiplay/generic/int[12]").getPath();
var lighting_strobes_enabled = rplayer.getNode("sim/multiplay/generic/int[13]").getPath();

var lighting_beacon_state = rplayer.getNode("sim/model/c172p/lighting/beacon").getPath();
var lighting_strobes_state = rplayer.getNode("sim/model/c172p/lighting/strobes").getPath();

aircraft.light.new(lighting_beacon_state, [0.10, 0.90], lighting_beacon_enabled);
aircraft.light.new(lighting_strobes_state, [0.015, 1.985], lighting_strobes_enabled);

io.include("Aircraft/c172p/Nasal/registration_number.nas");

# Registration number
var rplayer = cmdarg();
var regnum_path = rplayer.getNode("sim/multiplay/generic/string[0]").getPath();
setlistener(regnum_path, func (node) {
set_registration_number(rplayer, node.getValue());
Expand Down Expand Up @@ -133,15 +144,9 @@

<params>
<lighting>
<navigation>
<property>sim/multiplay/generic/float[3]</property>
</navigation>
<beacon-top>
<property>sim/multiplay/generic/int[1]</property>
</beacon-top>
<strobes>
<property>sim/multiplay/generic/int[2]</property>
</strobes>
<navigation>sim/multiplay/generic/int[14]</navigation>
<beacon>sim/model/c172p/lighting/beacon/state</beacon>
<strobes>sim/model/c172p/lighting/strobes/state</strobes>
<taxi>
<property>sim/multiplay/generic/int[4]</property>
</taxi>
Expand All @@ -162,7 +167,7 @@
</doors>

<crash>
<property>sim/multiplay/generic/int[14]</property>
<property>sim/multiplay/generic/int[15]</property>
</crash>
<gear_nose_broken>
<property>sim/multiplay/generic/int[6]</property>
Expand Down Expand Up @@ -2946,7 +2951,7 @@
<object-name>navlight_rightDLB</object-name>
<object-name>navlight_rightGLB</object-name>
<condition>
<property alias="../../../params/lighting/navigation/property"/>
<property alias="../../../params/lighting/navigation"/>
</condition>
</animation>
<animation>
Expand Down Expand Up @@ -4675,7 +4680,7 @@
<object-name>strobe1</object-name>
<condition>
<and>
<property alias="/params/lighting/strobes/property"/>
<property alias="/params/lighting/strobes"/>
<equals>
<property alias="/params/wing_left_damaged/property"/>
<value>0</value>
Expand All @@ -4691,7 +4696,7 @@
<object-name>strobe2</object-name>
<condition>
<and>
<property alias="/params/lighting/strobes/property"/>
<property alias="/params/lighting/strobes"/>
<equals>
<property alias="/params/wing_right_damaged/property"/>
<value>0</value>
Expand All @@ -4707,7 +4712,7 @@
<object-name>strobe1BD</object-name>
<condition>
<and>
<property alias="/params/lighting/strobes/property"/>
<property alias="/params/lighting/strobes"/>
<equals>
<property alias="/params/wing_left_damaged/property"/>
<value>2</value>
Expand All @@ -4723,7 +4728,7 @@
<object-name>strobe2BD</object-name>
<condition>
<and>
<property alias="/params/lighting/strobes/property"/>
<property alias="/params/lighting/strobes"/>
<equals>
<property alias="/params/wing_right_damaged/property"/>
<value>2</value>
Expand All @@ -4740,7 +4745,7 @@
<object-name>strobe2Collapse</object-name>
<condition>
<and>
<property alias="/params/lighting/strobes/property"/>
<property alias="/params/lighting/strobes"/>
<property alias="/params/crash/property"/>
</and>
</condition>
Expand Down Expand Up @@ -4875,7 +4880,7 @@
<type>select</type>
<object-name>BeaconOffX</object-name>
<condition>
<property alias="/params/lighting/beacon-top/property"/>
<property alias="/params/lighting/beacon"/>
</condition>
</animation>
<animation>
Expand Down
7 changes: 0 additions & 7 deletions Nasal/electrical.nas
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ var init_electrical = func {
battery = BatteryClass.new();
alternator = AlternatorClass.new();

# These two properties are aliased to MP properties in /sim/multiplay/generic/.
# This aliasing seems to work in both ways, because the two properties below
# appear to receive the random values from the MP properties during initialization.
# Therefore, override these random values with the proper values we want.
props.globals.getNode("sim/model/c172p/lighting/beacon-top/state", 0).setBoolValue(0);
props.globals.getNode("sim/model/c172p/lighting/strobes/state", 0).setBoolValue(0);

# Request that the update function be called next frame
settimer(update_electrical, 0);
print("Electrical system initialized");
Expand Down
9 changes: 2 additions & 7 deletions Nasal/light.nas
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# strobes ===========================================================
var strobe_switch = props.globals.getNode("/systems/electrical/outputs/strobe", 1);
aircraft.light.new("sim/model/c172p/lighting/strobes", [0.015, 1.985], strobe_switch);

# beacons ===========================================================
var beacon_switch = props.globals.getNode("/systems/electrical/outputs/beacon", 1);
aircraft.light.new("sim/model/c172p/lighting/beacon-top", [0.10, 0.90], beacon_switch);
aircraft.light.new("/sim/model/c172p/lighting/strobes", [0.015, 1.985]);
aircraft.light.new("/sim/model/c172p/lighting/beacon", [0.10, 0.90]);
57 changes: 57 additions & 0 deletions Systems/als-lights.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,61 @@
</output>
</filter>

<logic>
<name>Lighting Beacon On/Off</name>
<input>
<and>
<less-than>
<property>/systems/electrical/outputs/beacon</property>
<value>31.5</value>
</less-than>
<greater-than>
<property>/systems/electrical/outputs/beacon</property>
<value>20.0</value>
</greater-than>
</and>
</input>
<output>
<property>/sim/model/c172p/lighting/beacon/enabled</property>
</output>
</logic>

<logic>
<name>Lighting Strobe On/Off</name>
<input>
<and>
<less-than>
<property>/systems/electrical/outputs/strobe</property>
<value>31.5</value>
</less-than>
<greater-than>
<property>/systems/electrical/outputs/strobe</property>
<value>20.0</value>
</greater-than>
</and>
</input>
<output>
<property>/sim/model/c172p/lighting/strobes/enabled</property>
</output>
</logic>

<logic>
<name>Lighting Navigation On/Off</name>
<input>
<and>
<less-than>
<property>/systems/electrical/outputs/nav-lights</property>
<value>31.5</value>
</less-than>
<greater-than>
<property>/systems/electrical/outputs/nav-lights</property>
<value>20.0</value>
</greater-than>
</and>
</input>
<output>
<property>/sim/model/c172p/lighting/nav-lights</property>
</output>
</logic>

</PropertyList>
14 changes: 7 additions & 7 deletions c172p-set.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ http://forum.flightgear.org/viewtopic.php?f=4&t=25157
<float n="0" alias="/sim/model/door-positions/rightDoor/position-norm"/>
<float n="1" alias="/sim/model/door-positions/leftDoor/position-norm"/>
<float n="2" alias="/sim/model/door-positions/baggageDoor/position-norm"/>
<float n="3" alias="/systems/electrical/outputs/nav-lights"/>
<!-- 3 unused -->
<!-- 4 unused -->
<float n="5" alias="/controls/gear/water-rudder-down-actual"/>
<float n="6" alias="/fdm/jsbsim/hydro/spray-wake-speed-kt-actual"/>
Expand All @@ -282,8 +282,8 @@ http://forum.flightgear.org/viewtopic.php?f=4&t=25157
<!-- 19 unused -->

<!-- 0 unused -->
<int n="1" alias="/sim/model/c172p/lighting/beacon-top/state"/>
<int n="2" alias="/sim/model/c172p/lighting/strobes/state"/>
<!-- 1 unused -->
<!-- 2 unused -->
<!-- 3 unused -->
<int n="4" alias="/sim/model/c172p/lighting/taxi"/>
<int n="5" alias="/sim/model/c172p/lighting/landing"/>
Expand All @@ -293,10 +293,10 @@ http://forum.flightgear.org/viewtopic.php?f=4&t=25157
<int n="9" alias="/fdm/jsbsim/bushkit"/>
<int n="10" alias="/fdm/jsbsim/pontoon-damage/left-pontoon"/>
<int n="11" alias="/fdm/jsbsim/pontoon-damage/right-pontoon"/>
<!-- 12 unused -->
<!-- 13 unused -->
<int n="14" alias="/fdm/jsbsim/crash"/>
<!-- 15 unused -->
<int n="12" alias="/sim/model/c172p/lighting/beacon/enabled"/>
<int n="13" alias="/sim/model/c172p/lighting/strobes/enabled"/>
<int n="14" alias="/sim/model/c172p/lighting/nav-lights"/>
<int n="15" alias="/fdm/jsbsim/crash"/>
<int n="16" alias="/payload/pax-state"/>
<int n="17" alias="/engines/active-engine/exhaust"/>
<int n="18" alias="/sim/model/c172p/damage/left-wing"/>
Expand Down

0 comments on commit 874b89f

Please sign in to comment.