When generating armors for static loot, try and use default preset first before generating randomly

This commit is contained in:
Dev 2024-02-06 23:00:39 +00:00
parent 1101927768
commit cb10ec4148

View File

@ -1093,14 +1093,28 @@ export class LocationGenerator
} }
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
{ {
// We make base item above, at start of function, no need to do it here const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl);
if (itemTemplate._props.Slots?.length > 0) if (defaultPreset)
{ {
items = this.itemHelper.addChildSlotItems( const presetAndMods: Item[] = this.itemHelper.replaceIDs(
items, null,
itemTemplate, this.jsonUtil.clone(defaultPreset._items),
this.locationConfig.equipmentLootSettings.modSpawnChancePercent,
); );
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,
);
}
} }
} }