From 2d57bdb0effc6bfeea0311f2b984e998b99d2dd5 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 27 Jul 2023 12:15:06 +0100 Subject: [PATCH] Add option to force healing items into PMCs secure Make bots heal to a 90% instead of 65% Log when item cannot fit into container when genning bots --- project/assets/database/bots/types/bear.json | 8 ++-- project/assets/database/bots/types/usec.json | 8 ++-- project/src/generators/BotLootGenerator.ts | 47 +++++++++++++++++++ .../src/helpers/BotWeaponGeneratorHelper.ts | 4 ++ project/src/models/spt/config/IPmcConfig.ts | 2 + 5 files changed, 61 insertions(+), 8 deletions(-) diff --git a/project/assets/database/bots/types/bear.json b/project/assets/database/bots/types/bear.json index 26a9dceb..6eacfef0 100644 --- a/project/assets/database/bots/types/bear.json +++ b/project/assets/database/bots/types/bear.json @@ -475,7 +475,7 @@ "MIN_SHOOTS_TIME": 3, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.90, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -972,7 +972,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.90, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -1469,7 +1469,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.90, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -1968,7 +1968,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.90, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, diff --git a/project/assets/database/bots/types/usec.json b/project/assets/database/bots/types/usec.json index 13c7e506..a1b2a247 100644 --- a/project/assets/database/bots/types/usec.json +++ b/project/assets/database/bots/types/usec.json @@ -475,7 +475,7 @@ "MIN_SHOOTS_TIME": 3, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.9, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -972,7 +972,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.9, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -1469,7 +1469,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.9, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, @@ -1968,7 +1968,7 @@ "MIN_SHOOTS_TIME": 2, "MIN_START_AGGRESION_COEF": 1, "NO_RUN_AWAY_FOR_SAFE": true, - "PART_PERCENT_TO_HEAL": 0.65, + "PART_PERCENT_TO_HEAL": 0.9, "PISTOL_SHOTGUN_AMBUSH_DIST": 30, "PROTECT_DELTA_HEAL_SEC": 10, "PROTECT_TIME_REAL": true, diff --git a/project/src/generators/BotLootGenerator.ts b/project/src/generators/BotLootGenerator.ts index 643c07f9..a6f933eb 100644 --- a/project/src/generators/BotLootGenerator.ts +++ b/project/src/generators/BotLootGenerator.ts @@ -73,6 +73,12 @@ export class BotLootGenerator const stimItemCount = this.getRandomisedCount(itemCounts.stims.min, itemCounts.stims.max, 3); const grenadeCount = this.getRandomisedCount(itemCounts.grenades.min, itemCounts.grenades.max, 4); + // Forced pmc healing loot + if (isPmc) + { + this.addForcedMedicalItemsToPmcSecure(botInventory, botRole); + } + // Special items this.addLootFromPool( this.botLootCacheService.getLootFromCache(botRole, isPmc, LootCacheType.SPECIAL, botJsonTemplate), @@ -169,6 +175,47 @@ export class BotLootGenerator isPmc); } + /** + * Force healing items onto bot to ensure they can heal in-raid + * @param botInventory Inventory to add items to + * @param botRole Role of bot (sptBear/sptUsec) + */ + protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void + { + const grizzly = this.itemHelper.getItem("590c657e86f77412b013051d")[1]; + this.addLootFromPool( + [grizzly], + [EquipmentSlots.SECURED_CONTAINER], + 2, + botInventory, + botRole, + false, + 0, + true); + + const surv12 = this.itemHelper.getItem("5d02797c86f774203f38e30a")[1]; + this.addLootFromPool( + [surv12], + [EquipmentSlots.SECURED_CONTAINER], + 1, + botInventory, + botRole, + false, + 0, + true); + + const morphine = this.itemHelper.getItem("544fb3f34bdc2d03748b456a")[1]; + this.addLootFromPool( + [morphine], + [EquipmentSlots.SECURED_CONTAINER], + 3, + botInventory, + botRole, + false, + 0, + true); + } + protected getRandomisedCount(min: number, max: number, nValue: number): number { const range = max - min; diff --git a/project/src/helpers/BotWeaponGeneratorHelper.ts b/project/src/helpers/BotWeaponGeneratorHelper.ts index 497558da..28c121b1 100644 --- a/project/src/helpers/BotWeaponGeneratorHelper.ts +++ b/project/src/helpers/BotWeaponGeneratorHelper.ts @@ -231,6 +231,10 @@ export class BotWeaponGeneratorHelper inventory.items.push(...itemWithChildren); return true; } + else + { + this.logger.warning(`Unable to find space in container: ${container.slotId} item: ${itemWithChildren[0]._tpl}`); + } } } diff --git a/project/src/models/spt/config/IPmcConfig.ts b/project/src/models/spt/config/IPmcConfig.ts index db1c0fc6..0c28f633 100644 --- a/project/src/models/spt/config/IPmcConfig.ts +++ b/project/src/models/spt/config/IPmcConfig.ts @@ -40,6 +40,8 @@ export interface IPmcConfig enemyTypes: string[] /** How many levels above player level can a PMC be */ botRelativeLevelDeltaMax: number + /** Force a number of healing items into PMCs secure container to ensure they can heal */ + forceHealingItemsIntoSecure: boolean; } export interface PmcTypes