diff --git a/farm_control.lua b/farm_control.lua index 7ee626b..01613e0 100644 --- a/farm_control.lua +++ b/farm_control.lua @@ -6,11 +6,13 @@ LEVELS["minecraft:oak_log"] = {4 * 64, "minecraft:oak_sapling"} local STORAGE = "" local HARVESTER = "" +local PLANTER = "" local HARVESTER_RELAY = "" +local PLANTER_RELAY = "" -local SLEEP_TIME = 10 -local HARVESTER_SIGNAL_TIME = 2 +local SLEEP_TIME = 40 +local SIGNAL_TIME = 2 -------------------------------- PROGRAM -------------------------------------- @@ -51,13 +53,12 @@ function load_stack(item_name, src, dest) local src = peripheral.wrap(src) for slot, item in pairs(src.list()) do if item.name == item_name then - src.pushItems(dest, slot) - break + return src.pushItems(dest, slot) end end end -function send_harvester (relay_and_side) +function send_machine (relay_and_side) local RELAY_COMMAND = "setOutput" local relay, side = relay_and_side:match"(.+):(.+)" peripheral.call(relay, RELAY_COMMAND, side, true) @@ -72,10 +73,12 @@ while true do local needs_farming = check_levels(LEVELS, STORAGE) if needs_farming ~= nil then for _, item in ipairs(needs_farming) do - load_stack(item, STORAGE, HARVESTER) + load_stack(item, STORAGE, PLANTER) end + send_machine(PLANTER_RELAY) + os.sleep(SLEEP_TIME) end - send_harvester(HARVESTER_RELAY) + send_machine(HARVESTER_RELAY) os.sleep(SLEEP_TIME) pull_items(HARVESTER, STORAGE) end