From cb10ec4148f2685877b893d626c6ab1a7ab180bb Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 6 Feb 2024 23:00:39 +0000 Subject: [PATCH] When generating armors for static loot, try and use default preset first before generating randomly --- project/src/generators/LocationGenerator.ts | 26 ++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/project/src/generators/LocationGenerator.ts b/project/src/generators/LocationGenerator.ts index c19cbe38..c2173500 100644 --- a/project/src/generators/LocationGenerator.ts +++ b/project/src/generators/LocationGenerator.ts @@ -1093,14 +1093,28 @@ export class LocationGenerator } else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) { - // We make base item above, at start of function, no need to do it here - if (itemTemplate._props.Slots?.length > 0) + const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl); + if (defaultPreset) { - items = this.itemHelper.addChildSlotItems( - items, - itemTemplate, - this.locationConfig.equipmentLootSettings.modSpawnChancePercent, + const presetAndMods: Item[] = this.itemHelper.replaceIDs( + null, + this.jsonUtil.clone(defaultPreset._items), ); + this.itemHelper.remapRootItemId(presetAndMods); + + items = presetAndMods; + } + else + { + // We make base item above, at start of function, no need to do it here + if (itemTemplate._props.Slots?.length > 0) + { + items = this.itemHelper.addChildSlotItems( + items, + itemTemplate, + this.locationConfig.equipmentLootSettings.modSpawnChancePercent, + ); + } } }