Advertisement
Noobular

Big Reactors Management 2

Mar 30th, 2015
1,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.70 KB | None | 0 0
  1. --------------------------------------------------------------------------------------------
  2. term.clear()
  3. term.setCursorPos(1,1)
  4. --------------------------------------------------------------------------------------------
  5. --------------------------------------------------------------------------------------------
  6. local m = peripheral.find("monitor") -- Monitor for Management (5 long 3 wide)
  7. local r = peripheral.find("BigReactors-Reactor") -- Big Reactors, Reactor
  8.  
  9. if m then
  10.   print("Monitor Connected!")
  11.   print("")
  12.   else
  13.   print("No Monitor Connected!")
  14.   print("")
  15. end
  16.  
  17. if r then
  18.   print("Reactor Connected!")
  19.   print("")
  20.   else
  21.   print("No Reactor Connected!")
  22.   print("")
  23. end
  24. --------------------------------------------------------------------------------------------
  25. --------------------------------------------------------------------------------------------
  26. os.setComputerLabel("Noob's Reactor ControllerMonitor")
  27. --------------------------------------------------------------------------------------------
  28. --------------------------------------------------------------------------------------------
  29. r.setActive(true)
  30. if m then
  31. m.setTextScale(1)
  32. m.clear()
  33. end
  34. term.clear()
  35. --------------------------------------------------------------------------------------------
  36. --------------------------------------------------------------------------------------------
  37. term.setCursorPos(1,1)
  38. term.setTextColor(colors.lime)
  39. print("===================================================")
  40. print("|      Big Reactor Monitor 2   [By: Noobular]     |")
  41. print("|                                                 |")
  42. print("|                                                 |")
  43. print("|                                                 |")
  44. print("|                                                 |")
  45. print("|                                                 |")
  46. print("|                                                 |")
  47. print("|                                                 |")
  48. print("|                                                 |")
  49. print("|                                                 |")
  50. print("|                                                 |")
  51. print("|                                                 |")
  52. print("|                                                 |")
  53. print("|                                                 |")
  54. print("|                                                 |")
  55. print("|                                                 |")
  56. print("===================================================")
  57. --------------------------------------------------------------------------------------------
  58. --------------------------------------------------------------------------------------------
  59. ExtraNumber = 1
  60. i=1
  61. ypos = 1
  62. --------------------------------------------------------------------------------------------
  63. --------------------------------------------------------------------------------------------
  64. if m then
  65.   while ypos ~= 20 do
  66.     m.setTextColor(colors.cyan)
  67.       -- Y POSITION
  68.     m.setCursorPos(1,ypos)
  69.     m.write("|")
  70.     m.setCursorPos(50,ypos)
  71.     m.write("|")
  72.       m.setCursorPos(27,ypos)
  73.     m.write("|")
  74.     ypos = ypos +1
  75.   end
  76. end
  77. --------------------------------------------------------------------------------------------
  78. --------------------------------------------------------------------------------------------
  79. if m then
  80.   while i ~= 51 do
  81.     -- X POSITION
  82.       m.setCursorPos(i,2)
  83.       m.write("-")
  84.       m.setCursorPos(i,19)
  85.       m.write("-")
  86.  
  87.   i = i + 1
  88.   end
  89. end
  90. --------------------------------------------------------------------------------------------
  91. --------------------------------------------------------------------------------------------
  92. function Title()
  93.   if m then
  94.     m.setCursorPos(7,1)
  95.     m.setTextColor(colors.cyan)
  96.     m.write("Big Reactor Monitor 2 [By: Noobular]")
  97.     m.setTextColor(colors.white)
  98.   end
  99. end
  100. --------------------------------------------------------------------------------------------
  101. --------------------------------------------------------------------------------------------
  102. function Bar(text,func,y)
  103.   if m then
  104.     m.setCursorPos(3,y+ExtraNumber)
  105.     m.setTextColor(colors.white)
  106.     m.write(text)
  107.     m.setTextColor(colors.lime)
  108.     m.write(func)
  109.   end
  110. end
  111. --------------------------------------------------------------------------------------------
  112. --------------------------------------------------------------------------------------------
  113. function Bar2(text,func,y)
  114.   if m then
  115.     m.setCursorPos(29,y+ ExtraNumber)
  116.     m.setTextColor(colors.white)
  117.     m.write(text)
  118.     m.setTextColor(colors.lime)
  119.     m.write(func)
  120.   end
  121. end
  122. --------------------------------------------------------------------------------------------
  123. --------------------------------------------------------------------------------------------
  124. function Bar3(text,func,y)
  125.   if m then
  126.     m.setCursorPos(3,y+ExtraNumber)
  127.     m.setTextColor(colors.white)
  128.     m.write(text)
  129.     m.setTextColor(colors.lime)
  130.     m.write(func)
  131.     m.write(" / ")
  132.     m.write(r.getFuelAmountMax())
  133.   end
  134. end
  135.  
  136. function TBar(text,func,y)
  137.     term.setCursorPos(3,y+ExtraNumber)
  138.     term.setTextColor(colors.white)
  139.     term.write(text)
  140.     term.setTextColor(colors.lime)
  141.     term.write(func)
  142. end
  143.  
  144. function TBar2(text,func,y)
  145.     term.setCursorPos(29,y+ ExtraNumber)
  146.     term.setTextColor(colors.white)
  147.     term.write(text)
  148.     term.setTextColor(colors.lime)
  149.     term.write(func)
  150. end
  151.  
  152. function TerminalExtension()
  153.     term.setCursorPos(23,4+ExtraNumber)
  154.     term.write("k  ")
  155.     term.setCursorPos(49,2+ExtraNumber)
  156.     term.write("%")
  157.     term.setCursorPos(45,6+ExtraNumber)
  158.     term.write(" C")
  159.     term.setCursorPos(43,8+ExtraNumber)
  160.     term.write(" C")
  161.     term.setCursorPos(42,12+ExtraNumber)
  162.     term.write("%")
  163.  
  164. end
  165.  
  166. function MonitorExtension()
  167.     if m then
  168.       m.setCursorPos(23,4+ExtraNumber)
  169.       m.write("k  ")
  170.       m.setCursorPos(22,8+ExtraNumber)
  171.       m.write("     ")
  172.       m.setTextColor(colors.cyan)
  173.       m.write("| ")
  174.       m.setTextColor(colors.white)
  175.       m.setCursorPos(22,10+ExtraNumber)
  176.       m.write("     ")
  177.       m.setTextColor(colors.cyan)
  178.       m.write("| ")
  179.       m.setTextColor(colors.white)
  180.       m.setCursorPos(49,2+ExtraNumber)
  181.       m.write("%")
  182.       m.setTextColor(colors.cyan)
  183.       m.write("|")
  184.       m.setTextColor(colors.white)
  185.     end
  186. end
  187. --------------------------------------------------------------------------------------------
  188. --------------------------------------------------------------------------------------------
  189. while true do
  190.  
  191.   EStored = math.floor(r.getEnergyStored()/1000)
  192.   Rodl = 15
  193.  
  194.   if r.getActive() then
  195.     ActiveValue = "true"
  196.   else
  197.     ActiveValue = "false"
  198.   end
  199.  
  200.   Title()
  201.  
  202.   Bar("Currently Active: ",ActiveValue,2)
  203.   Bar("Energy Stored: ",EStored,4)
  204.   Bar("Fuel: ",r.getFuelAmount().." / "..r.getFuelAmountMax(),6)
  205.   Bar("Fuel Used/S: ",r.getFuelConsumedLastTick() * 20,8)
  206.   Bar("Fuel Used/T: ",r.getFuelConsumedLastTick(),10)
  207.   Bar("RF/S: ", math.floor(r.getEnergyProducedLastTick() * 20),12)
  208.   Bar("RF/T: ", math.floor(r.getEnergyProducedLastTick()),14)  
  209.   Bar("Waste: ",r.getWasteAmount(),16)
  210.   Bar2("Yellorium Rods: ",r.getNumberOfControlRods(),4)
  211.   Bar2("Fuel Reactivity: ", r.getFuelReactivity(),2)
  212.   Bar2("Casing Temp: ", math.floor(r.getCasingTemperature()),6)
  213.   Bar2("Fuel Temp: ", math.floor(r.getFuelTemperature()),8)
  214.   Bar2("Cooled: ",r.isActivelyCooled(),10)
  215.   Bar2("Rod Levels: ",r.getControlRodLevel(0),12)
  216.  
  217.  
  218.   TBar("Currently Active: ",ActiveValue,2)
  219.   TBar("Energy Stored: ",EStored,4)
  220.   TBar("Fuel: ",r.getFuelAmount().." / "..r.getFuelAmountMax(),6)
  221.   TBar("Fuel Used/S: ",r.getFuelConsumedLastTick() * 20,8)
  222.   TBar("Fuel Used/T: ",r.getFuelConsumedLastTick(),10)
  223.   TBar("RF/S: ", math.floor(r.getEnergyProducedLastTick() * 20),12)
  224.   TBar("RF/T: ", math.floor(r.getEnergyProducedLastTick()),14)
  225.   TBar("Waste: ",r.getWasteAmount(),16)
  226.   TBar2("Fuel Reactivity: ", math.ceil(r.getFuelReactivity()),2)
  227.   TBar2("Yellorium Rods: ",r.getNumberOfControlRods(),4)
  228.   TBar2("Casing Temp: ", math.floor(r.getCasingTemperature()),6)
  229.   TBar2("Fuel Temp: ", math.floor(r.getFuelTemperature()),8)
  230.   TBar2("Cooled: ",r.isActivelyCooled(),10)
  231.   TBar2("Rod Usage: ",math.floor(r.getEnergyStored()/100000),12)
  232.  
  233.   TerminalExtension()
  234.   MonitorExtension()
  235.   sleep(.1)
  236. --------------------------------------------------------------------------------------------
  237. --------------------------------------------------------------------------------------------
  238. if r.getEnergyStored()<=10000000 and r.getEnergyStored()>100 then
  239.     r.setAllControlRodLevels(0+(math.floor(r.getEnergyStored()/100000)))
  240. else
  241.     r.setAllControlRodLevels(0)
  242. end
  243.  
  244. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement