Advertisement
Guest User

Reactor

a guest
Mar 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.06 KB | None | 0 0
  1. function updateInfo()
  2. --Reactor Info = RI
  3.  RI = peripheral.wrap("back")
  4.  Info = RI.getReactorInfo()
  5.  
  6. --Energysaturation
  7.  ES = math.floor(tonumber(Info.energySaturation)/100000+0.5)/100
  8.  
  9. --FuelConversionRate
  10.  FCR = math.floor(tonumber(Info.fuelConversionRate)+0.5)
  11.  
  12. --Temperature
  13.  Temp =  math.floor(tonumber(Info.temperature)+0.5)
  14.  
  15. --Status
  16.  Stat = Info.status
  17.  
  18. --Fuel%
  19.  FuelPerc = math.floor((tonumber(Info.fuelConversion)/tonumber(Info.maxFuelConversion)*10000)+0.5)/100
  20.  
  21. --RF/T
  22.  RFout = Info.generationRate
  23.  
  24. --Shield Strength
  25.  sS = math.floor(tonumber(Info.fieldStrength)/10000+0.5)/100-0.1
  26.  
  27. --tBar = Temperatur Bar
  28.  tBar = math.floor(tonumber(Temp)/8000*100/3.25+0.5)
  29.  
  30. --sSBar = Shield Stregth Bar
  31.  sSBar = tonumber(sS)*0.38
  32.  
  33. --ESBar = Energy Saturation Bar
  34.  ESBar = tonumber(ES)*0.38
  35.  
  36. --Fuel Conversion Bar
  37.  FCBar = tonumber(FuelPerc)*0.38
  38.  
  39. --function end
  40. end
  41.  
  42. --Screen
  43. while true do
  44.  updateInfo()
  45.  sleep(1)
  46.  term.setBackgroundColor(colors.black)
  47.  term.clear()
  48.  term.setCursorPos(1,1)
  49.  term.setTextColor(colors.white)
  50.  
  51. --Status
  52.  if Stat == "online" then
  53.   term.setCursorPos(34,1)
  54.   term.setTextColor(colors.green)
  55.   print("Online")
  56.  else
  57.   term.setCursorPos(33,1)
  58.   term.setTextColor(colors.red)
  59.   print("Offline")
  60.  end
  61.  
  62.  
  63.  
  64. --Temperature
  65.  term.setCursorPos(1,1)
  66.  term.setTextColor(colors.white)
  67.  print("Temperatur: ",Temp," C")
  68.  paintutils.drawLine(2,2,38,2,colors.gray)
  69.  
  70. --Color of Temperatur Bar
  71.  if tonumber(Temp) < 2000 then
  72.   paintutils.drawLine(2,2,tonumber(tBar),2,colors.blue)
  73.  
  74.  elseif tonumber(Temp) > 2000 and tonumber(Temp) <= 4000 then
  75.   paintutils.drawLine(2,2,tonumber(tBar),2,colors.yellow)
  76.  
  77.  elseif tonumber(Temp) > 4000 and tonumber(Temp) <= 6000 then
  78.   paintutils.drawLine(2,2,tonumber(tBar),2,colors.orange)
  79.  
  80.  elseif tonumber(Temp) > 6000 and tonumber(Temp) <= 8000 then
  81.   paintutils.drawLine(2,2,tonumber(tBar),2,colors.green)
  82.  
  83.  else
  84.   paintutils.drawLine(2,2,tonumber(tBar),2,colors.red)
  85.  end
  86.  
  87. --Shield Strength
  88.  term.setCursorPos(1,4)
  89.  term.setBackgroundColor(colors.black)
  90.  print("Shield Strength: ",sS,"%")
  91.  paintutils.drawLine(2,5,38,5,colors.gray)
  92.  
  93. --Color of Shield Strength Bar
  94.  if tonumber(sS) >= 0 and tonumber(sS) < 20 then
  95.   paintutils.drawLine(2,5,sSBar,5,colors.red)
  96.  
  97.  elseif tonumber(sS) >= 20 and tonumber(sS) < 40 then
  98.   paintutils.drawLine(2,5,sSBar,5,colors.orange)
  99.  
  100.  elseif tonumber(sS) >= 40 and tonumber(sS) < 60 then
  101.   paintutils.drawLine(2,5,sSBar,5,colors.green)
  102.  
  103.  elseif tonumber(sS) >= 60 and tonumber(sS) < 80 then
  104.   paintutils.drawLine(2,5,sSBar,5,colors.lightBlue)
  105.  
  106.  else
  107.   paintutils.drawLine(2,5,sSBar,5,colors.blue)
  108.  end
  109.  
  110. --Energy Saturation
  111.  term.setCursorPos(1,7)
  112.  term.setBackgroundColor(colors.black)
  113.  print("Energy Saturation: ",ES,"%")
  114.  paintutils.drawLine(2,8,38,8,colors.gray)
  115.  
  116. --Energy Saturation Bar
  117.  if tonumber(ES) >= 0 and tonumber(ES) < 10 then
  118.   paintutils.drawLine(2,8,ESBar,8,colors.red)
  119.  
  120.  elseif tonumber(ES) >= 10 and tonumber(ES) < 25 then
  121.   paintutils.drawLine(2,8,ESBar,8,colors.green)
  122.  
  123.  elseif tonumber(ES) >= 25 and tonumber(ES) < 50 then
  124.   paintutils.drawLine(2,8,ESBar,8,colors.lime)
  125.  
  126.  elseif tonumber(ES) >= 50 and tonumber(ES) < 75 then
  127.   paintutils.drawLine(2,8,ESBar,8,colors.lightBlue)
  128.  
  129.  else
  130.   paintutils.drawLine(2,8,ESBar,8,colors.blue)
  131.  
  132.  end
  133.  
  134. --Fuel Conversion
  135.  term.setCursorPos(1,10)
  136.  term.setBackgroundColor(colors.black)
  137.  print("Fuel Conversion Level: ",FuelPerc,"%")
  138.  paintutils.drawLine(2,11,38,11,colors.gray)
  139.  
  140. --Fuel Conversion Bar
  141.  if tonumber(FuelPerc) >= 0 and tonumber(FuelPerc) < 20 then
  142.   paintutils.drawLine(2,11,FCBar,11,colors.lightBlue)
  143.  
  144.  elseif tonumber(FuelPerc) >= 20 and tonumber(FuelPerc) < 40 then
  145.   paintutils.drawLine(2,11,FCBar,11,colors.lime)
  146.  
  147.  elseif tonumber(FuelPerc) >= 40 and tonumber(FuelPerc) < 60 then
  148.   paintutils.drawLine(2,11,FCBar,11,colors.green)
  149.  
  150.  elseif tonumber(FuelPerc) >= 60 and tonumber(FuelPerc) < 80 then
  151.   paintutils.drawLine(2,11,FCBar,11,colors.orange)
  152.  
  153.  else
  154.   paintutils.drawLine(2,11,FCBar,11,colors.red)
  155.  
  156.  end
  157.  
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement