Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local capacitor = peripheral.find("tile_blockcapacitorbank_name")
- if not capacitor then
- error("no capacitor found", 0)
- return
- end
- local reactor = peripheral.find("BigReactors-Reactor")
- if not reactor then
- error("no reactor found", 0)
- return
- end
- local minimum = 1000000 -- if the capacitor has less than this amount of energy, the reactor will power on
- local maximum = 1000000 -- if the capacitor has the maximum amount of energy minus this, the reactor will power off
- while true do
- local eMax = capacitor.getMaxEnergyStored()
- local eStored = capacitor.getEnergyStored()
- if eStored < minimum then
- reactor.setActive(true)
- end
- if eStored > eMax - maximum then
- reactor.setActive(false)
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement