From cdec8729aab8474e061482c70a47a7f55e6fc44d Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 23 Mar 2024 11:23:29 +0000 Subject: [PATCH] Fixed scav case never giving unarmored rigs as a reward --- project/src/generators/ScavCaseRewardGenerator.ts | 2 +- project/src/helpers/ItemHelper.ts | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/project/src/generators/ScavCaseRewardGenerator.ts b/project/src/generators/ScavCaseRewardGenerator.ts index a462820f..8328edd5 100644 --- a/project/src/generators/ScavCaseRewardGenerator.ts +++ b/project/src/generators/ScavCaseRewardGenerator.ts @@ -314,7 +314,7 @@ export class ScavCaseRewardGenerator } // Armor or weapon = use default preset from globals.json else if ( - this.itemHelper.armorItemCanHoldMods(rewardItemDb._id) + this.itemHelper.armorItemHasRemovableOrSoftInsertSlots(rewardItemDb._id) || this.itemHelper.isOfBaseclass(rewardItemDb._id, BaseClasses.WEAPON) ) { diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index 27a17a8d..a5d16f6c 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -106,6 +106,21 @@ export class ItemHelper return this.isOfBaseclasses(itemTpl, [BaseClasses.HEADWEAR, BaseClasses.VEST, BaseClasses.ARMOR]); } + /** + * Does the provided item tpl need soft/removable inserts to function + * @param itemTpl Armor item + * @returns True if item needs some kind of insert + */ + public armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean + { + if (!this.armorItemCanHoldMods(itemTpl)) + { + return false; + } + + return (this.armorItemHasRemovablePlateSlots(itemTpl) || this.itemRequiresSoftInserts(itemTpl)); + } + /** * Does the pased in tpl have ability to hold removable plate items * @param itemTpl item tpl to check for plate support