Remove extraneous code
This commit is contained in:
parent
53bfc85164
commit
a1bb89a4d2
@ -33,24 +33,20 @@ function pushDepositsToChests()
|
||||
for k,hopper in ipairs(hoppers) do
|
||||
-- For each item in that hopper's inventory...
|
||||
for hslot,hitem in pairs(hopper.list()) do
|
||||
local remaining = hitem["count"]
|
||||
-- For each connected "chest"...
|
||||
for k,chest in ipairs(chests) do
|
||||
-- First, make an attempt to find slots that we can shove the item into
|
||||
for cslot,citem in pairs(chest.list()) do
|
||||
if
|
||||
citem["name"] == hitem["name"] and -- We have the same item
|
||||
citem["count"] < chest.getItemLimit(cslot) and -- There's space in this slot
|
||||
remaining > 0 -- We still have things to sort
|
||||
citem["count"] < chest.getItemLimit(cslot) -- There's space in this slot
|
||||
then
|
||||
difference = chest.getItemLimit(cslot) - citem["count"]
|
||||
hopper.pushItems(peripheral.getName(chest),hslot,difference,cslot)
|
||||
remaining = remaining - difference
|
||||
hopper.pushItems(peripheral.getName(chest),hslot,hitem["count"],cslot)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- We've fallen through trying to fill up existing stacks. Fragmentation is not a concern, put it wherever
|
||||
if remaining > 0 then
|
||||
if hopper.getItemDetail(hslot) then
|
||||
for k,chest in ipairs(chests) do
|
||||
hopper.pushItems(peripheral.getName(chest),hslot)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user