Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RUNNING = true
- local OPENING = false
- local CLOSING = false
- local STATE = "closed"
- function open(autoClose)
- if OPENING or CLOSING then
- return
- end
- print("OPENING")
- CLOSING = false
- OPENING = true
- rs.setOutput("top", true)
- os.sleep(0.2)
- rs.setOutput("top", false)
- os.sleep(0.7)
- print(".")
- rs.setOutput("top", true)
- os.sleep(0.2)
- rs.setOutput("top", false)
- os.sleep(0.7)
- print(". .")
- rs.setOutput("top", true)
- os.sleep(0.2)
- rs.setOutput("top", false)
- os.sleep(0.7)
- print(". . .")
- rs.setOutput("top", true)
- os.sleep(0.2)
- rs.setOutput("top", false)
- os.sleep(0.7)
- print(". . . .")
- OPENING = false
- STATE = "opened"
- if autoClose then
- sleep(3)
- close()
- end
- end
- function close()
- if OPENING or CLOSING then
- return
- end
- OPENING = false
- CLOSING = true
- print("CLOSING")
- rs.setOutput("bottom", true)
- os.sleep(0.2)
- rs.setOutput("bottom", false)
- os.sleep(0.7)
- print(".")
- rs.setOutput("bottom", true)
- os.sleep(0.2)
- rs.setOutput("bottom", false)
- os.sleep(0.7)
- print(". .")
- rs.setOutput("bottom", true)
- os.sleep(0.2)
- rs.setOutput("bottom", false)
- os.sleep(0.7)
- print(". . .")
- rs.setOutput("bottom", true)
- os.sleep(0.2)
- rs.setOutput("bottom", false)
- os.sleep(0.7)
- print(". . . .")
- CLOSING = false
- STATE = "closed"
- end
- term.clear()
- while RUNNING do
- local type = os.pullEvent("redstone")
- if not OPENING and not CLOSING then
- if rs.getInput("back") or rs.getInput("front") then
- if STATE == "closed" then
- open(true)
- else
- close()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement