From bcb40c833356b3fa578fff7258820348a6cb2c81 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 4 Jun 2024 19:23:37 +0100 Subject: [PATCH] Fixed hideout crafts causing server failure --- project/src/routers/EventOutputHolder.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/project/src/routers/EventOutputHolder.ts b/project/src/routers/EventOutputHolder.ts index 07c44ff9..893fe7b0 100644 --- a/project/src/routers/EventOutputHolder.ts +++ b/project/src/routers/EventOutputHolder.ts @@ -171,7 +171,14 @@ export class EventOutputHolder } // Client informed of craft, remove from data returned - const storageForSessionId = this.clientActiveSessionStorage[sessionId]; + let storageForSessionId = this.clientActiveSessionStorage[sessionId]; + if (typeof storageForSessionId === "undefined") + { + this.clientActiveSessionStorage[sessionId] = {}; + storageForSessionId = this.clientActiveSessionStorage[sessionId]; + } + + // Ensure we don't inform client of production again if (storageForSessionId[productionKey]?.clientInformed) { delete productions[productionKey]; @@ -179,7 +186,7 @@ export class EventOutputHolder continue; } - // Flag started craft as having been seen by client + // Flag started craft as having been seen by client so it won't happen subsequent times if (production.Progress > 0 && !storageForSessionId[productionKey]?.clientInformed) { storageForSessionId[productionKey] = { clientInformed: true };