Call availableCount as instance function
This commit is contained in:
parent
04183cce80
commit
87ce5758e6
@ -20,7 +20,7 @@ function prototype:defragment(chests)
|
|||||||
-- Find largest non-full stack
|
-- Find largest non-full stack
|
||||||
for i=top,bottom,-1 do
|
for i=top,bottom,-1 do
|
||||||
local entry = self[i]
|
local entry = self[i]
|
||||||
if entry:getStack(chests).availableCount() ~= 0 then
|
if entry:getStack(chests):availableCount() ~= 0 then
|
||||||
top = i
|
top = i
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
@ -32,7 +32,7 @@ function prototype:defragment(chests)
|
|||||||
local topEntry = self[top]
|
local topEntry = self[top]
|
||||||
local bottomEntry = self[bottom]
|
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)
|
local tx = bottomEntry:getChest(chests):moveItemsTo(txCap, bottomEntry.slot, topEntry:getChest(chests), topEntry.slot)
|
||||||
|
|
||||||
if tx ~= txCap then
|
if tx ~= txCap then
|
||||||
@ -51,7 +51,7 @@ function prototype:defragment(chests)
|
|||||||
bottom = bottom + 1
|
bottom = bottom + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if topEntry:getStack(chests).availableCount() == 0 then
|
if topEntry:getStack(chests):availableCount() == 0 then
|
||||||
top = top - 1
|
top = top - 1
|
||||||
resultGroup[#resultGroup + 1] = topEntry
|
resultGroup[#resultGroup + 1] = topEntry
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user