Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sleepTime = 0.1
- timeLeft = 3
- function openGate()
- print("openGate started")
- timeLeft = 3
- rs.setOutput("top", true)
- oldTime = timeLeft
- while timeLeft > 0 do
- if timeLeft ~= oldTime then --if a new thread runs openGate, stop this thread
- return
- end
- sleep(sleepTime)
- timeLeft, oldTime = timeLeft - sleepTime
- end
- rs.setOutput("top", false)
- end
- while true do
- shell.run("clear")
- if rs.getInput("bottom") then
- print("redstone ON")
- print("creating coroutine")
- co = coroutine.create(openGate)
- coroutine.resume(co)
- else
- print("redstone OFF")
- end
- os.pullEvent("redstone")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement