Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("monitor_2")
- if not monitor then
- error("Monitor not found! Double check peripheral name.")
- end
- term.clear()
- term.setCursorPos(1,1)
- term.write("Running!")
- term.redirect(monitor)
- local switch = false
- local eng = {[true] = "ON", [false] = "OFF"}
- local timer = os.startTimer(0)
- local headsTimer = os.startTimer(300)
- local function oneThenTwo()
- rs.setOutput("bottom", true) --Build frame
- os.sleep(1)
- rs.setOutput("bottom", false)
- os.sleep(.5)
- rs.setOutput("right", true) --Build head
- os.sleep(1)
- rs.setOutput("right", false)
- end
- local function clearHeads()
- rs.setOutput("left", true)
- os.sleep(3)
- rs.setOutput("left", false)
- end
- local function termDraw()
- term.clear()
- term.setCursorPos(1,1)
- write("Wither Farm")
- term.setCursorPos(4, 4)
- write("\n STATUS: " .. eng[switch])
- end
- function Main()
- termDraw()
- while true do
- local e, p = os.pullEvent()
- if e == "timer" and p == timer then
- if switch then
- oneThenTwo()
- end
- timer = os.startTimer(2)
- elseif e == "timer" and p == headsTimer then
- if switch then
- clearHeads()
- end
- headsTimer = os.startTimer(300)
- elseif e == "monitor_touch" then
- switch = not switch
- Main()
- end
- end
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement