Skip to content

Commit

Permalink
Merge pull request #377 from masterrob94/lowereicas_datastore_fix
Browse files Browse the repository at this point in the history
fix: lower EICAS fuel to match upper EICAS fuel unit
  • Loading branch information
747-4EVER authored Jan 26, 2022
2 parents 8c3db20 + 07053da commit 4063d5e
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var B747_8_LowerEICAS_Fuel;
this.allFuelComponents = new Array();
this.gallonToMegagrams = 0;
this.gallonToMegapounds = 0;
this.units = true;
this.isInitialised = false;
}
get templateID() { return "B747_8LowerEICASFuelTemplate"; }
Expand Down Expand Up @@ -136,6 +137,17 @@ var B747_8_LowerEICAS_Fuel;
}
}
update(_deltaTime) {
const storedUnits = SaltyDataStore.get("OPTIONS_UNITS", "KG");
switch (storedUnits) {
case "KG":
this.units = true;
break;
case "LBS":
this.units = false;
break;
default:
this.units = true;
}
if (!this.isInitialised) {
return;
}
Expand All @@ -154,7 +166,7 @@ var B747_8_LowerEICAS_Fuel;
}
}
if (this.unitTextSVG) {
if (SimVar.GetSimVarValue("L:SALTY_UNIT_IS_METRIC", "bool")) {
if (this.units) {
this.unitTextSVG.textContent = "KGS X 1000";
}
else {
Expand Down Expand Up @@ -192,14 +204,14 @@ var B747_8_LowerEICAS_Fuel;
}
getTotalFuelInMegagrams() {
let factor = this.gallonToMegapounds;
if (SimVar.GetSimVarValue("L:SALTY_UNIT_IS_METRIC", "bool")) {
if (this.units) {
factor = this.gallonToMegagrams;
}
return (SimVar.GetSimVarValue("FUEL TOTAL QUANTITY", "gallons") * factor);
}
getMainTankFuelInMegagrams(_index) {
let factor = this.gallonToMegapounds;
if (SimVar.GetSimVarValue("L:SALTY_UNIT_IS_METRIC", "bool")) {
if (this.units) {
factor = this.gallonToMegagrams;
}
return (SimVar.GetSimVarValue("FUELSYSTEM TANK QUANTITY:" + _index, "gallons") * factor);
Expand Down

0 comments on commit 4063d5e

Please sign in to comment.