Add property to location config to allow adding bot min/max spawn limits for maps

Limit marksman on customs/woods/streets between 2 and 4, woods to 2 and 5
This commit is contained in:
Dev 2023-07-17 14:40:54 +01:00
parent 02d43d491c
commit ca48f0e83c
4 changed files with 68 additions and 3 deletions

View File

@ -647,7 +647,13 @@
"enabled": true, "enabled": true,
"ignoreMaps": ["base", "develop", "hideout", "privatearea", "suburbs", "terminal", "town"] "ignoreMaps": ["base", "develop", "hideout", "privatearea", "suburbs", "terminal", "town"]
}, },
"fitLootIntoContainerAttempts": 2 "fitLootIntoContainerAttempts": 2,
"addOpenZonesToAllMaps": true, "addOpenZonesToAllMaps": true,
"addCustomBotWavesToMaps": true, "addCustomBotWavesToMaps": true,
"enableBotTypeLimits": true,
"botTypeLimits": {
"tarkovstreets": [{"type": "marksman", "min": 2, "max": 4}],
"woods": [{"type": "marksman", "min": 2, "max": 5}],
"bigmap": [{"type": "marksman", "min": 2, "max": 4}]
}
} }

View File

@ -89,6 +89,11 @@ export class GameController
this.customLocationWaveService.applyWaveChangesToAllMaps(); this.customLocationWaveService.applyWaveChangesToAllMaps();
} }
if (this.locationConfig.enableBotTypeLimits)
{
this.adjustMapBotLimits();
}
// repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in offraidData) // repeatableQuests are stored by in profile.Quests due to the responses of the client (e.g. Quests in offraidData)
// Since we don't want to clutter the Quests list, we need to remove all completed (failed / successful) repeatable quests. // Since we don't want to clutter the Quests list, we need to remove all completed (failed / successful) repeatable quests.
// We also have to remove the Counters from the repeatableQuests // We also have to remove the Counters from the repeatableQuests
@ -167,6 +172,49 @@ export class GameController
} }
} }
protected adjustMapBotLimits(): void
{
const mapsDb = this.databaseServer.getTables().locations;
if (!this.locationConfig.botTypeLimits)
{
return;
}
for (const mapId in this.locationConfig.botTypeLimits)
{
const map: ILocationData = mapsDb[mapId];
if (!map)
{
this.logger.warning(`Unable to edit bot limits of map: ${mapId} as it cannot be found`);
}
for (const botToLimit of this.locationConfig.botTypeLimits[mapId])
{
const index = map.base.MinMaxBots.findIndex(x => x.WildSpawnType === botToLimit.type);
if (index !== -1)
{
// Existing bot type found in MinMaxBots array, edit
const limitObjectToUpdate = map.base.MinMaxBots[index];
limitObjectToUpdate.min = botToLimit.min;
limitObjectToUpdate.max = botToLimit.max;
}
else
{
map.base.MinMaxBots.push(
{
// Bot type not found, add new object
WildSpawnType: botToLimit.type,
min: botToLimit.min,
max: botToLimit.max
}
);
}
}
}
}
/** /**
* Handle client/game/config * Handle client/game/config
*/ */

View File

@ -160,7 +160,7 @@ export interface BotLocationModifier
export interface MinMaxBot export interface MinMaxBot
{ {
WildSpawnType: WildSpawnType WildSpawnType: WildSpawnType | string
max: number max: number
min: number min: number
} }
@ -250,5 +250,6 @@ export interface Wave
export enum WildSpawnType export enum WildSpawnType
{ {
ASSAULT = "assault", ASSAULT = "assault",
MARKSMAN = "marksman" MARKSMAN = "marksman",
PMCBOT = "pmcbot"
} }

View File

@ -20,6 +20,9 @@ export interface ILocationConfig extends IBaseConfig
addOpenZonesToAllMaps: boolean addOpenZonesToAllMaps: boolean
/** Allow addition of custom bot waves designed by SPT to be added to maps - defined in configs/location.json.customWaves*/ /** Allow addition of custom bot waves designed by SPT to be added to maps - defined in configs/location.json.customWaves*/
addCustomBotWavesToMaps: boolean addCustomBotWavesToMaps: boolean
enableBotTypeLimits: boolean
/** Add limits to a maps base.MinMaxBots array*/
botTypeLimits: Record<string, IBotTypeLimit[]>
} }
export interface IFixEmptyBotWavesSettings export interface IFixEmptyBotWavesSettings
@ -47,6 +50,13 @@ export interface CustomWaves
normal: Record<string, Wave[]> normal: Record<string, Wave[]>
} }
export interface IBotTypeLimit
{
type: string
min: number
max: number
}
export interface LootMultiplier export interface LootMultiplier
{ {
bigmap: number bigmap: number