Guest User

Reactor OS

a guest
Dec 28th, 2014
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. local mon = peripheral.wrap("monitor_0")
  2. local rad = peripheral.wrap("back")
  3.  
  4. while true do
  5.  
  6. local R = 0
  7.  
  8. act = rad.getActive()
  9. nrg = rad.getEnergyStored()
  10. fTmp = rad.getFuelTemperature()
  11. cTmp = rad.getCasingTemperature()
  12. ful = rad.getFuelAmount()
  13. fMax = rad.getFuelAmountMax()
  14. eTic = rad.getEnergyProducedLastTick()
  15. frl = rad.getFuelReactivity()
  16. fTic = rad.getFuelConsumedLastTick()
  17. rod = rad.getControlRodLevel(R)
  18.  
  19. if nrg <= 5000000 then
  20. rad.setActive(true)
  21. end
  22.  
  23. if nrg >= 7500000 then
  24. rad.setActive(false)
  25. end
  26.  
  27. mon.setTextScale(1.97)
  28. mon.clear()
  29.  
  30. mon.setCursorPos(1,1)
  31. mon.setTextColor(1)
  32. mon.write("Active: ")
  33.  
  34. if act == true then
  35. mon.setTextColor(15000)
  36. else
  37. mon.setTextColor(17000)
  38. end
  39.  
  40. mon.write(act)
  41.  
  42. mon.setCursorPos(1,2)
  43. mon.setTextColor(1)
  44. mon.write("RF Rate: ")
  45.  
  46. local e = eTic/1000
  47. e = math.floor(e)
  48. local ee = e*10
  49.  
  50. mon.setTextColor(17000)
  51. mon.write(e)
  52. mon.write("K/t")
  53. -- mon.write("K/t, ")
  54. -- mon.write(ee)
  55. -- mon.write("K/s")
  56.  
  57. local n = (math.floor(nrg/1000))
  58.  
  59. mon.setCursorPos(1,3)
  60. mon.setTextColor(1)
  61. mon.write("Stored RF: ")
  62. mon.setTextColor(15000)
  63. mon.write(n)
  64. mon.write("K")
  65.  
  66. local ft = math.floor(fTmp)
  67. local ct = math.floor(cTmp)
  68.  
  69. mon.setCursorPos(1,4)
  70. mon.setTextColor(1)
  71. mon.write("Temp Core/Case: ")
  72. if ft < 800 then
  73. mon.setTextColor(15000)
  74. elseif ft < 1700 then
  75. mon.setTextColor(18)
  76. else
  77. mon.setTextColor(17000)
  78. end
  79.  
  80. mon.setCursorPos(3,5)
  81. mon.write(ft)
  82. mon.setTextColor(1)
  83. mon.write("C")
  84. mon.write("/")
  85.  
  86. if ct < 800 then
  87. mon.setTextColor(15000)
  88. elseif ct < 1700 then
  89. mon.setTextColor(18)
  90. else
  91. mon.setTextColor(17000)
  92. end
  93.  
  94. mon.write(ct)
  95. mon.setTextColor(1)
  96. mon.write("C")
  97.  
  98. local f = ful/fMax
  99. f = 100*f
  100. f = math.floor(f)
  101.  
  102. mon.setTextColor(1)
  103. mon.setCursorPos(1,7)
  104. mon.write("Fuel: ")
  105.  
  106. if f < 40 then
  107. mon.setTextColor(17000)
  108. elseif f < 85 then
  109. mon.setTextColor(18)
  110. else
  111. mon.setTextColor(15000)
  112. end
  113.  
  114. mon.write(f)
  115. mon.write("%")
  116.  
  117.  
  118. -- local counter = counter
  119. -- local adj = adj
  120. -- local num1 = num1
  121. -- local num2 = num2
  122. -- local tmp1 = tmp1
  123. -- local tmp2 = tmp2
  124. -- local I = I
  125. -- local O = O
  126.  
  127. local counter = 0
  128. local num1 = 0
  129. local num2 = 0
  130. local I = 0
  131. local O = 0
  132. local T = -1
  133.  
  134. counter=counter+1
  135.  
  136. if counter == 1 then
  137. num1 = nrg
  138. local tmp1 = nrg - num2
  139. local tmp2 = tmp1/nrg
  140. I = (tmp2*100)
  141. I = math.floor(I)
  142. local adj = I - O
  143. else
  144. num2 = nrg
  145. tmp1 = nrg - num1
  146. tmp2 = tmp1/nrg
  147. O = math.floor(tmp2*100)
  148. adj = O - I
  149. counter = 0
  150. end
  151.  
  152. R=1
  153. local RA = rod
  154. R=2
  155. local RB = rod
  156. R=3
  157. local RC = rod
  158. R=4
  159. local RD = rod
  160. R=5
  161. local RE = rod
  162. R=6
  163. local RF = rod
  164. R=7
  165. local RG = rod
  166. R=8
  167. local RH = rod
  168. R=9
  169. local RI = rod
  170. R=10
  171. local RJ = rod
  172. R=11
  173. local RK = rod
  174. R=12
  175. local RL = rod
  176. R=13
  177. local RM = rod
  178. R=14
  179. local RN = rod
  180. R=15
  181. local RO = rod
  182. R=16
  183. local RP = rod
  184. R=17
  185. local RQ = rod
  186. R=18
  187. local RR = rod
  188.  
  189. tot = RA+RB+RC+RD+RE+RF+RG+RH+RI+RJ+RK+RL+RM+RN+RO+RP+RQ+RR
  190. local avg = tot/18
  191. adj = adj * T
  192. local fin = avg - adj
  193. rad.setAllControlRodLevels(fin)
  194.  
  195. sleep(0.5)
  196. end
Advertisement
Add Comment
Please, Sign In to add comment