From fd2b18371ff4b4f82f134abcedf2eb4f327f1159 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 30 Mar 2025 23:34:56 +0200 Subject: [PATCH] Fix quickstack --- QuickStackToBag/Lua/Cyka/quickstack.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/QuickStackToBag/Lua/Cyka/quickstack.lua b/QuickStackToBag/Lua/Cyka/quickstack.lua index 63dbe0e..bef8f32 100644 --- a/QuickStackToBag/Lua/Cyka/quickstack.lua +++ b/QuickStackToBag/Lua/Cyka/quickstack.lua @@ -322,10 +322,19 @@ local function stackToCursor() -- And it is much easier to let the game decide when we can not move -- Any more items (via return value of TryPutItem) -- And we then know that we can safely stop + -- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well + -- What other shit? Wish I knew + -- So we'll use HowManyCanBePut instead... local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil) if not moved then MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot .slotIndex - 1)) + -- return false, true + end + local maxFits = slot.inventory.HowManyCanBePut(ititem.Prefab, slot.slotIndex - 1) + if maxFits <= 0 then + MyModGlobal.debugPrint(string.format("Item %s has no more fits in slot %d", ititem.Name, slot + .slotIndex - 1)) return false, true end end @@ -358,10 +367,19 @@ local function stackAllToCursor() -- And it is much easier to let the game decide when we can not move -- Any more items (via return value of TryPutItem) -- And we then know that we can safely stop + -- UPDATE: OK well that was a stupid idea, it returns an error for other shit as well + -- What other shit? Wish I knew + -- So we'll use HowManyCanBePut instead... local moved = slot.inventory.TryPutItem(ititem, slot.slotIndex - 1, false, true, nil) if not moved then MyModGlobal.debugPrint(string.format("Failed to move item %s to slot %d", ititem.Name, slot .slotIndex - 1)) + -- return false, true + end + local maxFits = slot.inventory.HowManyCanBePut(ititem.Prefab, slot.slotIndex - 1) + if maxFits <= 0 then + MyModGlobal.debugPrint(string.format("Item %s has no more fits in slot %d", ititem.Name, slot + .slotIndex - 1)) return false, true end end