Update client barrel auto-sort to trigger only when items are present

This commit is contained in:
MayaTheShy
2026-03-16 18:33:16 -04:00
parent e6debef4fd
commit e8b2732692

View File

@@ -1384,12 +1384,18 @@ local function main()
end
end,
-- Task 4: Client barrel auto-sort (sends to master)
-- Task 4: Client barrel auto-sort (sends to master only when barrel has items)
function()
if CLIENT_BARREL_NAME == "" then return end
print("[OK] Client barrel: " .. CLIENT_BARREL_NAME)
while true do
sendToMaster({ type = "sort_barrel", barrelName = CLIENT_BARREL_NAME })
local barrel = peripheral.wrap(CLIENT_BARREL_NAME)
if barrel then
local contents = barrel.list()
if contents and next(contents) then
sendToMaster({ type = "sort_barrel", barrelName = CLIENT_BARREL_NAME })
end
end
sleep(2)
end
end,