SHOW:
|
|
- or go back to the newest paste.
| 1 | local rodLevels = 0 | |
| 2 | local reactorOutputControl = 0 | |
| 3 | - | |
| 3 | + | local quarryOutputControl = 0 |
| 4 | - | function setLevels () |
| 4 | + | solar = peripheral.wrap("tile_thermalexpansion_cell_resonant_name_1")
|
| 5 | - | if unexpected_condition then error() end |
| 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 | - | end |
| 18 | + | quarryOutputControl = 1 |
| 19 | - | |
| 19 | + | |
| 20 | quarryOutputControl = 0 | |
| 21 | - | pcall(setLevels) |
| 21 | + | |
| 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 |