Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. --[[ SpawnerController ]]--
  2. rednet.open("left") -- turtle starts by idling until a rednet signal is received
  3. id, message = rednet.receive()
  4. if message == "stopfarm" then -- recognizes only id 20 and message startfarm
  5. if redstone.getOutput("bottom") == true then
  6. rednet.send(20, "stoped")
  7. rednet.close()
  8. redstone.setOutput("bottom", true)
  9. sleep(1)
  10. shell.run(shell.getRunningProgram())
  11. else
  12. rednet.send(20, "not running")
  13. rednet.close()
  14. sleep(1)
  15. shell.run(shell.getRunningProgram())
  16. end
  17. elseif message == "startfarm" then -- recognizes only id 20 and message startfarm
  18. if redstone.getOutput("bottom") == false then
  19. rednet.send(20, "started")
  20. rednet.close()
  21. redstone.setOutput("bottom", true)
  22. sleep(1)
  23. shell.run(shell.getRunningProgram())
  24. else
  25. rednet.send(20, "running")
  26. rednet.close()
  27. sleep(1)
  28. shell.run(shell.getRunningProgram())
  29. end
  30. elseif message "status" then -- another alternative command that should tell the status of the turtle
  31. if redstone.getOutput("bottom") == false then
  32. rednet.send(20, "inactive")
  33. rednet.close()
  34. sleep(1)
  35. shell.run(shell.getRunningProgram())
  36. else
  37. rednet.send(20, "active")
  38. rednet.close()
  39. sleep(1)
  40. shell.run(shell.getRunningProgram())
  41. end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement