From d8fe9114645c56b6e1a40135f354953759932ff7 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 6 Feb 2024 23:17:41 +0000 Subject: [PATCH] Cleanup dynamic loot selection, armors have their children stored in loose loot json, use existing code to pull children out instead of generating it --- project/src/generators/LocationGenerator.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index c2173500..70e3da5c 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -833,7 +833,7 @@ export class LocationGenerator const itemTemplate = this.itemHelper.getItem(chosenTpl)[1]; // Item array to return - let itemWithMods: Item[] = []; + const itemWithMods: Item[] = []; // Money/Ammo - don't rely on items in spawnPoint.template.Items so we can randomise it ourselves if (this.itemHelper.isOfBaseclasses(chosenTpl, [BaseClasses.MONEY, BaseClasses.AMMO])) @@ -874,20 +874,9 @@ export class LocationGenerator itemWithMods.push(...magazineItem); } - else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) - { - itemWithMods.push({ _id: this.objectId.generate(), _tpl: chosenTpl }); - if (itemTemplate._props.Slots?.length > 0) - { - itemWithMods = this.itemHelper.addChildSlotItems( - itemWithMods, - itemTemplate, - this.locationConfig.equipmentLootSettings.modSpawnChancePercent, - ); - } - } else { + // Also used by armors to get child mods // Get item + children and add into array we return const itemWithChildren = this.itemHelper.findAndReturnChildrenAsItems( spawnPoint.template.Items,