1
0
Fork 0

Merge branch 'work' of D:\Git_New\fgdata

This commit is contained in:
Vivian Meazza 2012-09-16 22:30:38 +01:00
commit 59e5c1c7f6
6 changed files with 71 additions and 52 deletions

View file

@ -2095,7 +2095,7 @@
<object-name>navlight_right</object-name>
<object-name>navlight_back</object-name>
<condition>
<property>controls/lighting/nav-lights</property>
<property>systems/electrical/outputs/nav-lights</property>
</condition>
</animation>
@ -2436,7 +2436,7 @@
<condition>
<and>
<property>/sim/rendering/rembrandt/enabled</property>
<property>controls/lighting/landing-lights</property>
<property>systems/electrical/outputs/landing-lights</property>
</and>
</condition>
</animation>
@ -2447,7 +2447,7 @@
<condition>
<and>
<property>/sim/rendering/rembrandt/enabled</property>
<property>controls/lighting/taxi-light</property>
<property>systems/electrical/outputs/taxi-light</property>
</and>
</condition>
</animation>
@ -2460,7 +2460,7 @@
<object-name>landinglight2</object-name>
<condition>
<and>
<property>controls/lighting/landing-lights</property>
<property>systems/electrical/outputs/landing-lights</property>
<not>
<property>/sim/rendering/rembrandt/enabled</property>
</not>
@ -2523,7 +2523,7 @@
<object-name>TaxiLightCone</object-name>
<nopreview/>
<condition>
<property>controls/lighting/taxi-light</property>
<property>systems/electrical/outputs/taxi-light</property>
</condition>
<position>
<x>-0.078</x>
@ -2570,7 +2570,7 @@
<object-name>landinglightcover</object-name>
<condition>
<not>
<property>controls/lighting/landing-lights</property>
<property>systems/electrical/outputs/landing-lights</property>
</not>
</condition>
</animation>

View file

@ -64,14 +64,21 @@ BatteryClass.new = func {
BatteryClass.apply_load = func( amps, dt ) {
var amphrs_used = amps * dt / 3600.0;
var percent_used = amphrs_used / me.amp_hours;
me.charge_percent -= percent_used;
if ( me.charge_percent < 0.0 ) {
me.charge_percent = 0.0;
} elsif ( me.charge_percent > 1.0 ) {
me.charge_percent = 1.0;
var charge_percent = me.charge_percent;
charge_percent -= percent_used;
if ( charge_percent < 0.0 ) {
charge_percent = 0.0;
} elsif ( charge_percent > 1.0 ) {
charge_percent = 1.0;
}
# print( "battery percent = ", me.charge_percent);
return me.amp_hours * me.charge_percent;
if ((charge_percent < 0.1)and(me.charge_percent >= 0.1))
{
print("Warning: Low battery! Enable alternator or apply external power to recharge battery.");
}
me.charge_percent = charge_percent;
setprop("/systems/electrical/battery-charge-percent", charge_percent);
# print( "battery percent = ", charge_percent);
return me.amp_hours * charge_percent;
}
##
@ -207,6 +214,10 @@ update_virtual_bus = func( dt ) {
# switch state
var master_bat = getprop("/controls/engines/engine[0]/master-bat");
var master_alt = getprop("/controls/engines/engine[0]/master-alt");
if (getprop("/controls/electric/external-power"))
{
external_volts = 28;
}
# determine power source
var bus_volts = 0.0;
@ -233,7 +244,7 @@ update_virtual_bus = func( dt ) {
load += 12;
}
setprop("systems/electrical/outputs/starter[0]", starter_volts);
if (starter_volts > 1) {
if (starter_volts > 12) {
setprop("controls/engines/engine[0]/starter",1);
setprop("controls/engines/engine[0]/magnetos",3);
} else {
@ -251,9 +262,6 @@ update_virtual_bus = func( dt ) {
# system loads and ammeter gauge
var ammeter = 0.0;
if ( bus_volts > 1.0 ) {
# normal load
load += 15.0;
# ammeter gauge
if ( power_source == "battery" ) {
ammeter = -load;
@ -271,12 +279,15 @@ update_virtual_bus = func( dt ) {
}
# filter ammeter needle pos
var ammeter_ave = 0.8 * ammeter_ave + 0.2 * ammeter;
ammeter_ave = 0.8 * ammeter_ave + 0.2 * ammeter;
# outputs
setprop("/systems/electrical/amps", ammeter_ave);
setprop("/systems/electrical/volts", bus_volts);
if (bus_volts > 12)
vbus_volts = bus_volts;
else
vbus_volts = 0.0;
return load;
}
@ -290,6 +301,7 @@ electrical_bus_1 = func() {
# Cabin Lights Power
if ( getprop("/controls/circuit-breakers/cabin-lights-pwr") ) {
setprop("/systems/electrical/outputs/cabin-lights", bus_volts);
load += bus_volts / 57;
} else {
setprop("/systems/electrical/outputs/cabin-lights", 0.0);
}
@ -300,21 +312,23 @@ electrical_bus_1 = func() {
# Fuel Pump Power
if ( getprop("/controls/engines/engine[0]/fuel-pump") ) {
setprop("/systems/electrical/outputs/fuel-pump", bus_volts);
load += bus_volts / 28;
} else {
setprop("/systems/electrical/outputs/fuel-pump", 0.0);
}
# Landing Light Power
if ( getprop("/controls/switches/landing-light") ) {
setprop("/systems/electrical/outputs/landing-light", bus_volts);
if ( getprop("/controls/lighting/landing-lights") ) {
setprop("/systems/electrical/outputs/landing-lights", bus_volts);
load += bus_volts / 5;
} else {
setprop("/systems/electrical/outputs/landing-light", 0.0 );
setprop("/systems/electrical/outputs/landing-lights", 0.0 );
}
# Beacon Power
if ( getprop("/controls/switches/flashing-beacon" ) ) {
if ( getprop("/controls/lighting/beacon" ) ) {
setprop("/systems/electrical/outputs/beacon", bus_volts);
if ( bus_volts > 1.0 ) { load += 7.5; }
load += bus_volts / 28;
} else {
setprop("/systems/electrical/outputs/beacon", 0.0);
}
@ -335,34 +349,37 @@ electrical_bus_2 = func() {
var bus_volts = vbus_volts;
var load = 0.0;
# Map Lights Power
if ( getprop("/controls/switches/nav-lights" ) ) {
setprop("/systems/electrical/outputs/map-lights", bus_volts);
if ( bus_volts > 1.0 ) { load += 7.0; }
# Nav Lights Power
if ( getprop("/controls/lighting/nav-lights" ) ) {
setprop("/systems/electrical/outputs/nav-lights", bus_volts);
load += bus_volts / 14;
} else {
setprop("/systems/electrical/outputs/map-lights", 0.0);
setprop("/systems/electrical/outputs/nav-lights", 0.0);
}
# Instrument Lights Power
setprop("/systems/electrical/outputs/instrument-lights", bus_volts);
# Strobe Lights Power
if ( getprop("/controls/switches/strobe-lights" ) ) {
setprop("/systems/electrical/outputs/strobe-lights", bus_volts);
if ( getprop("/controls/lighting/strobe" ) ) {
setprop("/systems/electrical/outputs/strobe", bus_volts);
load += bus_volts / 14;
} else {
setprop("/systems/electrical/outputs/strobe-lights", 0.0);
setprop("/systems/electrical/outputs/strobe", 0.0);
}
# Taxi Lights Power
if ( getprop("/controls/switches/taxi-lights" ) ) {
setprop("/systems/electrical/outputs/taxi-lights", bus_volts);
if ( getprop("/controls/lighting/taxi-light" ) ) {
setprop("/systems/electrical/outputs/taxi-light", bus_volts);
load += bus_volts / 10;
} else {
setprop("/systems/electrical/outputs/taxi-lights", 0.0);
setprop("/systems/electrical/outputs/taxi-light", 0.0);
}
# Pitot Heat Power
if ( getprop("/controls/switches/pitot-heat" ) ) {
if ( getprop("/controls/anti-ice/pitot-heat" ) ) {
setprop("/systems/electrical/outputs/pitot-heat", bus_volts);
load += bus_volts / 28;
} else {
setprop("/systems/electrical/outputs/pitot-heat", 0.0);
}
@ -401,6 +418,8 @@ avionics_bus_1 = func() {
bus_volts = ebus1_volts;
}
load += bus_volts / 20.0;
# Turn Coordinator Power
setprop("/systems/electrical/outputs/turn-coordinator", bus_volts);
@ -440,7 +459,8 @@ avionics_bus_2 = func() {
if ( master_av ) {
bus_volts = ebus2_volts;
}
var load = 0.0;
var load = bus_volts / 20.0;
# NavCom 2 Power
setprop("/systems/electrical/outputs/nav[1]", bus_volts);

View file

@ -1,10 +1,10 @@
# strobes ===========================================================
var strobe_switch = props.globals.getNode("controls/lighting/strobe", 1);
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("controls/lighting/beacon", 1);
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);

View file

@ -89,7 +89,7 @@
<output>
<name>Landing Light Power</name>
<prop>/systems/electrical/outputs/landing-light</prop>
<prop>/systems/electrical/outputs/landing-lights</prop>
</output>
<output>
@ -115,8 +115,8 @@
</output>
<output>
<name>Map Lights Power</name>
<prop>/systems/electrical/outputs/map-lights</prop>
<name>Nav Lights Power</name>
<prop>/systems/electrical/outputs/nav-lights</prop>
</output>
<output>
@ -126,12 +126,12 @@
<output>
<name>Strobe Lights Power</name>
<prop>/systems/electrical/outputs/strobe-lights</prop>
<prop>/systems/electrical/outputs/strobe</prop>
</output>
<output>
<name>Taxi Lights Power</name>
<prop>/systems/electrical/outputs/taxi-lights</prop>
<prop>/systems/electrical/outputs/taxi-light</prop>
</output>
<output>
@ -324,7 +324,7 @@
<input>Electrical Bus 1</input>
<output>Landing Light Power</output>
<switch>
<prop>/controls/switches/landing-light</prop>
<prop>/controls/lighting/landing-lights</prop>
</switch>
</connector>
@ -332,7 +332,7 @@
<input>Electrical Bus 1</input>
<output>Beacon Power</output>
<switch>
<prop>/controls/switches/flashing-beacon</prop>
<prop>/controls/lighting/beacon</prop>
</switch>
</connector>
@ -366,7 +366,7 @@
<input>Electrical Bus 2</input>
<output>Map Lights Power</output>
<switch>
<prop>/controls/switches/nav-lights</prop>
<prop>/controls/lighting/nav-lights</prop>
</switch>
</connector>
@ -382,7 +382,7 @@
<input>Electrical Bus 2</input>
<output>Strobe Lights Power</output>
<switch>
<prop>/controls/switches/strobe-lights</prop>
<prop>/controls/lighting/strobe</prop>
</switch>
</connector>
@ -390,7 +390,7 @@
<input>Electrical Bus 2</input>
<output>Taxi Lights Power</output>
<switch>
<prop>/controls/switches/taxi-lights</prop>
<prop>/controls/lighting/taxi-light</prop>
</switch>
</connector>
@ -398,7 +398,7 @@
<input>Electrical Bus 2</input>
<output>Pitot Heat Power</output>
<switch>
<prop>/controls/switches/pitot-heat</prop>
<prop>/controls/anti-ice/pitot-heat</prop>
</switch>
</connector>

View file

@ -412,9 +412,8 @@ var model = {
me.callsign = {};
foreach (var n; props.globals.getNode("ai/models", 1).getChildren("multiplayer")) {
if (!n.getNode("valid").getValue())
if ((var valid = n.getNode("valid")) == nil or (!valid.getValue()))
continue;
if ((var callsign = n.getNode("callsign")) == nil or !(callsign = callsign.getValue()))
continue;
if (!(callsign = string.trim(callsign)))

BIN
Sounds/rattleroll.wav Normal file

Binary file not shown.