Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --CAReactor by DeBrates(OpenComputers Port)
- --v4.0
- --Activate/De-Activate Button
- --Rod Controller (+-10%)
- --Dynamic Statistics
- --2 Tick(0.1s) RefreshRate
- --56x18 Monitor Size
- --Re-Wrap Your Peripherals/Components if Neccessary!
- local component = require("component")
- local event = require("event")
- local colors = { blue = 0x4286F4, purple = 0xB673d6, red = 0xC14141, green = 0xDA841,
- black = 0x000000, white = 0xFFFFFF, grey = 0x47494C, lightGrey = 0xBBBBBB, lime = 0x7DFF86,
- warn = 0xFFD23D}
- local r = component.br_reactor
- local mon = component.gpu
- mon.setResolution(56,18)
- --mon.setResolution(150,40)
- local w, h = mon.getResolution()
- mon.setBackground(colors.black)
- while true do
- local reactorOnline = r.getActive() --Boolean
- local energyProduction = r.getEnergyProducedLastTick() --RF/t
- local energyStored = r.getEnergyStored() --RF
- local fuelTemp = r.getFuelTemperature() --C
- local caseTemp = r.getCasingTemperature() --C
- local fuelAmount = r.getFuelAmount() --mB
- local wasteAmount = r.getWasteAmount() --mB
- local fuelReact = r.getFuelReactivity() --%
- local rodLevel = r.getControlRodLevel(0) --%
- local fuelCons = r.getFuelConsumedLastTick() --mB
- mon.fill(1,1,w,h," ")
- --Reactor Online
- mon.setForeground(colors.white)
- mon.set(1,1, "Active: ")
- if reactorOnline then
- mon.setForeground(colors.lime)
- else
- mon.setForeground(colors.red)
- end
- if reactorOnline then
- mon.set(9,1,"True")
- else
- mon.set(9,1,"False")
- end
- --RF/t Production
- mon.setForeground(colors.white)
- mon.set(1,2,"RF/t: ")
- if energyProduction == 0 then
- mon.setForeground(colors.red)
- elseif energyProduction <= 199 then
- mon.setForeground(colors.warn)
- else
- mon.setForeground(colors.lime)
- end
- mon.set(7,2, math.ceil(energyProduction).." RF/t")
- --Energy Stored
- --mon.setCursor(1,3)
- mon.setForeground(colors.white)
- mon.set(1,3,"Energy Stored: ")
- if energyStored < 1000000 then
- mon.setForeground(colors.red)
- else
- mon.setForeground(colors.lime)
- end
- mon.set(16,3, math.ceil(energyStored).." RF")
- --Fuel Temp
- --mon.setCursor(1,4)
- mon.setForeground(colors.white)
- mon.set(1,4, "Fuel Temp: ")
- mon.setForeground(colors.lime)
- mon.set(12,4, math.ceil(fuelTemp).." C")
- --Case Temp
- --mon.setCursor(1,5)
- mon.setForeground(colors.white)
- mon.set(1,5, "Case Temp: ")
- mon.setForeground(colors.lime)
- mon.set(12,5, math.ceil(caseTemp).." C")
- --Fuel Reactivity
- --mon.setCursor(1,6)
- mon.setForeground(colors.white)
- mon.set(1,6, "Fuel React: ")
- mon.setForeground(colors.lime)
- mon.set(13,6, math.ceil(fuelReact).."%")
- --Fuel Amount
- --mon.setCursor(1,7)
- mon.setForeground(colors.white)
- mon.set(1,7, "Fuel: ")
- mon.setForeground(colors.lime)
- mon.set(6,7, math.ceil(fuelAmount).." mB")
- --Fuel Consumption
- --mon.setCursor(1,8)
- mon.setForeground(colors.white)
- mon.set(1,8, "Fuel Use: ")
- mon.setForeground(colors.lime)
- if fuelCons > 0 then
- mon.set(11,8, "~")
- end
- mon.set(12,8, math.ceil(fuelCons * 100 / 10).." mB/t")
- --Waste Amount
- --mon.setCursor(1,9)
- mon.setForeground(colors.white)
- mon.set(1,9, "Waste: ")
- if wasteAmount >= 899 then
- mon.setForeground(colors.warn)
- else
- mon.setForeground(colors.lime)
- end
- mon.set(8,9, math.ceil(wasteAmount).." mB")
- --Activation Button Display
- if reactorOnline then
- mon.setForeground(colors.red)
- else
- mon.setForeground(colors.lime)
- end
- if reactorOnline then
- mon.set(w-10,1, "De-Activate")
- else
- mon.set(w-7,1, "Activate")
- end
- --Rod Controller Display
- --mon.setCursor(24,7)
- mon.setForeground(colors.white)
- mon.set(w-4,7, "Rods")
- if rodLevel == 0 then
- --mon.setCursor(25,8)
- mon.set(w-4,8, rodLevel.."%")
- else
- --mon.setCursor(24,8)
- mon.set(w-4,8, rodLevel.."%")
- end
- --mon.setCursor(22,8)
- mon.set(w-6,8, "<")
- --mon.setCursor(29,8)
- mon.set(w,8, ">")
- function blank()
- end
- --Button Timers
- local name, _, x, y = event.pull(0.1, "touch")
- if name then
- if y == 1 and x > w-11 and reactorOnline then
- r.setActive(false)
- elseif y == 1 and x > w-8 then
- r.setActive(true)
- elseif y == 8 and x == w-6 then
- r.setAllControlRodLevels(rodLevel - 10)
- elseif y == 8 and x == w then
- r.setAllControlRodLevels(rodLevel + 10)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement