From 04edb19f144e6eaf106e5dadac1d24d751c51280 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 17 Jan 2024 22:17:12 +0000 Subject: [PATCH] Allow dogtags to be added to custom bots --- project/assets/configs/bot.json | 1 + project/src/generators/BotGenerator.ts | 14 ++++++++------ project/src/models/spt/config/IBotConfig.ts | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index 30becca4..b3d03cd4 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -311,6 +311,7 @@ }, "chanceAssaultScavHasPlayerScavName": 10, "secureContainerAmmoStackCount": 20, + "botRolesWithDogTags": ["sptbear", "sptusec"], "revenge": { "assault": ["assault", "marksman", "gifter"], "marksman": ["assault", "marksman", "gifter"], diff --git a/project/src/generators/BotGenerator.ts b/project/src/generators/BotGenerator.ts index a0b96e08..7c9c9bc2 100644 --- a/project/src/generators/BotGenerator.ts +++ b/project/src/generators/BotGenerator.ts @@ -218,10 +218,14 @@ export class BotGenerator if (this.botHelper.isBotPmc(botRole)) { this.getRandomisedGameVersionAndCategory(bot.Info); - bot = this.generateDogtag(bot); bot.Info.IsStreamerModeAvailable = true; // Set to true so client patches can pick it up later - client sometimes alters botrole to assaultGroup } + if (this.botConfig.botRolesWithDogTags.includes(botRole)) + { + this.addDogtagToBot(bot); + } + // generate new bot ID bot = this.generateId(bot); @@ -537,9 +541,9 @@ export class BotGenerator * @param bot bot to add dogtag to * @returns Bot with dogtag added */ - protected generateDogtag(bot: IBotBase): IBotBase + protected addDogtagToBot(bot: IBotBase): void { - const upd: Upd = { + const dogtagUpd: Upd = { SpawnedInSession: true, Dogtag: { AccountId: bot.sessionId, @@ -562,11 +566,9 @@ export class BotGenerator parentId: bot.Inventory.equipment, slotId: "Dogtag", location: undefined, - upd: upd, + upd: dogtagUpd, }; bot.Inventory.items.push(inventoryItem); - - return bot; } } diff --git a/project/src/models/spt/config/IBotConfig.ts b/project/src/models/spt/config/IBotConfig.ts index 643e9f68..acd1d165 100644 --- a/project/src/models/spt/config/IBotConfig.ts +++ b/project/src/models/spt/config/IBotConfig.ts @@ -37,6 +37,8 @@ export interface IBotConfig extends IBaseConfig chanceAssaultScavHasPlayerScavName: number; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Bot roles in this array will be given a dog tag on generation */ + botRolesWithDogTags: string[]; } /** Number of bots to generate and store in cache on raid start per bot type */