Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local reactor = component.nc_fission_reactor
- function stop()
- reactor.deactivate()
- end
- function start()
- reactor.activate()
- end
- function getEnergy()
- local max = reactor.getMaxEnergyStored()
- local current = reactor.getEnergyStored()
- local percent = math.ceil(100*current/max)
- return percent
- end
- while true do
- local currentEnergy = getEnergy()
- if currentEnergy >= 90 and reactor.isProcessing() then
- stop()
- elseif currentEnergy <= 25 and reactor.isProcessing() == false then
- start()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement