Split raider spawn chance override into 2 values, triggered and non triggered
This commit is contained in:
parent
7964d8ef5a
commit
a98696bfca
@ -538,5 +538,8 @@
|
|||||||
"mod_equipment": 5
|
"mod_equipment": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minReserveRaiderSpawnChance": 72
|
"reserveRaiderSpawnChanceOverrides": {
|
||||||
|
"nonTriggered": 80,
|
||||||
|
"triggered": 90
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,12 @@ export interface ILocationConfig extends IBaseConfig {
|
|||||||
/** Settings to adjust mods for lootable equipment in raid */
|
/** Settings to adjust mods for lootable equipment in raid */
|
||||||
equipmentLootSettings: IEquipmentLootSettings;
|
equipmentLootSettings: IEquipmentLootSettings;
|
||||||
/** min percentage to set raider spawns at, -1 makes no changes */
|
/** 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 {
|
export interface IEquipmentLootSettings {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ILocation } from "@spt/models/eft/common/ILocation";
|
import { ILocation } from "@spt/models/eft/common/ILocation";
|
||||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
|
import { ELocationName } from "@spt/models/enums/ELocationName";
|
||||||
import { Traders } from "@spt/models/enums/Traders";
|
import { Traders } from "@spt/models/enums/Traders";
|
||||||
import { Weapons } from "@spt/models/enums/Weapons";
|
import { Weapons } from "@spt/models/enums/Weapons";
|
||||||
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
@ -110,14 +111,23 @@ export class PostDbLoadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected adjustMinReserveRaiderSpawnChance(): void {
|
protected adjustMinReserveRaiderSpawnChance(): void {
|
||||||
if (this.locationConfig.minReserveRaiderSpawnChance === -1) {
|
// Get reserve base.json
|
||||||
return;
|
const reserveBase = this.databaseService.getLocation(ELocationName.RESERVE).base;
|
||||||
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
const reserveBase = this.databaseService.getLocation("rezervbase").base;
|
if (raiderSpawn.BossChance < newSpawnChance) {
|
||||||
for (const raiderSpawn of reserveBase.BossLocationSpawn.filter((x) => x.BossName === "pmcBot")) {
|
// Desired chance is bigger than existing, override it
|
||||||
if (raiderSpawn.BossChance < this.locationConfig.minReserveRaiderSpawnChance) {
|
raiderSpawn.BossChance = newSpawnChance;
|
||||||
raiderSpawn.BossChance = this.locationConfig.minReserveRaiderSpawnChance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user