Advertisement
Hydroxios

Client

Dec 21st, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. r = peripheral.wrap("back")
  2. rednet.open("right")
  3.  
  4. local function send_response(id, response)
  5.     rednet.send(id, response, "response")
  6.     print("A response has been send to: " .. tostring(id))
  7. end
  8.  
  9. while true do
  10.     id,cmd = rednet.receive("cmd", 20480)
  11.     if id == 4 then
  12.         if cmd == "start" then
  13.             if r.getActive() == true then
  14.                 print("The reactor is already active !")
  15.                 send_response(4, "The reactor is already active !")
  16.             else
  17.                 r.setActive(true)
  18.                 print("The reactor has been enabled !")
  19.                 send_response(4, "Succesfuly started !")
  20.             end
  21.         else
  22.             if cmd == "stop" then
  23.                 if r.getActive() == false then
  24.                     print("The reactor is already inactive !")
  25.                     send_response(4, "The reactor is already inactive !")
  26.                 else
  27.                     r.setActive(false)
  28.                     print("The reactor has been disabled !")
  29.                     send_response(4, "Succesfuly stopped !")
  30.                 end
  31.             end
  32.         end
  33.     end
  34.     os.sleep(1)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement