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

@ -1092,6 +1092,19 @@ export class LocationGenerator
} }
} }
else if (this.itemHelper.armorItemCanHoldMods(chosenTpl)) else if (this.itemHelper.armorItemCanHoldMods(chosenTpl))
{
const defaultPreset = this.presetHelper.getDefaultPreset(chosenTpl);
if (defaultPreset)
{
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 // We make base item above, at start of function, no need to do it here
if (itemTemplate._props.Slots?.length > 0) if (itemTemplate._props.Slots?.length > 0)
@ -1103,6 +1116,7 @@ export class LocationGenerator
); );
} }
} }
}
return { items: items, width: width, height: height }; return { items: items, width: width, height: height };
} }