Fix for issue 526 - Not possible to restart YASim aircraft after fuel starvation
This commit is contained in:
parent
093248ca3c
commit
3fb129923c
1 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# Fuel handling for the YASim FDM. Note that other FDMs (e.g. JSBSim)
|
||||||
|
# handle fuel within the FDM itself.
|
||||||
|
#
|
||||||
# Properties under /consumables/fuel/tank[n]:
|
# Properties under /consumables/fuel/tank[n]:
|
||||||
# + level-lbs - Current fuel load. Can be set by user code.
|
# + level-lbs - Current fuel load. Can be set by user code.
|
||||||
# + selected - boolean indicating tank selection.
|
# + selected - boolean indicating tank selection.
|
||||||
|
@ -22,9 +25,6 @@ var update = func {
|
||||||
fuel.setDoubleValue(0);
|
fuel.setDoubleValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!consumed_fuel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var selected_tanks = [];
|
var selected_tanks = [];
|
||||||
foreach (var t; tanks) {
|
foreach (var t; tanks) {
|
||||||
var cap = t.getNode("capacity-gal_us",0);
|
var cap = t.getNode("capacity-gal_us",0);
|
||||||
|
@ -71,6 +71,10 @@ var fuel_freeze = nil;
|
||||||
_setlistener("/sim/signals/fdm-initialized", func {
|
_setlistener("/sim/signals/fdm-initialized", func {
|
||||||
setlistener("/sim/freeze/fuel", func(n) { fuel_freeze = n.getBoolValue() }, 1);
|
setlistener("/sim/freeze/fuel", func(n) { fuel_freeze = n.getBoolValue() }, 1);
|
||||||
|
|
||||||
|
# Fuel sub-system is only used by YASim. Other FDMs (e.g. JSBSim)
|
||||||
|
# handle fuel themselves.
|
||||||
|
if (getprop("/sim/flight-model") != "yasim") { return; }
|
||||||
|
|
||||||
engines = props.globals.getNode("engines", 1).getChildren("engine");
|
engines = props.globals.getNode("engines", 1).getChildren("engine");
|
||||||
foreach (var e; engines) {
|
foreach (var e; engines) {
|
||||||
e.getNode("fuel-consumed-lbs", 1).setDoubleValue(0);
|
e.getNode("fuel-consumed-lbs", 1).setDoubleValue(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue