diff --git a/project/assets/configs/location.json b/project/assets/configs/location.json index 46c89450..c92a11a1 100644 --- a/project/assets/configs/location.json +++ b/project/assets/configs/location.json @@ -538,5 +538,8 @@ "mod_equipment": 5 } }, - "minReserveRaiderSpawnChance": 72 + "reserveRaiderSpawnChanceOverrides": { + "nonTriggered": 80, + "triggered": 90 + } } diff --git a/project/src/models/spt/config/ILocationConfig.ts b/project/src/models/spt/config/ILocationConfig.ts index 26a08684..bd296fab 100644 --- a/project/src/models/spt/config/ILocationConfig.ts +++ b/project/src/models/spt/config/ILocationConfig.ts @@ -44,7 +44,12 @@ export interface ILocationConfig extends IBaseConfig { /** Settings to adjust mods for lootable equipment in raid */ equipmentLootSettings: IEquipmentLootSettings; /** min percentage to set raider spawns at, -1 makes no changes */ - minReserveRaiderSpawnChance: number; + reserveRaiderSpawnChanceOverrides: IReserveRaiderSpawnChanceOverrides; +} + +export interface IReserveRaiderSpawnChanceOverrides { + nonTriggered: number; + triggered: number; } export interface IEquipmentLootSettings { diff --git a/project/src/services/PostDbLoadService.ts b/project/src/services/PostDbLoadService.ts index 7f1fe24e..0b81e4ca 100644 --- a/project/src/services/PostDbLoadService.ts +++ b/project/src/services/PostDbLoadService.ts @@ -1,5 +1,6 @@ import { ILocation } from "@spt/models/eft/common/ILocation"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; +import { ELocationName } from "@spt/models/enums/ELocationName"; import { Traders } from "@spt/models/enums/Traders"; import { Weapons } from "@spt/models/enums/Weapons"; import { IBotConfig } from "@spt/models/spt/config/IBotConfig"; @@ -110,14 +111,23 @@ export class PostDbLoadService { } protected adjustMinReserveRaiderSpawnChance(): void { - if (this.locationConfig.minReserveRaiderSpawnChance === -1) { - return; - } + // Get reserve base.json + const reserveBase = this.databaseService.getLocation(ELocationName.RESERVE).base; - const reserveBase = this.databaseService.getLocation("rezervbase").base; - for (const raiderSpawn of reserveBase.BossLocationSpawn.filter((x) => x.BossName === "pmcBot")) { - if (raiderSpawn.BossChance < this.locationConfig.minReserveRaiderSpawnChance) { - raiderSpawn.BossChance = this.locationConfig.minReserveRaiderSpawnChance; + // Raiders are bosses, get only those from boss spawn array + for (const raiderSpawn of reserveBase.BossLocationSpawn.filter((boss) => boss.BossName === "pmcBot")) { + const isTriggered = raiderSpawn.TriggerId.length > 0; // Empty string if not triggered + const newSpawnChance = isTriggered + ? this.locationConfig.reserveRaiderSpawnChanceOverrides.triggered + : this.locationConfig.reserveRaiderSpawnChanceOverrides.nonTriggered; + + if (newSpawnChance === -1) { + continue; + } + + if (raiderSpawn.BossChance < newSpawnChance) { + // Desired chance is bigger than existing, override it + raiderSpawn.BossChance = newSpawnChance; } } }