Advertisement
goldfiction

em2_mc

Mar 11th, 2022
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. local function delay(seconds)
  2. -- safe version of 'sleep' - will requeue dropped events
  3. local timer = os.startTimer(seconds)
  4. local q = {}
  5. while true do
  6. local data = {os.pullEvent()}
  7. if data[1] == "timer" and data[2] == timer then
  8. break
  9. else
  10. table.insert(q, data)
  11. end
  12. end
  13. for i,v in ipairs(q) do
  14. os.queueEvent(unpack(v))
  15. end
  16. end
  17.  
  18. while true do
  19. redstone.setOutput("back", true)
  20. delay(0.5)
  21. redstone.setOutput("back", false)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement