Maybe fix quickstack recurse

This commit is contained in:
2025-04-01 16:04:51 +02:00
parent a3f9cabf68
commit 07b42dfa05

View File

@@ -249,27 +249,13 @@ local function stackToContainer(item)
itemTree = sortItemTree(itemTree) itemTree = sortItemTree(itemTree)
local toMove = {} local toMove = {}
local total = 0 for slot in parentInventory.slots do
utils.enqueueInventory(parentInventory, toMove, function(iterationItem) for slotItem in slot.items do
total = total + 1 if slotItem.Prefab.Identifier.Value ~= item.Prefab.Identifier.Value then
-- Get all items that aren't our mouseover item toMove[#toMove + 1] = slotItem
if iterationItem.Equals(item) then end
-- MyModGlobal.debugPrint(string.format("Skipping item: %s", iterationItem.Prefab.Identifier.Value))
return false
end end
-- This won't work for nested containers end
-- But making it work with nested containers is a pain in the ass
-- So we'll just not do that for now
if iterationItem.ParentInventory and iterationItem.ParentInventory.Equals(itemInventory) then
-- MyModGlobal.debugPrint(string.format("Skipping item: %s", iterationItem.Prefab.Identifier.Value))
return false
end
if total >= 10000 then
MyModGlobal.debugPrint("Too many items to stack, stopping")
return false, true
end
return true
end)
MyModGlobal.debugPrint(string.format("Enqueued %d items to stack", #toMove)) MyModGlobal.debugPrint(string.format("Enqueued %d items to stack", #toMove))
-- dump(toMove) -- dump(toMove)