Fix fuel ticks returning fuel to the player instead of removing it (!397)
Resolves the issue of incorrect fuel usage by using relative percentages for both the profile bonus and hideout management bonus Add a sanity check to make sure we never return fuel to the player (No negative fuel consumption)
This commit is contained in:
parent
79f0949610
commit
bd5d4bfb66
@ -425,13 +425,19 @@ export class HideoutHelper {
|
||||
BonusType.FUEL_CONSUMPTION,
|
||||
);
|
||||
|
||||
// 0 to 1
|
||||
const fuelConsumptionBonusMultipler = (profileFuelConsomptionBonusSum + 100) / 100;
|
||||
// An increase in "bonus" consumption is actually an increase in consumption, so invert this for later use
|
||||
const fuelConsumptionBonusRate = -(profileFuelConsomptionBonusSum / 100);
|
||||
|
||||
// 0 to 1
|
||||
const hideoutManagementConsumptionBonusMultipler = this.getHideoutManagementConsumptionBonus(pmcData);
|
||||
// An increase in hideout management bonus is a decrease in consumption
|
||||
const hideoutManagementConsumptionBonusRate = this.getHideoutManagementConsumptionBonus(pmcData);
|
||||
|
||||
let combinedBonus = 1.0 - (fuelConsumptionBonusRate + hideoutManagementConsumptionBonusRate);
|
||||
|
||||
// Sanity check, never let fuel consumption go negative, otherwise it returns fuel to the player
|
||||
if (combinedBonus < 0) {
|
||||
combinedBonus = 0;
|
||||
}
|
||||
|
||||
const combinedBonus = 1.0 - (fuelConsumptionBonusMultipler + hideoutManagementConsumptionBonusMultipler);
|
||||
fuelUsedSinceLastTick *= combinedBonus;
|
||||
|
||||
let hasFuelRemaining = false;
|
||||
|
@ -144,7 +144,9 @@ export class InsuranceService {
|
||||
pmcData,
|
||||
BonusType.INSURANCE_RETURN_TIME,
|
||||
);
|
||||
const insuranceReturnTimeBonusPercent = 1.0 - (insuranceReturnTimeBonusSum + 100) / 100;
|
||||
|
||||
// A negative bonus implies a faster return, since we subtract later, invert the value here
|
||||
const insuranceReturnTimeBonusPercent = -(insuranceReturnTimeBonusSum / 100);
|
||||
|
||||
const traderMinReturnAsSeconds = trader.insurance.min_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
||||
const traderMaxReturnAsSeconds = trader.insurance.max_return_hour * TimeUtil.ONE_HOUR_AS_SECONDS;
|
||||
@ -168,8 +170,9 @@ export class InsuranceService {
|
||||
randomisedReturnTimeSeconds *= editionModifier.multiplier;
|
||||
}
|
||||
|
||||
// Current time + randomised time calculated above
|
||||
return this.timeUtil.getTimestamp() + randomisedReturnTimeSeconds * insuranceReturnTimeBonusPercent;
|
||||
// Calculate the final return time based on our bonus percent
|
||||
const finalReturnTimeSeconds = randomisedReturnTimeSeconds * (1.0 - insuranceReturnTimeBonusPercent);
|
||||
return this.timeUtil.getTimestamp() + finalReturnTimeSeconds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,8 @@ export class RagfairTaxService {
|
||||
pmcData,
|
||||
BonusType.RAGFAIR_COMMISSION,
|
||||
);
|
||||
const taxDiscountPercent = (hideoutFleaTaxDiscountBonusSum + 100) / 100.0;
|
||||
// A negative bonus implies a lower discount, since we subtract later, invert the value here
|
||||
const taxDiscountPercent = -(hideoutFleaTaxDiscountBonusSum / 100.0);
|
||||
|
||||
const tax =
|
||||
itemWorth * itemTaxMult * itemPriceMult + requirementsPrice * requirementTaxMult * requirementPriceMult;
|
||||
|
Loading…
Reference in New Issue
Block a user