diff --git a/project/assets/configs/bot.json b/project/assets/configs/bot.json index c7c990bc..b5de7306 100644 --- a/project/assets/configs/bot.json +++ b/project/assets/configs/bot.json @@ -850,6 +850,7 @@ "lightIsActiveDayChancePercent": 25, "lightIsActiveNightChancePercent": 95, "laserIsActiveChancePercent": 85, + "forceOnlyArmoredRigWhenNoArmor": true, "filterPlatesByLevel": true, "randomisation": [ { diff --git a/project/src/generators/BotInventoryGenerator.ts b/project/src/generators/BotInventoryGenerator.ts index ffc3b9f9..fa541e27 100644 --- a/project/src/generators/BotInventoryGenerator.ts +++ b/project/src/generators/BotInventoryGenerator.ts @@ -238,6 +238,14 @@ export class BotInventoryGenerator botEquipmentConfig: botEquipConfig, randomisationDetails: randomistionDetails }); + + // Bot has no armor vest + if (botEquipConfig.forceOnlyArmoredRigWhenNoArmor && !botInventory.items.find(item => item.slotId === "ArmorVest")) + { + // Filter rigs down to only those with armor + this.filterRigsToOnlyThoseWithProtection(templateInventory); + } + this.generateEquipment({ rootEquipmentSlot: EquipmentSlots.TACTICAL_VEST, rootEquipmentPool: templateInventory.equipment.TacticalVest, @@ -251,6 +259,25 @@ export class BotInventoryGenerator }); } + /** + * Remove non-armored rigs from parameter data + * @param templateInventory + */ + protected filterRigsToOnlyThoseWithProtection(templateInventory: Inventory): void + { + const tacVestsWithArmor = Object.entries(templateInventory.equipment.TacticalVest) + .reduce((newVestDictionary, [tplKey]) => + { + if (this.itemHelper.getItem(tplKey)[1]._props.Slots?.length > 0) + { + newVestDictionary[tplKey] = templateInventory.equipment.TacticalVest[tplKey]; + } + return newVestDictionary; + }, {}); + + templateInventory.equipment.TacticalVest = tacVestsWithArmor; + } + /** * Add a piece of equipment with mods to inventory from the provided pools * @param settings Values to adjust how item is chosen and added to bot diff --git a/project/src/models/spt/config/IBotConfig.ts b/project/src/models/spt/config/IBotConfig.ts index acd1d165..d5babcb5 100644 --- a/project/src/models/spt/config/IBotConfig.ts +++ b/project/src/models/spt/config/IBotConfig.ts @@ -108,6 +108,7 @@ export interface EquipmentFilters nvgIsActiveChanceDayPercent?: number; /** Chance NODS are down/active during the night */ nvgIsActiveChanceNightPercent?: number; + forceOnlyArmoredRigWhenNoArmor?: boolean; /** Adjust weighting/chances of items on bot by level of bot */ randomisation: RandomisationDetails[]; /** Blacklist equipment by level of bot */