From 07b42dfa05c2362a9dc36dc2b7753c4d21206a18 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 1 Apr 2025 16:04:51 +0200 Subject: [PATCH] Maybe fix quickstack recurse --- CykaQuick/Lua/Cyka/quickstack.lua | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/CykaQuick/Lua/Cyka/quickstack.lua b/CykaQuick/Lua/Cyka/quickstack.lua index f9697b6..c799e22 100644 --- a/CykaQuick/Lua/Cyka/quickstack.lua +++ b/CykaQuick/Lua/Cyka/quickstack.lua @@ -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 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) + end MyModGlobal.debugPrint(string.format("Enqueued %d items to stack", #toMove)) -- dump(toMove)