Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local onLevel = .20
- local offLevel = .70
- local reactor = peripheral.find("BigReactors-Reactor")
- local m = peripheral.find("monitor")
- local x,y = m.getSize()
- local numbars = 0
- local p = 0
- local level = 0
- local lastLevel = 0
- local change = 0
- local numRods = reactor.getNumberOfControlRods()
- local controlLevel = reactor.getControlRodLevel(0)
- m.setTextScale(1)
- function getPowerUsage()
- return math.floor(reactor.getEnergyProducedLastTick() - change)
- end
- function checkValue()
- if controlLevel > 100 then
- controlLevel = 100
- elseif controlLevel < 0 then
- controlLevel = 0
- end
- end
- function checkFiles()
- if not fs.exists("startup") then
- startFile = fs.open("startup", "w")
- startFile.write("multishell.launch({}, \"reactor\")")
- startFile.close()
- end
- if not fs.exists("update") then
- shell.run("pastebin","get","Eet6QXQh","update")
- end
- end
- function center(s)
- cx,cy = term.getCursorPos()
- term.setCursorPos((x/2) - (string.len(s)/2),cy)
- print(s)
- end
- checkFiles()
- while true do
- level = reactor.getEnergyStored()
- x,y = m.getSize()
- if level/10000000 < onLevel then
- reactor.setActive(true)
- end
- if level/10000000 > offLevel then
- reactor.setActive(false)
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Current Level - " .. level)
- print("Powered = " .. tostring(reactor.getActive()))
- print("Number of Control Rods - " .. numRods)
- print("\nHit Q to reboot Program.\nHit U to update.")
- print("Program written by RedStoner_Pro")
- timer = os.startTimer(1)
- computer = term.redirect(m)
- term.clear()
- term.setCursorPos(1,1)
- center("Reactor Manager Monitor")
- -- Power Bar
- p = level/10000000
- numBars = math.floor((x-4)*p)
- print("Energy")
- term.write(" |")
- term.setBackgroundColor(colors.red)
- if p > offLevel then
- term.setBackgroundColor(colors.green)
- elseif p > onLevel then
- term.setBackgroundColor(colors.yellow)
- end
- for i=1,numBars do
- term.write(" ")
- end
- term.setBackgroundColor(colors.black)
- cx,cy= term.getCursorPos()
- term.setCursorPos(x-1,cy)
- print("|")
- sLevel = level .. " / 10000000"
- center(sLevel)
- -- Fuel
- fP = reactor.getFuelAmount()/reactor.getFuelAmountMax()
- numFBars = math.floor((x-4)*fP)
- print("Fuel Amount")
- term.write(" |")
- term.setBackgroundColor(colors.yellow)
- for i=1,numFBars do
- term.write(" ")
- end
- term.setBackgroundColor(colors.black)
- cx,cy= term.getCursorPos()
- term.setCursorPos(x-1,cy)
- print("|")
- center(math.floor(reactor.getFuelAmount()) .. "/" .. math.floor(reactor.getFuelAmountMax()) )
- -- Case Temp
- caseP = reactor.getCasingTemperature()/2000
- numCaseBars = math.floor((x-4)*caseP)
- print("Case Temperature")
- term.write(" |")
- if reactor.getCasingTemperature() > 980 then
- term.setBackgroundColor(colors.red)
- elseif reactor.getCasingTemperature() > 650 then
- term.setBackgroundColor(colors.green)
- else
- term.setBackgroundColor(colors.blue)
- end
- for i=1,numCaseBars do
- term.write(" ")
- end
- term.setBackgroundColor(colors.black)
- cx,cy= term.getCursorPos()
- term.setCursorPos(x-1,cy)
- print("|")
- center(math.floor(reactor.getCasingTemperature()) .. " Celcius")
- --Fuel Temp
- fuelP = reactor.getCasingTemperature()/2000
- numFuelBars = math.floor((x-4)*fuelP)
- print("Fuel Temperature")
- term.write(" |")
- if reactor.getFuelTemperature() > 980 then
- term.setBackgroundColor(colors.red)
- elseif reactor.getFuelTemperature() > 650 then
- term.setBackgroundColor(colors.green)
- else
- term.setBackgroundColor(colors.blue)
- end
- for i=1,numFuelBars do
- term.write(" ")
- end
- term.setBackgroundColor(colors.black)
- cx,cy= term.getCursorPos()
- term.setCursorPos(x-1,cy)
- print("|")
- center(math.floor(reactor.getFuelTemperature()) .. " Celcius")
- -- Stats
- change = math.floor((level - lastLevel)/20)
- print("Fuel Usage = " .. reactor.getFuelConsumedLastTick() .. " mB/t")
- print("RF/T Created = " .. math.floor(reactor.getEnergyProducedLastTick()))
- print("RF/T Used = " .. getPowerUsage())
- print("RF/T Internal Change = " .. change)
- -- Control Rod Modifiers
- term.setCursorPos(1,y-1)
- center("Control Rod Level = " .. controlLevel)
- term.setBackgroundColor(colors.red)
- term.setCursorPos(2,y)
- term.write(" -1 ")
- term.setCursorPos(7,y)
- term.write(" -10 ")
- term.setCursorPos((x/2-1),y)
- if reactor.getActive() then
- term.setBackgroundColor(colors.green)
- else
- term.setBackgroundColor(colors.red)
- end
- term.write("POWER")
- term.setBackgroundColor(colors.green)
- term.setCursorPos(x-4,y)
- term.write(" +1 ")
- term.setCursorPos(x-10,y)
- term.write(" +10 ")
- term.setBackgroundColor(colors.black)
- lastLevel = level
- term.redirect(computer)
- e = "nottimer"
- while e ~= "timer" do
- e,p1,p2,p3 = os.pullEvent()
- if e == "timer" then
- break
- elseif e == "key" and p1 == 16 then
- os.reboot()
- break
- elseif e == "key" and p1 == 22 then
- shell.run("update")
- elseif e == "monitor_touch" then
- if p3 == y then
- if p2 >= 2 and p2 <= 5 then
- controlLevel = controlLevel - 1
- checkValue()
- reactor.setAllControlRodLevels(controlLevel)
- elseif p2 >= 7 and p2 <= 11 then
- controlLevel = controlLevel - 10
- checkValue()
- reactor.setAllControlRodLevels(controlLevel)
- elseif p2 >= x-10 and p2 <= x-6 then
- controlLevel = controlLevel + 10
- checkValue()
- reactor.setAllControlRodLevels(controlLevel)
- elseif p2 >= x-4 and p2 <= x-1 then
- controlLevel = controlLevel + 1
- checkValue()
- reactor.setAllControlRodLevels(controlLevel)
- elseif p2 >= x/2-1 and p2 <= x/2+3 then
- if reactor.getActive() then
- reactor.setActive(false)
- else
- reactor.setActive(true)
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement