Ubidibity

SimpleReactor1cap

Nov 3rd, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while true do
  2.   local reactor1 = peripheral.wrap("BigReactors-Reactor_82")
  3.   local mon = peripheral.wrap("monitor_317")
  4.  
  5.   local low = 100000
  6.   local high = 800000
  7.   local full = 999000
  8.  
  9.   if reactor1.getEnergyStored() <= low then
  10.     reactor1.setAllControlRodLevels(20)
  11.     if reactor1.getActive() == false then
  12.       reactor1.setActive(true)
  13.     end
  14.   else
  15.    if reactor1.getEnergyStored() < high then
  16.     reactor1.setAllControlRodLevels(20)
  17.    end
  18.   end
  19.  
  20.   if reactor1.getEnergyStored() >= full then
  21.      reactor1.setActive(false)
  22.   else
  23.     if reactor1.getEnergyStored() >= high then
  24.       reactor1.setAllControlRodLevels(90)
  25.       reactor1.setActive(true)
  26.     end
  27.   end
  28.  
  29.   mon.clear()
  30.  
  31.   mon.setCursorPos(1,1)
  32.   mon.write("On: ")
  33.   mon.write(reactor1.getActive())
  34.    
  35.   mon.setCursorPos(1,2)
  36.   mon.write("CHeat: ")
  37.   mon.write(math.floor(reactor1.getCasingTemperature()))
  38.  
  39.   mon.setCursorPos(1,3)
  40.   mon.write("FHeat: ")
  41.   mon.write(math.floor(reactor1.getFuelTemperature()))
  42.  
  43.   mon.setCursorPos(1,4)
  44.   mon.write("RF: ")  
  45.   mon.write(math.floor(reactor1.getEnergyStored()))
  46.  
  47.   sleep(10)
  48. end
Add Comment
Please, Sign In to add comment