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