Advertisement
Guest User

reactor

a guest
May 22nd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. rednet.open("back")
  2. term.setTextColor(colors.gray)
  3. term.write("Looking for reactor...")
  4. while true do
  5.  
  6.   -- PULL DATA
  7.   event, msg = rednet.receive("reactor_server")
  8.   energy = msg.energy
  9.   control = msg.control
  10.   active = msg.active
  11.  
  12.   -- GUI
  13.   term.clear()
  14.  
  15.   term.setTextColor(colors.yellow)
  16.   term.setCursorPos(1,1)
  17.   term.write("Reactor Client")
  18.   term.setCursorPos(1,2)
  19.  
  20.   if active then
  21.     term.setTextColor(colors.green)
  22.     term.write("Active")
  23.   else
  24.     term.setTextColor(colors.red)
  25.     term.write("Inactive")
  26.   end
  27.  
  28.   term.setCursorPos(1,3)
  29.   term.setTextColor(colors.orange)
  30.   term.write(tostring(energy) .. " RF")
  31.  
  32.   term.setCursorPos(1,4)
  33.   term.setTextColor(colors.lightBlue)
  34.   term.write("Control Rods @ " .. control .. "%")
  35.  
  36.   term.setCursorPos(1,5)
  37.   term.setTextColor(colors.pink)
  38.   term.write("Set ")
  39.   term.setTextColor(colors.white)
  40.   control = read()
  41.   if #control > 0 then
  42.     term.setTextColor(colors.gray)
  43.     term.write("...")  
  44.     rednet.broadcast(control, "reactor_client")
  45.     os.sleep(1)
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement