Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local modem = component.modem
- local robot = require("robot")
- local port = 222
- modem.open(port)
- while true do
- local e = { event.pull()}
- if e[1] == "modem_message" then
- if e[6] == "SServer->SRobot" then
- if e[7] == "DOIT" then
- for i = 1, 2 do
- robot.forward()
- end
- robot.suck(e[8])
- local ok
- if robot.count() == e[8] then
- ok = true
- else
- ok = false
- end
- modem.broadcast(port, "SRobot->SServer", "Taken", ok)
- if ok then
- robot.turnAround()
- for i = 1, 3 do
- robot.forward()
- end
- robot.drop(e[8])
- robot.turnAround()
- robot.forward()
- else
- robot.drop(64)
- robot.turnAround()
- for i = 1, 2 do
- robot.forward()
- end
- robot.turnAround()
- end
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment