Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('ReactorControl Engaged. View Monitor.')
- emptyflag=0
- offlineflag=0
- overloadflag=0
- flashflag=0
- reactor=peripheral.wrap('BigReactors-Reactor_4')
- turbine1=peripheral.wrap('BigReactors-Turbine_0')
- turbine2=peripheral.wrap('BigReactors-Turbine_1')
- monitor=peripheral.wrap('front')
- monitor.setTextScale(1)
- monitor.setBackgroundColor(colors.black)
- while true do
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextColor(colors.white)
- monitor.write('Fuel Level:')
- monitor.setCursorPos(1,2)
- monitor.setTextColor(colors.yellow)
- monitor.write(math.floor(((reactor.getFuelAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Fuel')
- monitor.setCursorPos(1,3)
- monitor.setTextColor(colors.lightBlue)
- monitor.write(math.floor(((reactor.getWasteAmount()/reactor.getFuelAmountMax())*100)+0.5)..'% Waste')
- monitor.setCursorPos(1,5)
- monitor.setTextColor(colors.white)
- monitor.write('Control Rod Levels:')
- monitor.setTextColor(colors.green)
- monitor.setCursorPos(1,6)
- monitor.write('Rod 1: '..(100-(reactor.getControlRodLevel(0)))..'% Depth')
- monitor.setCursorPos(1,7)
- monitor.write('Rod 2: '..(100-(reactor.getControlRodLevel(1)))..'% Depth')
- monitor.setCursorPos(1,8)
- monitor.write('Rod 3: '..(100-(reactor.getControlRodLevel(2)))..'% Depth')
- monitor.setCursorPos(1,9)
- monitor.write('Rod 4: '..(100-(reactor.getControlRodLevel(3)))..'% Depth')
- monitor.setCursorPos(1,10)
- monitor.write('Rod 5: '..(100-(reactor.getControlRodLevel(4)))..'% Depth')
- monitor.setCursorPos(1,11)
- monitor.write('Rod 6: '..(100-(reactor.getControlRodLevel(5)))..'% Depth')
- monitor.setCursorPos(1,13)
- monitor.setTextColor(colors.white)
- monitor.write('Temperature:')
- monitor.setCursorPos(1,14)
- monitor.setTextColor(colors.lightGray)
- monitor.write('Casing: ')
- if reactor.getCasingTemperature()>=650 then
- monitor.setTextColor(colors.purple)
- else if reactor.getCasingTemperature()>=950 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- end
- monitor.write(math.floor(reactor.getCasingTemperature()+0.5)..'C')
- monitor.setCursorPos(1,15)
- monitor.setTextColor(colors.yellow)
- monitor.write('Fuel: ')
- if reactor.getFuelTemperature()>=650 then
- monitor.setTextColor(colors.purple)
- else if reactor.getFuelTemperature()>=950 then
- monitor.setTextColor(colors.red)
- else
- monitor.setTextColor(colors.green)
- end
- end
- monitor.write(math.floor(reactor.getFuelTemperature()+0.5)..'C')
- monitor.setCursorPos(1,17)
- monitor.setTextColor(colors.white)
- monitor.write('Turbine Status:')
- monitor.setCursorPos(1,18)
- monitor.setTextColor(colors.blue)
- monitor.write('Rotor 1 Speed: ')
- if turbine1.getRotorSpeed()>1900 then
- monitor.setTextColor(colors.red)
- else if turbine1.getRotorSpeed()<1700 then
- monitor.setTextColor(colors.gray)
- else
- monitor.setTextColor(colors.green)
- end
- end
- monitor.write(math.floor(turbine1.getRotorSpeed()))
- monitor.write(' RPM')
- monitor.setCursorPos(1,19)
- monitor.setTextColor(colors.blue)
- monitor.write('Rotor 2 Speed: ')
- if turbine2.getRotorSpeed()>1900 then
- monitor.setTextColor(colors.red)
- else if turbine2.getRotorSpeed()<1700 then
- monitor.setTextColor(colors.gray)
- else
- monitor.setTextColor(colors.green)
- end
- end
- monitor.write(math.floor(turbine2.getRotorSpeed()))
- monitor.write(' RPM')
- monitor.setCursorPos(1,20)
- monitor.setTextColor(colors.lime)
- monitor.write('Turbine 1 Steam Rate: ')
- monitor.setTextColor(colors.lightGray)
- monitor.write(turbine1.getFluidFlowRateMax()..' mB/t')
- monitor.setCursorPos(1,21)
- monitor.setTextColor(colors.lime)
- monitor.write('Turbine 2 Steam Rate: ')
- monitor.setTextColor(colors.lightGray)
- monitor.write(turbine2.getFluidFlowRateMax()..' mB/t')
- monitor.setCursorPos(1,23)
- monitor.setTextColor(colors.white)
- monitor.write('Energy Production:')
- monitor.setCursorPos(1,24)
- monitor.setTextColor(colors.lime)
- monitor.write('Reactor: ')
- monitor.setTextColor(colors.lightGray)
- monitor.write(math.floor(reactor.getEnergyProducedLastTick()+0.5)..' mB/t')
- monitor.setCursorPos(1,25)
- monitor.setTextColor(colors.cyan)
- monitor.write('Turbine 1: ')
- monitor.setTextColor(colors.orange)
- monitor.write(math.floor(turbine1.getEnergyProducedLastTick()+0.5)..' RF/t')
- monitor.setCursorPos(1,26)
- monitor.setTextColor(colors.cyan)
- monitor.write('Turbine 2: ')
- monitor.setTextColor(colors.orange)
- monitor.write(math.floor(turbine2.getEnergyProducedLastTick()+0.5)..' RF/t')
- monitor.setCursorPos(1,28)
- monitor.setTextColor(colors.white)
- monitor.write('Overall Status:')
- if offlineflag==1 then
- monitor.setCursorPos(1,29)
- monitor.clearLine()
- monitor.setTextColor(colors.lightGray)
- monitor.write('Reactor - OFFLINE - Manual Override')
- monitor.setCursorPos(1,30)
- monitor.clearLine()
- monitor.write('Turbine 1 - OFFLINE - Manual Override')
- monitor.setCursorPos(1,31)
- monitor.clearLine()
- monitor.write('Turbine 2 - OFFLINE - Manual Override')
- end
- if emptyflag==1 then
- monitor.setCursorPos(1,29)
- monitor.clearLine()
- monitor.setTextColor(colors.pink)
- monitor.write('Reactor - OFFLINE - Fuel Exhausted')
- end
- if emptyflag==0 and offlineflag==0 then
- monitor.setCursorPos(1,29)
- monitor.clearLine()
- monitor.setTextColor(colors.green)
- monitor.write('Reactor - ONLINE')
- end
- if turbine1.getActive(true) then
- monitor.setCursorPos(1,30)
- monitor.clearLine()
- monitor.setTextColor(colors.green)
- monitor.write('Turbine 1 - ENGAGED')
- end
- if turbine2.getActive(true) then
- monitor.setCursorPos(1,31)
- monitor.clearLine()
- monitor.setTextColor(colors.green)
- monitor.write('Turbine 2 - ENGAGED')
- end
- if turbine1.getRotorSpeed()<=1750 and offlineflag==0 then
- turbine1.setInductorEngaged(false)
- monitor.setCursorPos(1,32)
- monitor.setTextColor(colors.lightGray)
- monitor.clearLine()
- monitor.write('Inductor Coil 1 - DISENGAGED')
- else
- turbine1.setInductorEngaged(true)
- monitor.setCursorPos(1,32)
- monitor.setTextColor(colors.green)
- monitor.clearLine()
- monitor.write('Inductor Coil 1 - ENGAGED')
- end
- if turbine2.getRotorSpeed()<=1750 and offlineflag==0 then
- turbine2.setInductorEngaged(false)
- monitor.setCursorPos(1,33)
- monitor.setTextColor(colors.lightGray)
- monitor.clearLine()
- monitor.write('Inductor Coil 2 - DISENGAGED')
- else
- turbine2.setInductorEngaged(true)
- monitor.setCursorPos(1,33)
- monitor.setTextColor(colors.green)
- monitor.clearLine()
- monitor.write('Inductor Coil 2 - ENGAGED')
- end
- if offlineflag==0 and emptyflag==0 and overloadflag==0 then
- if reactor.getFuelTemperature()>=800 then
- reactor.setAllControlRodLevels(90)
- else
- reactor.setAllControlRodLevels(math.floor((reactor.getFuelTemperature()+0.5)/8))
- end
- end
- if offlineflag==0 and emptyflag==0 and overloadflag==0 then
- if turbine1.getRotorSpeed()<1800 and turbine1.getFluidFlowRateMax()<=1760 then
- turbine1.setFluidFlowRateMax(turbine1.getFluidFlowRateMax()+1)
- end
- if turbine2.getRotorSpeed()<1800 and turbine2.getFluidFlowRateMax()<=1760 then
- turbine2.setFluidFlowRateMax(turbine2.getFluidFlowRateMax()+1)
- end
- if turbine1.getRotorSpeed()>=1820 and turbine1.getFluidFlowRateMax()>=1740 then
- turbine1.setFluidFlowRateMax(turbine1.getFluidFlowRateMax()-1)
- end
- if turbine2.getRotorSpeed()>=1820 and turbine2.getFluidFlowRateMax()>=1740 then
- turbine2.setFluidFlowRateMax(turbine2.getFluidFlowRateMax()-1)
- end
- end
- if reactor.getFuelAmount()<=100 and offlineflag==0 then
- reactor.setAllControlRodLevels(100)
- reactor.setActive(false)
- turbine1.setActive(false)
- turbine2.setActive(false)
- emptyflag=1
- else
- emptyflag=0
- end
- if rs.getInput('bottom')==false and emptyflag==0 then
- reactor.setActive(true)
- turbine1.setActive(true)
- turbine2.setActive(true)
- offlineflag=0
- end
- if rs.getInput('bottom')==true and emptyflag==0 then
- reactor.setActive(false)
- turbine1.setActive(false)
- turbine2.setActive(false)
- reactor.setAllControlRodLevels(100)
- offlineflag=1
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment