Advertisement
thadudexx

Untitled

Oct 23rd, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. --[[ KillBot ]]
  2. local i = 0
  3. local status = false
  4. local suck = false
  5. local controller = 19
  6. direction = ""
  7. attackMethod = "attack" .. direction
  8. suckMethod = "suck" .. direction
  9.  
  10. print("waiting")
  11. repeat
  12. rednet.open("left") -- turtle starts by idling until a rednet signal is received
  13. id, message = rednet.receive()
  14. if message == "stopfarm" then -- recognizes only message startfarm
  15. if status == true then
  16. print("stoped")
  17. rednet.send(controller, "stoped")
  18. rednet.close()
  19. shell.run(shell.getRunningProgram())
  20. else
  21. rednet.send(controller, "not running")
  22. rednet.close()
  23. shell.run(shell.getRunningProgram())
  24. end
  25. elseif message == "startfarm" then -- recognizes only message startfarm
  26. if status == false then
  27. print("started")
  28. rednet.send(controller, "started")
  29. rednet.close()
  30. status = true
  31. else
  32. rednet.send(controller, "running")
  33. rednet.close()
  34. end
  35. elseif message "status" then -- another alternative command that should tell the status of the turtle
  36. if redstone.getOutput("bottom") == false then
  37. rednet.send(controller, "inactive")
  38. rednet.close()
  39. shell.run(shell.getRunningProgram())
  40. else
  41. rednet.send(controller, "active")
  42. rednet.close()
  43. shell.run(shell.getRunningProgram())
  44. end
  45. end
  46. if status == true then
  47. print("attacking")
  48. _G["turtle"][attackMethod]()
  49. if suck == true then
  50. print("sucking")
  51. _G["turtle"][suckMethod]()
  52. if i == 10 then
  53. print("dropping")
  54. for c = 1, 16 do
  55. turtle.select(c)
  56. turtle.dropDown()
  57. end
  58. end
  59. i = i + 1
  60. end
  61. end
  62. until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement