From 807ba049671dca000e2bfcd3e476dcf8fb813584 Mon Sep 17 00:00:00 2001 From: Refringe Date: Mon, 5 Feb 2024 19:16:36 -0500 Subject: [PATCH] Resolves Bot Generation Error - Resolves an issue in bot generation caused by a missing parameter when calling the `shouldModBeSpawned` method. - Adds a optional chaining operator within a condition to safeguard against undefined errors. Contributed by: barlog_m Thank you! :D --- project/src/generators/BotEquipmentModGenerator.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/src/generators/BotEquipmentModGenerator.ts b/project/src/generators/BotEquipmentModGenerator.ts index d5c0c6ef..f6f55c76 100644 --- a/project/src/generators/BotEquipmentModGenerator.ts +++ b/project/src/generators/BotEquipmentModGenerator.ts @@ -108,6 +108,7 @@ export class BotEquipmentModGenerator itemSlotTemplate, modSlotName.toLowerCase(), settings.spawnChances.equipmentMods, + settings.botEquipmentConfig, ); if (modSpawnResult === ModSpawn.SKIP && !forceSpawn) { @@ -725,7 +726,7 @@ export class BotEquipmentModGenerator return ModSpawn.SPAWN; } const spawnMod = this.probabilityHelper.rollChance(modSpawnChances[modSlot]); - if (!spawnMod && (slotRequired || botEquipConfig.weaponSlotIdsToMakeRequired.includes(modSlot))) + if (!spawnMod && (slotRequired || botEquipConfig.weaponSlotIdsToMakeRequired?.includes(modSlot))) { // Mod is required but spawn chance roll failed, choose default mod spawn for slot return ModSpawn.DEFAULT_MOD;