From 7939e3994552e0f16e31d701e9edbfe6a91b0231 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 27 Mar 2024 21:44:58 +0000 Subject: [PATCH] Improved accuracy of fuel consumption bonus calculation inside `updateFuel()` --- project/src/helpers/HideoutHelper.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index 45ce6cec..2d1b686a 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -449,14 +449,17 @@ export class HideoutHelper let fuelUsedSinceLastTick = this.databaseServer.getTables().hideout.settings.generatorFuelFlowRate * this.getTimeElapsedSinceLastServerTick(pmcData, isGeneratorOn); - const fuelConsumptionBonus = pmcData.Bonuses.find((bonus) => bonus.type === BonusType.FUEL_CONSUMPTION); - const fuelConsumptionBonusPercent = 1.0 - - (fuelConsumptionBonus ? Math.abs(fuelConsumptionBonus.value) : 0) / 100; - fuelUsedSinceLastTick *= fuelConsumptionBonusPercent; + const profileFuelConsumptionBonus = pmcData.Bonuses.find((bonus) => bonus.type === BonusType.FUEL_CONSUMPTION); - // Hideout management resource consumption bonus: - const hideoutManagementConsumptionBonus = 1.0 - this.getHideoutManagementConsumptionBonus(pmcData); - fuelUsedSinceLastTick *= hideoutManagementConsumptionBonus; + // 0 to 1 + const fuelConsumptionBonusMultipler = + (profileFuelConsumptionBonus ? Math.abs(profileFuelConsumptionBonus.value) : 0) / 100; + + // 0 to 1 + const hideoutManagementConsumptionBonusMultipler = this.getHideoutManagementConsumptionBonus(pmcData); + + const combinedBonus = 1.0 - (fuelConsumptionBonusMultipler + hideoutManagementConsumptionBonusMultipler); + fuelUsedSinceLastTick *= combinedBonus; let hasFuelRemaining = false; let pointsConsumed = 0;