Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. args = {...}
  2. modem = peripheral.wrap("back")
  3. modem.open(235)
  4.  
  5. if #args > 0 and args[1] == "status" then
  6.   while true do
  7.     _,_,_,_,mesg,_ = os.pullEvent("modem_message")
  8.     data = {}
  9.     for i in string.gmatch(mesg,"([^,%s]+)") do
  10.       data[#data+1] = i
  11.     end
  12.     power = tonumber(data[2])
  13.     energy = tonumber(data[3])
  14.     f_rate = tonumber(data[4])
  15.     fuel = tonumber(data[5])
  16.     rod_level = tonumber(data[6])
  17.     term.clear()
  18.     term.setCursorPos(1,1)
  19.     term.write("Reactor: ")
  20.     if data[1] == "true" then
  21.       term.setTextColor(colors.green)
  22.       term.write("Active")
  23.     else
  24.       term.setTextColor(colors.red)
  25.       term.write("Inactive")
  26.     end
  27.     term.setTextColor(colors.white)
  28.     term.setCursorPos(1,3)
  29.     term.write("Energy: ")
  30.     if energy < 10 then
  31.       term.setTextColor(colors.red)
  32.     elseif energy < 50 then
  33.       term.setTextColor(colors.orange)
  34.     elseif energy < 70 then
  35.       term.setTextColor(colors.yellow)
  36.     else
  37.       term.setTextColor(colors.green)
  38.     end
  39.     term.write(tostring(energy).."%")
  40.     term.setTextColor(colors.white)
  41.     term.setCursorPos(1,4)
  42.     term.write("Power: " .. tostring(power) .."K RF/t")
  43.     term.setCursorPos(1,5)
  44.     term.write("Fuel: ")
  45.     if fuel < 10 then
  46.       term.setTextColor(colors.red)
  47.     elseif fuel < 50 then
  48.       term.setTextColor(colors.orange)
  49.     elseif fuel < 70 then
  50.       term.setTextColor(colors.yellow)
  51.     else
  52.       term.setTextColor(colors.green)
  53.     end
  54.     term.write(tostring(fuel).."%")
  55.     term.setTextColor(colors.white)
  56.     term.setCursorPos(1,7)
  57.     term.write("Fuel Burnup: "..tostring(f_rate).."mB/t")
  58.   end
  59. else
  60.   command = ""
  61.   for _,arg in pairs(args) do
  62.     command = command.." "..arg
  63.   end
  64.   --print(command)
  65.   modem.transmit(233,235,command)
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement