From 97994fc0a61aae4b9c4d4dca0bfecba0a50cf9d0 Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Sun, 18 Feb 2024 09:03:37 +0000 Subject: [PATCH] Handle `IsAlwaysSpawn` in the same way we handle `spawnpointsForced` to allow single spawn restrictions (!231) Also move the relaxation key single spawn limit to Streets instead of shoreline Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/231 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- project/assets/configs/location.json | 6 +++--- project/src/generators/LocationGenerator.ts | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/project/assets/configs/location.json b/project/assets/configs/location.json index 2a7ea202..9865b7fa 100644 --- a/project/assets/configs/location.json +++ b/project/assets/configs/location.json @@ -975,8 +975,7 @@ "64e74a4baac4cd0a7264ecdd" ], "shoreline": [ - "64e74a534d49d23b2c39d31b", - "6582dbf0b8d7830efc45016f" + "64e74a534d49d23b2c39d31b" ], "tarkovstreets": [ "638df4cc7b560b03794a18d2", @@ -998,7 +997,8 @@ "64f07f7726cfa02c506f8ac0", "64f69b4267e11a7c6206e010", "64f5b4f71a5f313cb144c06c", - "657acb2ac900be5902191ac9" + "657acb2ac900be5902191ac9", + "6582dbf0b8d7830efc45016f" ], "laboratory": [ "6398a4cfb5992f573c6562b3", diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index 55235bfd..33363136 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -593,9 +593,14 @@ export class LocationGenerator ): SpawnpointTemplate[] { const loot: SpawnpointTemplate[] = []; + const dynamicForcedSpawnPoints: SpawnpointsForced[] = []; - // Add all forced loot to return array - this.addForcedLoot(loot, dynamicLootDist.spawnpointsForced, locationName); + // Build the list of forced loot from both `spawnpointsForced` and any point marked `IsAlwaysSpawn` + dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpointsForced); + dynamicForcedSpawnPoints.push(...dynamicLootDist.spawnpoints.filter(point => point.template.IsAlwaysSpawn)); + + // Add forced loot + this.addForcedLoot(loot, dynamicForcedSpawnPoints, locationName); const allDynamicSpawnpoints = dynamicLootDist.spawnpoints; @@ -623,7 +628,13 @@ export class LocationGenerator continue; } - if (spawnpoint.probability === 1 || spawnpoint.template.IsAlwaysSpawn) + // We've handled IsAlwaysSpawn above, so skip them + if (spawnpoint.template.IsAlwaysSpawn) + { + continue; + } + + if (spawnpoint.probability === 1) { guaranteedLoosePoints.push(spawnpoint); continue;