Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Reactor Monitor
- local reactor
- reactor = peripheral.wrap("back")
- monitor = peripheral.wrap("right")
- monitor.setTextScale(.5)
- ---Rounding to be used later
- --Rounding to remove decimal
- function round (num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- --Rounding to 1 place
- function round1 (num, idp)
- local mult = 10^(idp or 1)
- return math.floor(num * mult + 0.5) / mult
- end
- --Label
- term.setTextColor(colors.lightBlue)
- print("---------------------------")
- print("General Reactor Information")
- print("---------------------------")
- print(" ")
- term.setTextColor(colors.white)
- --Gets and displays if the comp and reactor are connected.
- write("Connection Status:")
- if reactor.getConnected(true) then
- term.setTextColor(colors.green)
- print("Connected!")
- else
- term.setTextColor(colors.red)
- print("Not Connected!")
- end
- term.setTextColor(colors.white)
- --Gets and displays the activity status of the reactor.
- write("Activity Status:")
- if reactor.getActive(true) then
- term.settextcolor(colors.green)
- print("Active!") else
- term.setTextColor(colors.red)
- print("Inactive!")
- end
- term.setTextColor(colors.white)
- --Energy info
- local int energy = reactor.getEnergyStored()
- local int max = 10000000
- local decimal percent = round1((energy/max)*100)
- write("Stored Energy:")
- if percent >= 70.0 then
- term.setTextColor(colors.green)
- print(percent,"%")else
- if percent >= 40.0 then
- term.setTextColor(colors.orange)
- print(percent,"%")else
- if percent <= 39.9 then
- term.setTextColor(colors.red)
- print(percent,"%")
- end
- end
- end
- term.setTextColor(colors.white)
- --Fuel Amount
- local int f = reactor.getFuelAmount()
- --Max Fuel
- local int fm = reactor.getFuelAmountMax()
- --Fuel Percent
- local decimal pf = round1((f/fm)*100)
- --Needed fuel/Fuel Defecit(In Ingots)
- local int nf = round((fm-f)/1000)
- --Needed Fuel/Fuel Defecit(In stacks)
- local int st = round1(nf/64)
- print("Fuel Info:")
- write(" Fuel Percent:")
- if pf >=70.0 then
- term.setTextColor(colors.green)
- print(pf,"%") else
- if pf >= 40.0 then
- term.setTextColor(colors.orange)
- print(pf,"%") else
- if pf <= 39.9 then
- term.setTextColor(colors.red)
- print(pf,"%")
- end
- end
- end
- term.setTextColor(colors.white)
- write(" Fuel Needed:")
- term.setTextColor(colors.red)
- print(nf," ingots/",st," stacks")
- term.setTextColor(colors.lightBlue)
- --label
- print(" ")
- print("----------------------------")
- print("Control Rod Information")
- print("----------------------------")
- print(" ")
- term.setTextColor(colors.white)
- --Gets and displays number of control rods
- write("Number of Control Rods:")
- local int rods = reactor.getNumberOfControlRods()
- term.setTextColor(colors.red)
- print(rods)
- term.setTextColor(colors.white)
- --Gets control rod information
- i = 0
- while true do
- local cr = reactor.getControlRodName(i)
- local cl = reactor.getControlRodLevel(i)
- print(cr,": ",cl)
- i = i + 1
- if i > 17 then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment