thatparadox

RFtools Tele serv

Jul 22nd, 2021 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. for k,v in pairs(rs.getSides()) do
  2. if peripheral.getType(v) == "modem" then
  3. rednet.open(v)
  4. end
  5. end
  6.  
  7.  
  8. if fs.exists("floor") then
  9. file = fs.open("floor", "r")
  10. floor = file.readAll()
  11. file.close()
  12. else
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. print("Which number will this be on the monitor?")
  16. write("> ")
  17. floor = read()
  18. file = fs.open("floor", "w")
  19. file.write(floor)
  20. file.close()
  21. term.clear()
  22. term.setCursorPos(1,1)
  23. print("Thank you.")
  24. sleep(1)
  25. term.clear()
  26. term.setCursorPos(1,1)
  27. end
  28.  
  29. while true do
  30. id,message,proto = rednet.receive("teleport")
  31. touchData = textutils.unserialize(message)
  32. if touchData.sender == floor then
  33. rs.setOutput("left", true)
  34. sleep(0.5)
  35. rs.setOutput("left",false)
  36. end
  37. if touchData.destination == floor then
  38. rs.setOutput("right", true)
  39. sleep(0.5)
  40. rs.setOutput("right",false)
  41. end
  42. print(message)
  43. end
Add Comment
Please, Sign In to add comment