Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ KillBot ]]
- local i = 0
- local status = false
- local suck = false
- local controller = 19
- direction = ""
- attackMethod = "attack" .. direction
- suckMethod = "suck" .. direction
- print("waiting")
- repeat
- rednet.open("left") -- turtle starts by idling until a rednet signal is received
- id, message = rednet.receive()
- if message == "stopfarm" then -- recognizes only message startfarm
- if status == true then
- print("stoped")
- rednet.send(controller, "stoped")
- rednet.close()
- shell.run(shell.getRunningProgram())
- else
- rednet.send(controller, "not running")
- rednet.close()
- shell.run(shell.getRunningProgram())
- end
- elseif message == "startfarm" then -- recognizes only message startfarm
- if status == false then
- print("started")
- rednet.send(controller, "started")
- rednet.close()
- status = true
- else
- rednet.send(controller, "running")
- rednet.close()
- end
- elseif message "status" then -- another alternative command that should tell the status of the turtle
- if redstone.getOutput("bottom") == false then
- rednet.send(controller, "inactive")
- rednet.close()
- shell.run(shell.getRunningProgram())
- else
- rednet.send(controller, "active")
- rednet.close()
- shell.run(shell.getRunningProgram())
- end
- end
- if status == true then
- print("attacking")
- _G["turtle"][attackMethod]()
- if suck == true then
- print("sucking")
- _G["turtle"][suckMethod]()
- if i == 10 then
- print("dropping")
- for c = 1, 16 do
- turtle.select(c)
- turtle.dropDown()
- end
- end
- i = i + 1
- end
- end
- until status == false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement