Advertisement
Yapperyapps

Untitled

Jun 9th, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. local mon = peripheral.wrap("monitor_0")
  2. local on = colors.green
  3. local off = colors.red
  4.  
  5. --Reactor
  6. local reactor = peripheral.wrap("back")
  7. local RCTE = reactor.getEnergyStored()
  8. local RPT = reactor.getEnergyProducedLastTick()
  9. local RCRS = reactor.setAllControlRodLevels
  10.  
  11. --Energy Cells
  12.  
  13. local cube = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_5")
  14. local cell2 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_6")
  15. local cell3 = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_7")
  16. local crf = cube.getEnergyStored()
  17. local crf2 = cell2.getEnergyStored()
  18. local crf3 = cell3.getEnergyStored()
  19.  
  20.  
  21. function writeonmonitor()
  22. mon.clear()
  23. while true do
  24. sleep(0.05)
  25. mon.setTextScale(2)
  26. mon.setBackgroundColor(colors.white)
  27.  
  28. crf = cube.getEnergyStored()
  29. crf2 = cell2.getEnergyStored()
  30. crf3 = cell3.getEnergyStored()
  31. RCTE = reactor.getEnergyStored()
  32. RPT = reactor.getEnergyProducedLastTick()
  33. RCRS = reactor.getControlRodLevel(1)
  34.  
  35.  
  36.  
  37. if crf <= 70000000 then
  38. reactor.setActive(true)
  39. elseif RCTE > 100000 then
  40. reactor.setActive(false)
  41. end
  42.  
  43. if reactor.getActive() == true then
  44. mon.setCursorPos(1,5)
  45. mon.clearLine()
  46. mon.setTextColor(on)
  47. mon.write("Reactor Info: On")
  48. else
  49. mon.setTextColor(off)
  50. mon.setCursorPos(1,5)
  51. mon.clearLine()
  52. mon.write("Reactor Info: Off")
  53. end
  54.  
  55. mon.setCursorPos(1,8)
  56. mon.clearLine()
  57. mon.setTextColor(colors.gray)
  58. mon.write("Control Rods: "..reactor.getControlRodLevel(1).."% Inserted")
  59.  
  60. mon.setTextColor(colors.gray)
  61. mon.setCursorPos(3,6)
  62. mon.clearLine()
  63. mon.write("Current RF: "..RCTE)
  64. mon.setCursorPos(2,7)
  65. mon.clearLine()
  66. mon.write("RF-Per Tick: "..RPT)
  67.  
  68. mon.setTextColor(colors.gray)
  69. mon.setCursorPos(1,11)
  70. mon.clearLine()
  71. mon.write("Current RF Cell1: "..crf)
  72. mon.setCursorPos(1,12)
  73. mon.clearLine()
  74. mon.write("Current RF Cell2: "..crf2)
  75. mon.setCursorPos(1,13)
  76. mon.clearLine()
  77. mon.write("Current RF Cell3: "..crf3)
  78.  
  79. mon.setCursorPos(1,10)
  80. mon.setTextScale(2)
  81. mon.setTextColor(colors.lightGray)
  82. mon.write("EnergyCell Info:")
  83.  
  84. mon.setTextColor(colors.lime)
  85. mon.setCursorPos(1,2)
  86. mon.write("[++] ( Reactor Monitor ) [++]")
  87. mon.setCursorPos(1,1)
  88. mon.write("[=]=======================[=]")
  89. mon.setCursorPos(1,3)
  90. mon.write("[=]=======================[=]")
  91.  
  92. -- Control Rods
  93.  
  94. mon.setCursorPos(3,9)
  95. mon.setTextColor(colors.black)
  96. mon.setBackgroundColor(colors.red)
  97. mon.write("Set 0%")
  98.  
  99. mon.setCursorPos(11,9)
  100. mon.setBackgroundColor(colors.yellow)
  101. mon.write("Set 50%")
  102.  
  103. mon.setCursorPos(19,9)
  104. mon.setBackgroundColor(colors.blue)
  105. mon.write("Set 100%")
  106. mon.setCursorPos(1,1)
  107. mon.setBackgroundColor(colors.white)
  108. end
  109. end
  110.  
  111. function clickEvent()
  112. while true do
  113. event, side, x, y = os.pullEvent()
  114. if event == "monitor_touch" then
  115. if x >= 3 and x <= 8 and y == 9 then
  116. print("0% clicked")
  117. reactor.setAllControlRodLevels(0)
  118. elseif x >= 11 and x <= 18 and y == 9 then
  119. print("50% clicked")
  120. reactor.setAllControlRodLevels(50)
  121. elseif x >= 19 and x <= 24 and y == 9 then
  122. print("100% clicked")
  123. reactor.setAllControlRodLevels(100)
  124. end
  125. end
  126. sleep(0.5)
  127. end
  128. end
  129.  
  130. while true do
  131. parallel.waitForAny(clickEvent, writeonmonitor)
  132. mon.setBackgroundColor(colors.white)
  133. sleep(0.05)
  134. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement