Maybe fix quickstack recurse
This commit is contained in:
@@ -249,27 +249,13 @@ local function stackToContainer(item)
|
||||
itemTree = sortItemTree(itemTree)
|
||||
|
||||
local toMove = {}
|
||||
local total = 0
|
||||
utils.enqueueInventory(parentInventory, toMove, function(iterationItem)
|
||||
total = total + 1
|
||||
-- Get all items that aren't our mouseover item
|
||||
if iterationItem.Equals(item) then
|
||||
-- MyModGlobal.debugPrint(string.format("Skipping item: %s", iterationItem.Prefab.Identifier.Value))
|
||||
return false
|
||||
for slot in parentInventory.slots do
|
||||
for slotItem in slot.items do
|
||||
if slotItem.Prefab.Identifier.Value ~= item.Prefab.Identifier.Value then
|
||||
toMove[#toMove + 1] = slotItem
|
||||
end
|
||||
-- This won't work for nested containers
|
||||
-- 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))
|
||||
-- dump(toMove)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user