Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --#requires
- local term = require("term")
- local component = require("component")
- local event = require("event")
- --#variables
- local reactor = nil
- local running = true
- local energy = 0
- local maxEnergy = 10000000
- --#main
- function main()
- reactor = component.br_reactor
- event.listen("touch",listen)
- component.gpu.setResolution(25, 25)
- while running do
- energy = reactor.getEnergyStored()
- if energy/maxEnergy > 0.75 then
- reactor.setActive(false)
- end
- if energy/maxEnergy < 0.25 then
- reactor.setActive(true)
- end
- term.clear()
- print("Status: ", reactor.getActive())
- print("Storage: ", energy)
- print("Charge: ", math.floor((energy/maxEnergy)*100),"%")
- os.sleep(.25)
- end
- end
- --#listen
- function listen(name,address,x,y,button,player)
- running = false
- end
- --#init
- main()
- component.gpu.setResolution(150, 50)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement