Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- local reactor1 = peripheral.wrap("BigReactors-Reactor_1")
- local reactor2 = peripheral.wrap("BigReactors-Reactor_2")
- local mon1 = peripheral.wrap("monitor_1")
- local mon2 = peripheral.wrap("monitor_2")
- --Functions
- function ClearScreens()
- mon1.clear()
- mon2.clear()
- mon1.setCursorPos(1,1)
- mon2.setCursorPos(1,1)
- mon1.setTextColor(colors.white)
- mon2.setTextColor(colors.white)
- end
- function Clearscrn(mon)
- mon.clear()
- mon.setCursorPos(1,1)
- end
- function scrnres(mon,x)
- if x <= 5 then
- mon.setTextScale(x)
- else
- mon.write("Scale too large")
- error("Scale too large")
- end
- end
- function Newline(mon)
- local cx,cy = mon.getCursorPos()
- mon.setCursorPos(1,cy+1)
- end
- function scrnrst(mon)
- Clearscrn(mon)
- scrnres(mon,1)
- end
- function ColorSet(mon,bool)
- if bool then
- mon.setTextColor(colors.green)
- else
- mon.setTextColor(colors.red)
- end
- end
- function GetStatus(reactor)
- cnnct = reactor.getConnected()
- act = reactor.getActive()
- estore = reactor.getEnergyStored()
- caseheat = reactor.getCasingTemperature()
- fuelheat = reactor.getFuelTemperature()
- end
- function StatusReport(mon,reactor)
- GetStatus(reactor)
- mon.write("Reactor Connection:")
- Newline(mon)
- ColorSet(mon,cnnct)
- mon.write(cnnct)
- Newline(mon)
- mon.setTextColor(colors.white)
- mon.write("Reactor Active:")
- ColorSet(mon,act)
- if act ~= true then
- reactor.setActive(true)
- end
- mon.write(act)
- Newline(mon)
- mon.setTextColor(colors.white)
- Control(mon,reactor)
- mon.setTextColor(colors.white)
- Newline(mon)
- mon.write("Casing Temp:")
- Newline(mon)
- mon.write(caseheat)
- Newline(mon)
- mon.write("Fuel Temp:")
- Newline(mon)
- mon.write(fuelheat)
- end
- function Control(mon,reactor)
- if estore <= 1000000 then
- mon.setTextColor(colors.red)
- reactor.setAllControlRodLevels(0)
- end
- if estore >= 9500000 then
- mon.setTextColor(colors.lime)
- reactor.setAllControlRodLevels(90)
- end
- mon.write(estore)
- end
- --Main
- while true do
- ClearScreens()
- scrnres(mon1,2)
- scrnres(mon2,2)
- StatusReport(mon1,reactor1)
- StatusReport(mon2,reactor2)
- sleep(4)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement