Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Initialize Variables
- local reactor
- local monitor
- local State
- local Temp
- local Fuel
- local Waste
- emptyflag=0
- offlineflag=0
- flashflag=0
- turbine1 = peripheral.wrap("BigReactors-Turbine_1")
- turbine2 = peripheral.wrap("BigReactors-Turbine_2")
- turbine3 = peripheral.wrap("BigReactors-Turbine_3")
- reactor = peripheral.wrap("back")
- monitor = peripheral.wrap("monitor_2")
- monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.black)
- --Functions
- function wipeScreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- function delayPrint(pause,msg)
- print(msg)
- sleep(pause)
- end
- --Program
- wipeScreen()
- print("System Control Startup")
- sleep(1)
- while true do
- reactor.getConnected()
- monitor.clear()
- monitor.setCursorPos(9,1)
- monitor.setTextColor(colors.white)
- monitor.write('Reactor System Monitor')
- monitor.setCursorPos(1,2)
- monitor.write('Fuel Level:')
- monitor.setCursorPos(1,3)
- monitor.setTextColor(colors.yellow)
- monitor.write(math.floor((((reactor.getFuelAmount())/(reactor.getFuelAmountMax()))*100)+0.5)..'% Fuel')
- monitor.setCursorPos(1,4)
- monitor.setTextColor(colors.lightBlue)
- monitor.write(math.floor((((reactor.getWasteAmount())/(reactor.getFuelAmountMax()))*100)+0.5)..'% Waste')
- monitor.setCursorPos(15,2)
- monitor.setTextColor(colors.white)
- monitor.write('Steam:')
- monitor.setCursorPos(13,3)
- monitor.setTextColor(colors.green)
- if reactor.getHotFluidAmount()>=30000 and reactor.getHotFluidAmount()<20000 then
- monitor.setTextColor(colors.orange)
- end
- if reactor.getHotFluidAmount()>=40000 then
- monitor.setTextColor(colors.red)
- end
- monitor.write('Steam Pressure: '..reactor.getHotFluidAmount()..' mb')
- monitor.setCursorPos(13,3)
- monitor.write(' Outlet: '..reactor.getEnergyProducedLastTick()..' mb/t')
- monitor.setCursorPos(1,6)
- monitor.setTextColor(colors.white)
- monitor.setTextColor(colors.white)
- monitor.write('Temperature:')
- monitor.setCursorPos(1,7)
- if reactor.getFuelTemperature()>=650 then
- monitor.setTextColor(colors.purple)
- elseif reactor.getFuelTemperature()>=1000 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- end
- monitor.write('Fuel: '..reactor.getFuelTemperature()..'C Casing: '..reactor.getCasingTemperature()..'C')
- monitor.setCursorPos(40,2)
- monitor.setTextColor(colors.white)
- monitor.write('Turbine 1 Status')
- monitor.setCursorPos(40,3)
- if turbine1.getFluidFlowRate()>=1999 then
- monitor.setTextColor(colors.green)
- elseif turbine1.getFluidFlowRate()>=1500 then
- monitor.setTextColor(colors.orange)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Flow Rate: '..turbine1.getFluidFlowRate()..'mb/t')
- monitor.setCursorPos(40,4)
- if turbine1.getRotorSpeed()>=1700 and turbine1.getRotorSpeed()<=1900 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Rotor Speed: '..turbine1.getRotorSpeed()..' rpm')
- monitor.setCursorPos(40,5)
- if turbine1.getEnergyProducedLastTick()>= 25000 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Generation: '..turbine1.getEnergyProducedLastTick()..' rf/t')
- monitor.setCursorPos(40,7)
- monitor.setTextColor(colors.white)
- monitor.write('Turbine 2 Status')
- monitor.setCursorPos(40,8)
- if turbine2.getFluidFlowRate()>=1999 then
- monitor.setTextColor(colors.green)
- elseif turbine2.getFluidFlowRate()>=1500 then
- monitor.setTextColor(colors.orange)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Flow Rate: '..turbine2.getFluidFlowRate()..'mb/t')
- monitor.setCursorPos(40,9)
- if turbine2.getRotorSpeed()>=1700 and turbine2.getRotorSpeed()<=1900 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Rotor Speed: '..turbine2.getRotorSpeed()..' rpm')
- monitor.setCursorPos(40,10)
- if turbine2.getEnergyProducedLastTick()>= 25000 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Generation: '..turbine2.getEnergyProducedLastTick()..' rf/t')
- monitor.setCursorPos(40,12)
- monitor.setTextColor(colors.white)
- monitor.write('Turbine 3 Status')
- monitor.setCursorPos(40,13)
- if turbine3.getFluidFlowRate()>=1999 then
- monitor.setTextColor(colors.green)
- elseif turbine3.getFluidFlowRate()>=1500 then
- monitor.setTextColor(colors.orange)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Flow Rate: '..turbine3.getFluidFlowRate()..'mb/t')
- monitor.setCursorPos(40,14)
- if turbine3.getRotorSpeed()>=1700 and turbine3.getRotorSpeed()<=1900 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Rotor Speed: '..turbine3.getRotorSpeed()..' rpm')
- monitor.setCursorPos(40,15)
- if turbine3.getEnergyProducedLastTick()>= 25000 then
- monitor.setTextColor(colors.green)
- else
- monitor.setTextColor(colors.red)
- end
- monitor.write('Generation: '..turbine3.getEnergyProducedLastTick()..' rf/t')
- monitor.setCursorPos(40,17)
- monitor.setTextColor(colors.white)
- monitor.write('Capacitor Banks:')
- monitor.setCursorPos(40,18)
- if turbine1.getEnergyStored()>=9900000 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- monitor.write('Turbine 1: '..turbine1.getEnergyStored()..' RF')
- monitor.setCursorPos(40,19)
- if turbine2.getEnergyStored()>=9900000 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- monitor.write('Turbine 2: '..turbine2.getEnergyStored()..' RF')
- monitor.setCursorPos(40,18)
- if turbine3.getEnergyStored()>=9900000 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- monitor.write('Turbine 3: '..turbine3.getEnergyStored()..' RF')
- monitor.setCursorPos(1,9)
- monitor.setTextColor(colors.white)
- monitor.write('Control Rod Levels:')
- monitor.setTextColor(colors.green)
- monitor.setCursorPos(1,10)
- monitor.write('Rods 1-24: '..(100-(reactor.getControlRodLevel(0)))..'%')
- monitor.setCursorPos(20,10)
- monitor.write('Rods 24-48: '..(100-(reactor.getControlRodLevel(1)))..'%')
- monitor.setCursorPos(1,11)
- monitor.write('Rods 72-96: '..(100-(reactor.getControlRodLevel(2)))..'%')
- monitor.setCursorPos(20,11)
- monitor.write('Rods 120-144: '..(100-(reactor.getControlRodLevel(3)))..'%')
- monitor.setCursorPos(1,14)
- monitor.setTextColor(colors.white)
- monitor.write('Reactor Radioactivity')
- monitor.setCursorPos(24,14)
- monitor.write('Fuel Usage')
- monitor.setTextColor(colors.green)
- monitor.setCursorPos(1,15)
- monitor.write(''..reactor.getFuelReactivity()..'%')
- monitor.setCursorPos(24,15)
- monitor.write(''..reactor.getFuelConsumedLastTick()..' mb/t')
- monitor.setCursorPos(1,16)
- monitor.setTextColor(colors.orange)
- monitor.write('Status:')
- if flashflag==0 then
- flashflag=1
- if offlineflag==1 then
- monitor.setCursorPos(1,17)
- monitor.setTextColor(colors.lightGray)
- monitor.write('OFFLINE - Manual Override')
- end
- if emptyflag==1 then
- monitor.setCursorPos(1,17)
- monitor.setTextColor(colors.pink)
- monitor.write('OFFLINE - Fuel Exhausted')
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)>75 then
- monitor.setCursorPos(1,17)
- monitor.setTextColor(colors.yellow)
- monitor.write('ONLINE - Low Power Mode')
- end
- if emptyflag==0 and offlineflag==0 and reactor.getControlRodLevel(0)<=75 then
- monitor.setCursorPos(1,17)
- monitor.setTextColor(colors.orange)
- monitor.write('ONLINE - High Power Mode')
- end
- else
- flashflag=0
- monitor.setCursorPos(1,17)
- monitor.clearLine()
- end
- if reactor.getEnergyProducedLastTick<=5999 then
- reactor.setAllControlRodLevels(0+(math.floor(reactor.getEnergyProducedLastTick()/6000)))
- elseif reactor.getEnergyProducedLastTick()>=6000 then
- reactor.setAllControlRodLevels(100)
- else
- reactor.setAllControlRodLevels(0)
- end
- if (reactor.getFuelAmount()<=100) and offlineflag==0 then
- reactor.setAllControlRodLevels(100)
- reactor.setActive(false)
- emptyflag=1
- else
- emptyflag=0
- end
- if rs.getInput('bottom')==false and emptyflag==0 then
- reactor.setActive(true)
- offlineflag=0
- end
- if rs.getInput('bottom')==true and emptyflag==0 then
- reactor.setActive(false)
- reactor.setAllControlRodLevels(100)
- offlineflag=1
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement