Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require('component')
- local reactor = component.nc_fission_reactor
- local powercell = component.rftools_powercell
- local event = require("event")
- event.listen("init", function()
- local thread = require("thread")
- thread.create(function()
- while true do
- local maxEnergy = powercell.getMaxEnergy()
- local currentEnergy = powercell.getEnergy()
- local percentage = ( currentEnergy / maxEnergy) * 100
- if reactor.isProcessing() then
- if percentage > 95 then
- reactor.deactivate()
- end
- else
- if percentage < 50 then
- reactor.activate()
- end
- end
- os.sleep(2)
- end
- end):detach()
- end)
Add Comment
Please, Sign In to add comment