1
0
Fork 0

Support a "kill-when-empty" flag on tanks to enable the strict

"engines die when any tank is empty" behavior.  Otherwise, just
deselect the empty tank.  This matches the "both" behavior many
lightplane fuel selectors have.
This commit is contained in:
andy 2004-04-30 14:42:42 +00:00
parent 057b31de46
commit aa2686c0b9

View file

@ -60,7 +60,13 @@ fuelUpdate = func {
ppg = t.getNode("density-ppg").getValue();
lbs = t.getNode("level-gal_us").getValue() * ppg;
lbs = lbs - fuelPerTank;
if(lbs < 0) { lbs = 0; outOfFuel = 1; }
if(lbs < 0) {
lbs = 0;
# Kill the engines if we're told to, otherwise simply
# deselect the tank.
if(t.getBoolValue("kill-when-empty")) { outOfFuel = 1; }
else { t.setBoolValue("selected", 0); }
}
gals = lbs / ppg;
t.getNode("level-gal_us").setDoubleValue(gals);
t.getNode("level-lbs").setDoubleValue(lbs);