farm_control.lua: added logic to prevent extra planting

This commit is contained in:
Emerson Rosen-Jones 2025-11-20 19:05:14 -05:00
parent 6310e3f741
commit 4e0905b5f8

View file

@ -55,6 +55,12 @@ function check_levels (levels, src)
end end
end end
function empty_into (src, dest)
for slot, _ in pairs(peripheral.call(src, "list")) do
peripheral.call(src, "pushItems", dest, slot)
end
end
function load_stack(item_name, src, dest) function load_stack(item_name, src, dest)
local src = peripheral.wrap(src) local src = peripheral.wrap(src)
for slot, item in pairs(src.list()) do for slot, item in pairs(src.list()) do
@ -83,6 +89,7 @@ if arg[1] == "replant" then
end end
send_machine(PLANTER_RELAY) send_machine(PLANTER_RELAY)
os.sleep(SLEEP_TIME) os.sleep(SLEEP_TIME)
empty_into(PLANTER, STORAGE)
end end
send_machine(HARVESTER_RELAY) send_machine(HARVESTER_RELAY)
os.sleep(SLEEP_TIME) os.sleep(SLEEP_TIME)