diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 2f617c55..5894bd4f 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -983,7 +983,7 @@ export class HideoutController * @param sessionId Session id * @param pmcData Profile with craft to cancel * @param request Cancel production request data - * @returns + * @returns IItemEventRouterResponse */ public cancelProduction(sessionId: string, pmcData: IPmcData, request: IHideoutCancelProductionRequestData): IItemEventRouterResponse { @@ -998,8 +998,8 @@ export class HideoutController return this.httpResponse.appendErrorToOutput(output, errorMessage); } - // Remove production from profile - delete pmcData.Hideout.Production[request.recipeId]; + // Null out production data so client gets informed when response send back + pmcData.Hideout.Production[request.recipeId] = null; // TODO - handle timestamp somehow? diff --git a/project/src/helpers/HideoutHelper.ts b/project/src/helpers/HideoutHelper.ts index d9eae624..5dcf48c5 100644 --- a/project/src/helpers/HideoutHelper.ts +++ b/project/src/helpers/HideoutHelper.ts @@ -227,6 +227,11 @@ export class HideoutHelper for (const prodId in pmcData.Hideout.Production) { const craft = pmcData.Hideout.Production[prodId]; + if (!craft) + { + // Craft value is null, get rid of it (could be from cancelling craft that needs cleaning up) + delete pmcData.Hideout.Production[prodId]; + } // Craft complete, skip processing (Don't skip continious crafts like bitcoin farm) if (craft.Progress >= craft.ProductionTime && prodId !== HideoutHelper.bitcoinFarm) diff --git a/project/src/routers/EventOutputHolder.ts b/project/src/routers/EventOutputHolder.ts index 0a57aa77..2e9ddf49 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -153,8 +153,14 @@ export class EventOutputHolder { for (const productionKey in productions) { - // Skip completed const production = productions[productionKey]; + if (!production) + { + // Could be cancelled production, skip item to save processing + continue; + } + + // Skip completed if (!production.inProgress) { continue;