diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 7b188ef1..16096f06 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -740,7 +740,7 @@ export class HideoutController counterHoursCrafting.value = hoursCrafting; // Null production data now it's complete - will be cleaned up later by update() process - pmcData.Hideout.Production[prodId] = null; + pmcData.Hideout.Production[prodId].sptIsComplete = true; }; // Remove the old production from output object before its sent to client @@ -820,8 +820,8 @@ export class HideoutController const callback = () => { - // Null production data now it's complete - will be cleaned up later by update() process - pmcData.Hideout.Production[prodId] = null; + // Flag as complete - will be cleaned up later by update() process + pmcData.Hideout.Production[prodId].sptIsComplete = true; }; return this.inventoryHelper.addItem(pmcData, newReq, output, sessionID, callback, true); diff --git a/project/src/models/eft/common/tables/IBotBase.ts b/project/src/models/eft/common/tables/IBotBase.ts index aa23dc97..5190c225 100644 --- a/project/src/models/eft/common/tables/IBotBase.ts +++ b/project/src/models/eft/common/tables/IBotBase.ts @@ -389,6 +389,8 @@ export interface Productive /** Used when sending data to client */ NeedFuelForAllProductionTime?: boolean sptIsScavCase?: boolean + /** Some crafts are always inProgress, but need to be reset, e.g. water collector */ + sptIsComplete?: boolean } export interface Production extends Productive diff --git a/project/src/routers/EventOutputHolder.ts b/project/src/routers/EventOutputHolder.ts index 2e9ddf49..b3b1a079 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -92,6 +92,9 @@ export class EventOutputHolder profileChanges.production = this.getProductionsFromProfileAndFlagComplete(this.jsonUtil.clone(pmcData.Hideout.Production)); profileChanges.improvements = this.jsonUtil.clone(this.getImprovementsFromProfileAndFlagComplete(pmcData)); profileChanges.traderRelations = this.constructTraderRelations(pmcData.TradersInfo); + + // Fixes container craft from water collector not resetting after collection + this.resetSptIsCompleteFlaggedCrafts(pmcData.Hideout.Production); } /** @@ -160,6 +163,13 @@ export class EventOutputHolder continue; } + // Complete and is a water collector craft + // Needed as canister craft (water collector) is continuous + if (production.sptIsComplete && productionKey === "5d5589c1f934db045e6c5492") + { + continue; + } + // Skip completed if (!production.inProgress) { @@ -183,4 +193,22 @@ export class EventOutputHolder return productions; } + + /** + * Required as continuous productions don't reset and stay at 100% completion but client thinks it hasn't started + * @param productions Productions in a profile + */ + protected resetSptIsCompleteFlaggedCrafts(productions: Record): void + { + for (const productionKey in productions) + { + const production = productions[productionKey]; + if (production.sptIsComplete) + { + production.sptIsComplete = false; + production.Progress = 0; + production.StartTimestamp = this.timeUtil.getTimestamp(); + } + } + } }