Improved accuracy of fuel consumption bonus calculation inside updateFuel()

This commit is contained in:
Dev 2024-03-27 21:44:58 +00:00
parent 9ddc09c10d
commit 7939e39945

View File

@ -449,14 +449,17 @@ export class HideoutHelper
let fuelUsedSinceLastTick = this.databaseServer.getTables().hideout.settings.generatorFuelFlowRate let fuelUsedSinceLastTick = this.databaseServer.getTables().hideout.settings.generatorFuelFlowRate
* this.getTimeElapsedSinceLastServerTick(pmcData, isGeneratorOn); * this.getTimeElapsedSinceLastServerTick(pmcData, isGeneratorOn);
const fuelConsumptionBonus = pmcData.Bonuses.find((bonus) => bonus.type === BonusType.FUEL_CONSUMPTION); const profileFuelConsumptionBonus = pmcData.Bonuses.find((bonus) => bonus.type === BonusType.FUEL_CONSUMPTION);
const fuelConsumptionBonusPercent = 1.0
- (fuelConsumptionBonus ? Math.abs(fuelConsumptionBonus.value) : 0) / 100;
fuelUsedSinceLastTick *= fuelConsumptionBonusPercent;
// Hideout management resource consumption bonus: // 0 to 1
const hideoutManagementConsumptionBonus = 1.0 - this.getHideoutManagementConsumptionBonus(pmcData); const fuelConsumptionBonusMultipler =
fuelUsedSinceLastTick *= hideoutManagementConsumptionBonus; (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 hasFuelRemaining = false;
let pointsConsumed = 0; let pointsConsumed = 0;