Damaged

Reactor Control 5.1

Sep 29th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local rodLevels = 0
  2. local reactorOutputControl = 0
  3. local quarryOutputControl = 0
  4. solar = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_1")
  5. main_power = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_4")
  6. reactor = peripheral.wrap("back")
  7. while true do
  8.    if solar.getEnergyStored() > 40000000 then
  9.       reactorOutputControl = 0
  10.       print("Reactor Output: Disabled")
  11.    else
  12.       if solar.getEnergyStored() < 10000000 then
  13.          reactorOutputControl = 1
  14.          print("Reactor Output: Enabled")
  15.       end
  16.    end
  17.    if main_power.getEnergyStored() > ( main_power.getMaxEnergyStored() * .9 ) then
  18.       quarryOutputControl = 1
  19.    else
  20.       quarryOutputControl = 0
  21.    end
  22.    rodLevels = math.min( math.floor( ( reactor.getEnergyStored() / 10000000 ) * 80 ) + 40 , 100 )
  23.    if reactor.getEnergyStored() > 8000000 then
  24.       rodLevels = 100
  25.    end
  26.    if reactor.getEnergyStored() < 1000000 then
  27.       rodLevels = 0
  28.    end
  29.    if reactor.getEnergyStored() == 10000000 then
  30.       reactor.setActive(false)
  31.    else
  32.       reactor.setActive(true)
  33.    end
  34.    print("Rod Levels: "..rodLevels)
  35.    reactor.setAllControlRodLevels(rodLevels)
  36.    redstone.setBundledOutput("right", ( reactorOutputControl * colors.red ) + ( quarryOutputControl * colors.green ) )
  37.    sleep(1)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment