Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Big Reactors Control Program for Opencomputers
- --By Tacnuke2011
- --requires
- local component = require("component")
- local term = require("term")
- local event = require("event")
- local serialization = require("serialization")
- local colors = require("colors")
- local keyboard = require("keyboard")
- --vars
- local br = component.br_reactor
- local gpu = component.gpu
- local enMax = 9500000
- local enMin = 2000000
- local temEn = br.getEnergyStored()
- local w, h = gpu.getResolution()
- --energy check
- local function power()
- local temEn = br.getEnergyStored()
- if temEn <= enMin then br.setActive(true)
- elseif temEn >= enMax then br.setActive(false)
- end
- info()
- end
- --display settings and output
- local function display()
- gpu.setResolution(90, 40)
- gpu.setForeground(0x0040ff)
- gpu.setBackground(0x000000)
- power()
- end
- function info()
- if br.getActive() then
- term.setCursor(54, 10)
- gpu.setForeground(0x000000)
- gpu.setBackground(0x00a500)
- gpu.fill(54, 10, 6, 1, " ")
- term.write("Online")
- term.setCursor(44, 10)
- gpu.setForeground(0x000000)
- gpu.setBackground(0xff0000)
- gpu.fill(44, 10, 7, 1, " ")
- term.write("Offline")
- elseif not br.getActive() then
- term.setCursor(54, 10)
- gpu.setForeground(0x0040ff)
- gpu.setBackground(0xff0000)
- gpu.fill(54, 10, 6, 1, " ")
- term.write("Online")
- term.setCursor(44, 10)
- gpu.setForeground(0x0040ff)
- gpu.setBackground(0x00a500)
- gpu.fill(44, 10, 7, 1, " ")
- term.write("Offline")
- end
- local enStor = math.floor(br.getEnergyStored()/10^5)
- gpu.setForeground(0x0040ff)
- gpu.setBackground(0x000000)
- term.setCursor(29, 10)
- term.write("Reactor Status:")
- term.setCursor(32, 12)
- term.write("Fuel Amount: "..br.getFuelAmount().." mB")
- term.setCursor(31, 13)
- term.write("Waste Amount: "..br.getWasteAmount().. " mB")
- term.setCursor(34, 14)
- term.clearLine()
- term.setCursor(34, 14)
- term.write("RF Stored: "..enStor.."%")
- term.setCursor(30, 15)
- term.clearLine()
- term.setCursor(30, 15)
- term.write("RF Production: " ..math.floor(br.getEnergyProducedLastTick()).. " RF/t")
- term.setCursor(31, 16)
- term.clearLine()
- term.setCursor(31, 16)
- term.write("Casing Temp.: "..math.floor(br.getCasingTemperature()).." C")
- term.setCursor(33, 17)
- term.clearLine()
- term.setCursor(33, 17)
- term.write("Fuel Temp.: "..math.floor(br.getFuelTemperature()).." C")
- term.setCursor(28, 18)
- term.clearLine()
- term.setCursor(28, 18)
- term.write("Fuel Reactivity: "..math.floor(br.getFuelReactivity()).." %")
- term.setCursor(36, 20)
- gpu.setBackground(0x00a500)
- gpu.fill(35, 20, 6, 1, " ")
- term.write("Exit")
- display()
- end
- --event listener
- -- x keypress
- function listen(name, address, x, y, button, player)
- local run = true
- if x >= 36 and x <= 39 and y == 20 then
- run = false
- end
- end
- --main loop
- while run do
- local name, address, x, y, button, player = event.pull("touch")
- if x >= 36 and x <= 40 and y == 20 then
- print("ding")
- os.sleep(.5)
- break
- else
- os.sleep(.5)
- term.clear()
- info()
- end
- end
- event.ignore("touch", listen)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement