Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r = peripheral.wrap("back")
- rednet.open("right")
- local function send_response(id, response)
- rednet.send(id, response, "response")
- print("A response has been send to: " .. tostring(id))
- end
- while true do
- id,cmd = rednet.receive("cmd", 20480)
- if id == 4 then
- if cmd == "start" then
- if r.getActive() == true then
- print("The reactor is already active !")
- send_response(4, "The reactor is already active !")
- else
- r.setActive(true)
- print("The reactor has been enabled !")
- send_response(4, "Succesfuly started !")
- end
- else
- if cmd == "stop" then
- if r.getActive() == false then
- print("The reactor is already inactive !")
- send_response(4, "The reactor is already inactive !")
- else
- r.setActive(false)
- print("The reactor has been disabled !")
- send_response(4, "Succesfuly stopped !")
- end
- end
- end
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement