From 7b6c7fdaae6ccc383daef68dbfdacf712e01171d Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 17 Mar 2025 14:47:02 +0100 Subject: [PATCH] ensure that first and second node are always different --- src/controllers/dynamic/worldStateController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/controllers/dynamic/worldStateController.ts b/src/controllers/dynamic/worldStateController.ts index 4560abec..8871fb83 100644 --- a/src/controllers/dynamic/worldStateController.ts +++ b/src/controllers/dynamic/worldStateController.ts @@ -137,6 +137,9 @@ export const worldStateController: RequestHandler = (req, res) => { } const rng = new CRng(week); + const firstNodeIndex = rng.randomInt(0, nodes.length - 1); + const firstNode = nodes[firstNodeIndex]; + nodes.splice(firstNodeIndex, 1); worldState.LiteSorties.push({ _id: { $oid: Math.trunc(weekStart / 1000).toString(16) + "5e23a244740a190c" @@ -155,7 +158,7 @@ export const worldStateController: RequestHandler = (req, res) => { "MT_SABOTAGE", "MT_RESCUE" ]), - node: rng.randomElement(nodes) + node: firstNode }, { missionType: rng.randomElement([