Call availableCount as instance function

This commit is contained in:
Gabriel Tofvesson 2025-05-15 18:09:00 +02:00
parent 04183cce80
commit 87ce5758e6

View File

@ -20,7 +20,7 @@ function prototype:defragment(chests)
-- Find largest non-full stack
for i=top,bottom,-1 do
local entry = self[i]
if entry:getStack(chests).availableCount() ~= 0 then
if entry:getStack(chests):availableCount() ~= 0 then
top = i
break
else
@ -32,7 +32,7 @@ function prototype:defragment(chests)
local topEntry = self[top]
local bottomEntry = self[bottom]
local txCap = math.min(bottomEntry.count, topEntry:getStack(chests).availableCount())
local txCap = math.min(bottomEntry.count, topEntry:getStack(chests):availableCount())
local tx = bottomEntry:getChest(chests):moveItemsTo(txCap, bottomEntry.slot, topEntry:getChest(chests), topEntry.slot)
if tx ~= txCap then
@ -51,7 +51,7 @@ function prototype:defragment(chests)
bottom = bottom + 1
end
if topEntry:getStack(chests).availableCount() == 0 then
if topEntry:getStack(chests):availableCount() == 0 then
top = top - 1
resultGroup[#resultGroup + 1] = topEntry
end