Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ SpawnerController ]]--
- rednet.open("left") -- turtle starts by idling until a rednet signal is received
- id, message = rednet.receive()
- if message == "stopfarm" then -- recognizes only id 20 and message startfarm
- if redstone.getOutput("bottom") == true then
- rednet.send(20, "stoped")
- rednet.close()
- redstone.setOutput("bottom", true)
- sleep(1)
- shell.run(shell.getRunningProgram())
- else
- rednet.send(20, "not running")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- elseif message == "startfarm" then -- recognizes only id 20 and message startfarm
- if redstone.getOutput("bottom") == false then
- rednet.send(20, "started")
- rednet.close()
- redstone.setOutput("bottom", true)
- sleep(1)
- shell.run(shell.getRunningProgram())
- else
- rednet.send(20, "running")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- elseif message "status" then -- another alternative command that should tell the status of the turtle
- if redstone.getOutput("bottom") == false then
- rednet.send(20, "inactive")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- else
- rednet.send(20, "active")
- rednet.close()
- sleep(1)
- shell.run(shell.getRunningProgram())
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement