Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor = peripheral.wrap("back")
- local max_buf = 25646000
- local max_desired_buf = .90 * max_buf
- local min_desired_buf = .20 * max_buf
- local cur_buf
- rednet.open("right")
- local function status(buffer)
- local buf_state = string.format("Reactor buffer %.2f%% full", buffer / max_buf * 100)
- if reactor.getActive() then
- return "ON: " .. buf_state
- else
- return "OFF: " .. buf_state
- end
- end
- while true do
- cur_buf = reactor.getEnergyStored()
- if cur_buf < min_desired_buf then
- reactor.setActive(true)
- elseif cur_buf > max_desired_buf then
- reactor.setActive(false)
- end
- print(status(cur_buf))
- rednet.send(4, status(cur_buf))
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement