Fixed Fence assort generation failing when a child item that can be stacked is found, do not allow child items to be stacked. only root items

This commit is contained in:
Dev 2024-03-30 15:06:12 +00:00
parent 467927afeb
commit df939c693f

View File

@ -656,10 +656,13 @@ export class FenceService
*/
protected getMatchingItem(rootItemBeingAdded: Item, itemDbDetails: ITemplateItem, fenceItemAssorts: Item[]): Item
{
const matchingItems = fenceItemAssorts.filter((item) => item._tpl === rootItemBeingAdded._tpl);
// Get matching root items
const matchingItems = fenceItemAssorts.filter((item) =>
item._tpl === rootItemBeingAdded._tpl && item.parentId === "hideout"
);
if (matchingItems.length === 0)
{
// Nothing matches by tpl, exit early
// Nothing matches by tpl and is root item, exit early
return null;
}
@ -717,6 +720,12 @@ export class FenceService
return false;
}
// Don't stack child items, only root items
if (existingItem.parentId !== "hideout")
{
return false;
}
// Item type in config list
return this.itemHelper.isOfBaseclasses(
itemDbDetails._id,