From 2054a56620153f6a20d64a4020619742b9b8e8d6 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 29 Jul 2025 11:56:16 +0200 Subject: [PATCH 1/4] chore: log when worldState time is behind real time --- src/services/worldStateService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 7f5268c9..a3ec1bfa 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1336,6 +1336,12 @@ export const getWorldState = (buildLabel?: string): IWorldState => { } } const timeSecs = getIdealTimeSatsifyingConstraints(constraints); + if (constraints.length != 0) { + const delta = Math.trunc(Date.now() / 1000) - timeSecs; + if (delta != 0) { + logger.debug(`reported time is ${delta} seconds behind real time to satisfy selected constraints`); + } + } const timeMs = timeSecs * 1000; const day = Math.trunc((timeMs - EPOCH) / 86400000); const week = Math.trunc(day / 7); -- 2.47.2 From d0792fbf8eccd80c3428ea0c0dafe8d929ecbe08 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:05:20 +0200 Subject: [PATCH 2/4] say what constraints exactly --- src/services/worldStateService.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index a3ec1bfa..dbd021f5 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1038,13 +1038,13 @@ const pushVoidStorms = (arr: IVoidStorm[], hour: number): void => { }; interface ITimeConstraint { - //name: string; + name: string; isValidTime: (timeSecs: number) => boolean; getIdealTimeBefore: (timeSecs: number) => number; } const eidolonDayConstraint: ITimeConstraint = { - //name: "eidolon day", + name: "eidolon day", isValidTime: (timeSecs: number): boolean => { const eidolonEpoch = 1391992660; const eidolonCycle = Math.trunc((timeSecs - eidolonEpoch) / 9000); @@ -1062,7 +1062,7 @@ const eidolonDayConstraint: ITimeConstraint = { }; const eidolonNightConstraint: ITimeConstraint = { - //name: "eidolon night", + name: "eidolon night", isValidTime: (timeSecs: number): boolean => { const eidolonEpoch = 1391992660; const eidolonCycle = Math.trunc((timeSecs - eidolonEpoch) / 9000); @@ -1089,7 +1089,7 @@ const eidolonNightConstraint: ITimeConstraint = { }; const venusColdConstraint: ITimeConstraint = { - //name: "venus cold", + name: "venus cold", isValidTime: (timeSecs: number): boolean => { const vallisEpoch = 1541837628; const vallisCycle = Math.trunc((timeSecs - vallisEpoch) / 1600); @@ -1115,7 +1115,7 @@ const venusColdConstraint: ITimeConstraint = { }; const venusWarmConstraint: ITimeConstraint = { - //name: "venus warm", + name: "venus warm", isValidTime: (timeSecs: number): boolean => { const vallisEpoch = 1541837628; const vallisCycle = Math.trunc((timeSecs - vallisEpoch) / 1600); @@ -1321,7 +1321,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => { }); } else { constraints.push({ - //name: `duviri ${config.worldState.duviriOverride}`, + name: `duviri ${config.worldState.duviriOverride}`, isValidTime: (timeSecs: number): boolean => { const moodIndex = Math.trunc(timeSecs / 7200); return moodIndex % 5 == desiredMood; @@ -1339,7 +1339,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => { if (constraints.length != 0) { const delta = Math.trunc(Date.now() / 1000) - timeSecs; if (delta != 0) { - logger.debug(`reported time is ${delta} seconds behind real time to satisfy selected constraints`); + logger.debug( + `reported time is ${delta} seconds behind real time to satisfy selected constraints (${constraints.map(x => x.name).join(", ")})` + ); } } const timeMs = timeSecs * 1000; -- 2.47.2 From 62b9ed31bf5beca81e052922128ae31154ce5e8a Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:05:52 +0200 Subject: [PATCH 3/4] don't care if it's 1 second behind --- src/services/worldStateService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index dbd021f5..78b55cf5 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1338,7 +1338,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => { const timeSecs = getIdealTimeSatsifyingConstraints(constraints); if (constraints.length != 0) { const delta = Math.trunc(Date.now() / 1000) - timeSecs; - if (delta != 0) { + if (delta > 1) { logger.debug( `reported time is ${delta} seconds behind real time to satisfy selected constraints (${constraints.map(x => x.name).join(", ")})` ); -- 2.47.2 From a0953223f314b2db0da822b7144c7f4e4249dc93 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 29 Jul 2025 12:09:36 +0200 Subject: [PATCH 4/4] slightly better handling for fissures --- src/services/worldStateService.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 78b55cf5..ac4f9b5d 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1831,7 +1831,10 @@ export const populateFissures = async (worldState: IWorldState): Promise = _id: toOid(fissure._id), Region: meta.systemIndex + 1, Seed: 1337, - Activation: toMongoDate(fissure.Activation), + Activation: + fissure.Activation.getTime() < Date.now() // Activation is in the past? + ? { $date: { $numberLong: "1000000000000" } } // Let the client know 'explicitly' to avoid interference from time constraints. + : toMongoDate(fissure.Activation), Expiry: toMongoDate(fissure.Expiry), Node: fissure.Node, MissionType: eMissionType[meta.missionIndex].tag, -- 2.47.2