Clorith

Big Reactor computer controller

Dec 14th, 2014 (edited)
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. -- Script for automatically maintaining
  2. -- Control Rod states for a big reactor
  3.  
  4. -- Always place computer with the back to the reactor computer port, or modify this value.
  5. reactor = peripheral.wrap( "back" )
  6.  
  7. reactorMaxPower = reactor.getEnergyCapacity()
  8.  
  9. while true do
  10. reactorCurrentPower = reactor.getEnergyStored()
  11.  
  12. -- The percentage of our internal power buffer
  13. loadPercentage = ( reactorCurrentPower / reactorMaxPower ) * 100
  14.  
  15. -- The internal buffer percentage represents the insertion rate
  16. -- of our Control Rods
  17. reactor.setAllControlRodLevels( loadPercentage )
  18.  
  19. -- Wait a given amount of time before we
  20. -- check the value again
  21. os.sleep( 10 )
  22. end
Add Comment
Please, Sign In to add comment