Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. while true do
  2. -- REACTOR
  3. local reactor = peripheral.wrap("BigReactors-Reactor_1")
  4. local low = 1000000
  5. local high = 8000000
  6.  
  7. if reactor.getEnergyStored() >= high then
  8. reactor.setAllControlRodLevels(100)
  9. term.setCursorPos(1,1)
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. print("Powered! [ ]")
  13. sleep(1)
  14. term.clear()
  15. term.setCursorPos(1,1)
  16. print("Powered! [. ]")
  17. sleep(1)
  18. term.clear()
  19. term.setCursorPos(1,1)
  20. print("Powered! [.. ]")
  21. sleep(1)
  22. term.clear()
  23. term.setCursorPos(1,1)
  24. print("Powered! [...]")
  25. else
  26. reactor.setAllControlRodLevels(0)
  27. term.setCursorPos(1,1)
  28. term.clear()
  29. print("Powering Up!")
  30. term.clear()
  31. sleep(1)
  32. end
  33.  
  34. -- MONITOR --
  35. local mon = peripheral.wrap("monitor_0")
  36. local power = reactor.getEnergyStored()
  37. local powerProduced = reactor.powerProducedLastTick()
  38. local controlRodLevel = reactor.controlRodLevel(all)
  39.  
  40. -- Monitor Coordinates
  41. local reactorActiveCoords = 2,2
  42. local powerCoords = 2,4
  43. local percentPowerStoredCoords = 2,5
  44. local energyProducedLastTickCoords = 2,6
  45. local controlRodLevelCoords = 2,7
  46.  
  47. -- Monitor Colors
  48. local backgroundColor = colors.black
  49. local reactorActiveColor = colors.blue
  50. local powerColor = colors.blue
  51. local percentPowerStoredColor = colors.blue
  52. local energyProducedLastTickColor = colors.blue
  53. local controlRodLevelColor = colors.blue
  54.  
  55. --[[
  56. local mX, mY = mon.getSize()
  57. function monWriteCen(text, y)
  58. mon.setCursorPos((#text-mX)/2, y)
  59. mon.write(text)
  60. end
  61. --]]
  62.  
  63. mon.setBackgroundColor(backgroundColor)
  64. mon.clear() --for mon.setBackgroundColor(color.blue) to work
  65. mon.setTextScale(2) -- Text scale
  66.  
  67. -- Loading screen, to make sure the monitor is online
  68. mon.setCursorPos(1,1)
  69. mon.clear()
  70. mon.write("[ ]")
  71. sleep(1)
  72. mon.clear()
  73. mon.setCursorPos(1,1)
  74. mon.write("[. ]")
  75. sleep(1)
  76. mon.clear()
  77. mon.setCursorPos(1,1)
  78. mon.write("[.. ]")
  79. sleep(1)
  80. mon.clear()
  81. mon.setCursorPos(1,1)
  82. mon.write("[...]")
  83. --sleep(1) -- added to the end code
  84.  
  85. -- Reactor Active
  86. mon.setCursorPos(reactorActiveCoords)
  87. mon.setTextColor(reactorActiveColor)
  88. mon.write("Reactor is: ")
  89. if reactor.getActive(true) then
  90. mon.setTextColor(colors.green)
  91. mon.write("Online")
  92. else
  93. mon.setTextColor(colors.red)
  94. mon.write("Offline")
  95. end
  96.  
  97. -- Power Stored
  98. mon.setCursorPos(powerStoredCoords)
  99. mon.setTextColor(powerStoredColor)
  100. mon.write("Power/1k: ")
  101. if power >= 2000000
  102. mon.setTextColor(colors.green)
  103. else
  104. mon.set TextColor(colors.red)
  105. end
  106. mon.write(math.abs(power/1000))
  107. mon.write("K RF")
  108.  
  109. -- Percent Power Stored
  110. mon.setCursorPos(percentPowerStoredCoords)
  111. mon.setTextColor(percentPowerStoredColor)
  112. mon.write("Reactor is ")
  113. if power >= 2000000
  114. mon.setTextColor(colors.green)
  115. else
  116. mon.set TextColor(colors.red)
  117. end
  118. mon.write(power/10000000)
  119. mon.write("% Full of Energy")
  120.  
  121. -- Energy Produced Last Tick
  122. mon.setCursorPos(energyProducedLastTickCoords)
  123. mon.setTextColor(energyProducedLastTickColor)
  124. mon.write("Power Produced: ")
  125. if powerProduced >= 0
  126. mon.setTextColor(colors.green)
  127. else
  128. mon.set TextColor(colors.red)
  129. end
  130. mon.write(powerProduced)
  131. mon.write(" RF")
  132.  
  133. -- Control Rod Level
  134. mon.setCursorPos(controlRodLevelCoords)
  135. mon.setTextColor(controlRodLevelColor)
  136. mon.write("Control Rod: ")
  137. if controlRodLevel >= 100
  138. mon.setTextColor(colors.green)
  139. else
  140. mon.set TextColor(colors.red)
  141. end
  142. mon.write(controlRodLevel)
  143. mon.write("% Extended")
  144.  
  145. sleep(1) -- Rate at which the monitor updates
  146. end
  147.  
  148. --[[
  149. getActive
  150. getEnergyStored
  151. getEnergyProducedLastTick
  152. getControlRodLevel(all)?
  153.  
  154. getFuelAmount,getFuelAmountMax,getFuelConsumedLastTick
  155. getWasteAmount
  156. getFuelTemperature
  157. getCasingTemperature
  158.  
  159. getFuelReactivity
  160.  
  161. setActive
  162. setAllControlRodLevels
  163. doEjectWaste
  164. doEjectFuel
  165. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement