Advertisement
Ubidibity

BigReactor-eg1-Carbonated

Jun 15th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- credits to:
  2. -- https://youtu.be/sHN-KQKUkaY
  3. -- Modified for early game non advanced computer, no turbine, 2x1 monitor...
  4. -- This program will later be replaced by a late early game version when I get a enderio capacitor...
  5. -- A previous version had color and a 2x2 monitor, this version currently replaces that version.
  6.  
  7. -- when you connect the periphrials, check the log, these values should match what's in the code, if not
  8. -- you need to change it...
  9. -- [19:07:21] [Client thread/INFO]: [CHAT] Peripheral "computer_12" connected to network
  10. -- [19:07:24] [Client thread/INFO]: [CHAT] Peripheral "monitor_4" connected to network
  11. -- [19:07:27] [Client thread/INFO]: [CHAT] Peripheral "BigReactors-Reactor_6" connected to network
  12.  
  13. -- basic setup for this...
  14. -- reactor has a computer port
  15.  
  16. -- This isn't complex, but that's what I like about it.  It doesn't auto configure or do anything fancy, it just monitors
  17. -- what you tell it, and turns the reactor on and off to conserve fuel...
  18. -- for an api reference, I use and recommend:
  19. -- http://ftbwiki.org/Reactor_Computer_Port
  20. -- http://ftbwiki.org/Turbine_Computer_Port
  21.  
  22. -- I've further decided to stop treating the reactor like a reactor, instead of messing with the control rods the
  23. -- turbine works best with the rods set to 20%, so I'll just leave it at 20%, and shut it off when it's full.
  24.  
  25.   local reactor1 = peripheral.wrap("BigReactors-Reactor_6")
  26.   local mon = peripheral.wrap("monitor_4")
  27.  
  28. while true do
  29.   -- basic capacitor low, 10k of 100k capacity
  30.   local low = 10000
  31.   -- turbine high 800k 1000000 capacity
  32.   local high = 800000
  33.   -- reactor full at 10M
  34.   local full = 10000000
  35.  
  36.   if reactor1.getEnergyStored() <= low then
  37.     reactor1.setAllControlRodLevels(20)
  38.     if reactor1.getActive() == false then
  39.       reactor1.setActive(true)
  40.     end
  41.   end
  42.  
  43.   if reactor1.getEnergyStored() == full then
  44.      reactor1.setActive(false)
  45.   else
  46.     if reactor1.getEnergyStored() >= high then
  47.       reactor1.setAllControlRodLevels(90)
  48.       reactor1.setActive(true)
  49.     end
  50.   end
  51.  
  52.   mon.clear()
  53.  
  54.   mon.setCursorPos(1,1)
  55.   mon.write("Active: ")
  56.   mon.write(reactor1.getActive())
  57.    
  58.   mon.setCursorPos(1,2)
  59.   mon.write("Casing Heat: ")
  60.   mon.write(math.floor(reactor1.getCasingTemperature()))
  61.  
  62.   mon.setCursorPos(1,3)
  63.   mon.write("Fuel Heat: ")
  64.   mon.write(math.floor(reactor1.getFuelTemperature()))
  65.  
  66.   mon.setCursorPos(1,4)
  67.   mon.write("RF: ")  
  68.   mon.write(math.floor(reactor1.getEnergyStored()))
  69.  
  70.   sleep(10)
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement