Compare commits

..

No commits in common. "a1bb89a4d244d6c5807f640d6ebaa771cbc33559" and "bcbb419179e3005876e8c89c98068e7337f4673b" have entirely different histories.

View File

@ -6,6 +6,9 @@
-- Startup diagnostics -- Startup diagnostics
print("Salt's CC Storage Net") print("Salt's CC Storage Net")
-- Required libraries
local basalt = require("basalt") -- wget run https://basalt.madefor.cc/install.lua release latest.lua
-- Global scope locals -- Global scope locals
local output = peripheral.wrap("top") or error("Put a chest on top of this terminal for output items", 0) local output = peripheral.wrap("top") or error("Put a chest on top of this terminal for output items", 0)
@ -35,21 +38,8 @@ function pushDepositsToChests()
for hslot,hitem in pairs(hopper.list()) do for hslot,hitem in pairs(hopper.list()) do
-- 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 -- Attempt to push our items in
for cslot,citem in pairs(chest.list()) do hopper.pushItems(peripheral.getName(chest),hslot)
if
citem["name"] == hitem["name"] and -- We have the same item
citem["count"] < chest.getItemLimit(cslot) -- There's space in this slot
then
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 hopper.getItemDetail(hslot) then
for k,chest in ipairs(chests) do
hopper.pushItems(peripheral.getName(chest),hslot)
end
end end
end end
end end