Updated water filtering system to correctly check the craft progress against the ProductionTime
value stored in the profile instead of the base ProductionTime
value in the hideout json.
This is because the base value doesn't take into account any craft bonuses the profile has After collecting a product from a continious craft, `ProductionTime` in the profiles craft data will be refreshed, this resolves issues with adjusting the `production.json` craft times not applying to continuous crafts
This commit is contained in:
parent
7b835f1501
commit
8014bdd06f
@ -227,10 +227,11 @@ export class HideoutController {
|
||||
|
||||
// Cleanup temporary fuel usage buffs from mopping floor if wall is complete as it would result in too many bonuses
|
||||
// TODO: Clean up all buffs from mopping floor.
|
||||
if (profileHideoutArea.type === HideoutAreas.EMERGENCY_WALL && profileHideoutArea.level === 6)
|
||||
{
|
||||
if (profileHideoutArea.type === HideoutAreas.EMERGENCY_WALL && profileHideoutArea.level === 6) {
|
||||
// Get everything except specific fuel consumption buffs
|
||||
pmcData.Bonuses = pmcData.Bonuses.filter(bonus => bonus.type !== BonusType.FUEL_CONSUMPTION && bonus.value >= -10 && bonus.value <= 0);
|
||||
pmcData.Bonuses = pmcData.Bonuses.filter(
|
||||
(bonus) => bonus.type !== BonusType.FUEL_CONSUMPTION && bonus.value >= -10 && bonus.value <= 0,
|
||||
);
|
||||
}
|
||||
|
||||
// Add Skill Points Per Area Upgrade
|
||||
@ -955,6 +956,16 @@ export class HideoutController {
|
||||
pmcData.Hideout.Production[prodId].sptIsComplete = true;
|
||||
pmcData.Hideout.Production[prodId].sptIsContinuous = recipe.continuous;
|
||||
|
||||
// Continious recipies need the craft time refreshed as it gets created once on initial craft and stays the same regardless of what
|
||||
// production.json is set to
|
||||
if (recipe.continuous) {
|
||||
pmcData.Hideout.Production[prodId].ProductionTime = this.hideoutHelper.getAdjustedCraftTimeWithSkills(
|
||||
pmcData,
|
||||
recipe._id,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
// Flag normal (non continious) crafts as complete
|
||||
if (!recipe.continuous) {
|
||||
pmcData.Hideout.Production[prodId].inProgress = false;
|
||||
|
@ -420,7 +420,10 @@ export class HideoutHelper {
|
||||
this.getTimeElapsedSinceLastServerTick(pmcData, isGeneratorOn);
|
||||
|
||||
// Get all fuel consumption bonuses, returns an empty array if none found
|
||||
const profileFuelConsomptionBonusSum = this.profileHelper.getBonusValueFromProfile(pmcData,BonusType.FUEL_CONSUMPTION)
|
||||
const profileFuelConsomptionBonusSum = this.profileHelper.getBonusValueFromProfile(
|
||||
pmcData,
|
||||
BonusType.FUEL_CONSUMPTION,
|
||||
);
|
||||
|
||||
// 0 to 1
|
||||
const fuelConsumptionBonusMultipler = (profileFuelConsomptionBonusSum + 100) / 100;
|
||||
@ -612,22 +615,28 @@ export class HideoutHelper {
|
||||
pmcData: IPmcData,
|
||||
): void {
|
||||
let filterDrainRate = this.getWaterFilterDrainRate(pmcData);
|
||||
const productionTime = this.getTotalProductionTimeSeconds(HideoutHelper.waterCollector);
|
||||
const craftProductionTime = this.getTotalProductionTimeSeconds(HideoutHelper.waterCollector);
|
||||
const secondsSinceServerTick = this.getTimeElapsedSinceLastServerTick(pmcData, isGeneratorOn);
|
||||
|
||||
filterDrainRate = this.getTimeAdjustedWaterFilterDrainRate(
|
||||
secondsSinceServerTick,
|
||||
productionTime,
|
||||
craftProductionTime,
|
||||
production.Progress,
|
||||
filterDrainRate,
|
||||
);
|
||||
|
||||
// Production hasn't completed
|
||||
let pointsConsumed = 0;
|
||||
if (production.Progress < productionTime) {
|
||||
|
||||
// Check progress against the productions craft time (dont use base time as it doesnt include any time bonuses profile has)
|
||||
if (production.Progress > production.ProductionTime) {
|
||||
// Craft is complete nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
// Check all slots that take water filters until we find one with filter in it
|
||||
for (let i = 0; i < waterFilterArea.slots.length; i++) {
|
||||
// No water filter, skip
|
||||
// No water filter in slot, skip
|
||||
if (!waterFilterArea.slots[i].item) {
|
||||
continue;
|
||||
}
|
||||
@ -679,7 +688,6 @@ export class HideoutHelper {
|
||||
filterDrainRate = Math.abs(resourceValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an adjusted water filter drain rate based on time elapsed since last run,
|
||||
|
Loading…
Reference in New Issue
Block a user