Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local term = require ("term")
- local keyboard = require("keyboard")
- local reactor = component.br_reactors
- local turnOn = 0.1
- local turnOff = 0.9
- local maxEnergy = 10000000
- if not reactor.getConnected() then
- term.write("No viable connction to a Reactor found. A connection is reuired to run this program.")
- end
- local y, h
- do
- local x,w
- x,y = term.getCursor()
- w,h = component.gpu.getResolution()
- end
- local function Reactor()
- local stored = reactor.getStoredEnergy()
- if stored/maxEnergy <= turnOn and not reactor.getActive() then
- reactor.setActive(true)
- elseif stored/maxEnergy >= turnOff and reactor.getActive then
- reactor.setActive(false)
- end
- term.setCursor(1,y)
- term.clearLine()
- term.write("Reactor energy level is: "..stored.."RF ("..stored/maxEnergy*100 .."%\n)"
- term.clearLine()
- -- more printed stuff comes here
- end
- while true do
- Reactor()
- if keyboard.isKeyDown(keyboard.keys.w) and keyboard.isControlDown() then
- os.exit()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement