Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if REACTOR == nil then
- print("This program needs a specific startup file, take a look at the pastebin of this program (gtQsXi8j)")
- end
- local oldTerm
- local name = os.getComputerLabel()
- local cID = os.getComputerID()
- local function wrap()
- mon = peripheral.wrap("monitor_"..MONITOR)
- mon.clear()
- mon.setTextScale(MONSCALE)
- w,h = term.getSize()
- mw,mh = mon.getSize()
- print("Wrapped monitor "..MONITOR)
- reactor = peripheral.wrap("BigReactors-Reactor_"..REACTOR)
- print("Wrapped reactor "..REACTOR)
- end
- local function conv(bInput,ifYes,ifNo)
- if bInput == true then
- return ifYes
- elseif bInput == false then
- return ifNo
- else
- return "XXX"
- end
- end
- local function inst(bInput,ifNil)
- if bInput then
- return bInput
- else
- return ifNil
- end
- end
- local function fill(sInput,add)
- local plus = ""
- for i = 1,(10 - string.len(sInput)) do
- plus = plus.." "
- end
- if add then
- return sInput..plus..add
- else
- return sInput..plus
- end
- end
- local function getValues()
- rctActive = fill(conv(reactor.getActive(),"YES","NO "))
- rctRods = fill(reactor.getNumberOfControlRods())
- rctEnergy = fill(reactor.getEnergyStored()," RF")
- rctFuelTemp = fill(reactor.getFuelTemperature())
- rctCaseTemp = fill(reactor.getCasingTemperature())
- rctFuelAm = fill(reactor.getFuelAmount())
- rctWasteAm = fill(reactor.getWasteAmount())
- rctMaxFuel = fill(reactor.getFuelAmountMax())
- rctEnergyProd = fill(reactor.getEnergyProducedLastTick(),UNIT)
- rctCoType = fill(inst(reactor.getCoolantType(),"NONE"))
- rctCoAm = fill(reactor.getCoolantAmount())
- rctHotType = fill(inst(reactor.getHotFluidType(),"NONE"))
- rctHotAm = fill(reactor.getHotFluidAmount())
- rctReactiv = fill(reactor.getFuelReactivity())
- rctFuelConsume = fill("ca. "..math.floor(reactor.getFuelConsumedLastTick()))
- rctActiveCo = fill(conv(reactor.isActivelyCooled(),"ACTIVE","PASSIVE"))
- end
- local function updateScreen()
- term.setCursorPos(1,1)
- getValues()
- print("ReactorOS\n")
- print("Reactor active : "..rctActive)
- print("Reactor cooling : "..rctActiveCo)
- print("Control rods : "..rctRods)
- print("\nEnergy stored : "..rctEnergy)
- print("Production : "..rctEnergyProd)
- print("Fuel temp : "..rctFuelTemp.." C")
- print("Case temp : "..rctCaseTemp.." C")
- print("\nMax. Fuel : "..rctMaxFuel.." mB")
- print("Fuel left : "..rctFuelAm.." mB")
- print("Waste left : "..rctWasteAm.." mB")
- print("Fuel reactivity : "..rctReactiv.." %")
- print("Fuel consumption: "..rctFuelConsume.." mB/t")
- print("\nCoolant type : "..rctCoType)
- print("Coolant amount : "..rctCoAm.." mB")
- print("\nHot fluid type : "..rctHotType)
- print("Hot fluid amount: "..rctHotAm.." mB")
- term.setCursorPos(1,h)
- end
- local function deb(sInput)
- term.redirect(oldTerm)
- print(sInput)
- term.redirect(mon)
- end
- local function list(tInput)
- for i = 1,#tInput do
- deb(tInput[i])
- end
- end
- ---------------------------------------------------------------------------------------------------
- --Exec
- if not name =="Controller" then
- shell.run("label set Controller")
- else
- end
- term.clear()
- term.setCursorPos(1,1)
- print("ReactorOS")
- wrap()
- oldTerm = term.redirect(mon)
- term.clear()
- deb("Entering loop...")
- term.setCursorPos(1,1)
- term.write("ReactorOS")
- sleep(1)
- term.clear()
- while true do
- updateScreen()
- if rs.getInput(VIOLIN) ==true then
- updateScreen()
- term.setCursorPos(1,mh)
- term.write("> Shutting down...")
- sleep(1)
- term.clear()
- term.setCursorPos(mw / 2 - 4,mh / 2)
- term.write("[INACTIVE]")
- term.setCursorPos(mw / 2 - 10,mh)
- term.write("OS made by TheSurgeon")
- term.redirect(oldTerm)
- term.write("Shutting down...")
- os.shutdown()
- end
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement