Advertisement
Margresse404

ReactorSpecial99_60

Jun 14th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. local monitors
  2. monitors = peripheral.wrap("right")
  3. local reactor
  4.  
  5.  
  6. function newLine()
  7. local x
  8. local y
  9. x, y = monitors.getCursorPos()
  10. y = y + 1
  11. monitors.setCursorPos(1,y)
  12. end
  13.  
  14. newLine()
  15. local reactorNumber = 99
  16. reactor = peripheral.wrap("BigReactors-Reactor_"..tostring(reactorNumber))
  17. local energyStored
  18.  
  19. function writeToScreen(text)
  20. monitors.clear()
  21. monitors.setCursorPos(1,1)
  22. active = reactor.getActive()
  23. monitors.write("Reactor Control Program")
  24. newLine()
  25. monitors.write("Reactor active:")
  26. newLine()
  27. monitors.write(active)
  28. newLine()
  29. monitors.write("Energy stored:")
  30. newLine()
  31. monitors.write(energyStored)
  32. newLine()
  33. monitors.write(text)
  34. newLine()
  35. end
  36.  
  37. energyStored = reactor.getEnergyStored()
  38.  
  39. local offlineWaitingTime = 60
  40. local increment = offlineWaitingTime / 10
  41. print("Input given:"..tostring(offlineWaitingTime))
  42.  
  43. while true do --Always loop
  44.  
  45. energyStored = reactor.getEnergyStored()
  46.  
  47. if energyStored == 0 then
  48. reactor.setActive(true)
  49. writeToScreen("No energy stored, starting reactor")
  50. monitors.write("Waiting for 3 seconds total")
  51. newLine()
  52. for i=1,3 do
  53. monitors.write(tostring(i) )
  54. newLine()
  55. sleep(1)
  56. end
  57. energyStored = reactor.getEnergyStored()
  58. end
  59.  
  60. if energyStored > 2000000 then
  61. reactor.setActive(false)
  62. writeToScreen("too much energy, stopped reactor")
  63.  
  64. monitors.write("Waiting for "..tostring(offlineWaitingTime).." seconds total")
  65. newLine()
  66.  
  67. local j = 0
  68.  
  69. for i=1,increment do
  70. local casingHeat = reactor.getCasingTemperature()
  71. j = i * 10
  72. if casingHeat < 30 then
  73. end
  74. monitors.write(tostring(casingHeat))
  75. newLine()
  76. monitors.write(tostring(j))
  77. newLine()
  78. sleep(10)
  79. end
  80. end
  81.  
  82. writeToScreen("Loading reactor till its full enough")
  83. monitors.write("Waiting for 3 seconds total")
  84. newLine()
  85. for i=1,3 do
  86. monitors.write(tostring(i))
  87. newLine()
  88. sleep(1)
  89. end
  90.  
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement