Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local vault = peripheral.wrap("left")
- local depot = peripheral.wrap("right")
- local debounce = 1.5
- depot = peripheral.getName(depot)
- local last_heat = os.time(os.date("!*t"))
- local cooldown = 0
- local last_press = os.time(os.date("!*t"))
- local state = 0
- local function find_item(str)
- for index, pack in pairs(vault.list()) do
- if string.find(pack.name, str) then
- return index
- end
- end
- end
- local function feed_coal()
- vault.pushItems(depot, find_item("coal"),1)
- end
- local function feed_blaze()
- vault.pushItems(depot, find_item("blaze_cake"),1)
- end
- local function check()
- if os.time(os.date("!*t")) < last_press + debounce then
- return
- end
- last_press = os.time(os.date("!*t"))
- if state == 0 then
- feed_coal()
- last_heat = os.time(os.date("!*t"))
- cooldown = 80
- state = 1
- elseif state == 1 then
- if os.time(os.date("!*t")) >= last_heat + cooldown then
- state = 0
- check()
- else
- feed_blaze()
- state = 2
- cooldown = 160
- last_heat = os.time(os.date("!*t"))
- end
- elseif state == 2 then
- if os.time(os.date("!*t")) >= last_heat + cooldown then
- state = 1
- last_heat = os.time(os.date("!*t"))
- end
- end
- end
- while true do
- os.pullEvent("redstone")
- check()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement