Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("monitor_1")
- local capacitor = peripheral.wrap("tile_blockcapacitorbank_name_1")
- local reactor = peripheral.wrap("BigReactors-Reactor_0")
- local turbine_1 = peripheral.wrap("BigReactors-Turbine_0")
- local turbine_2 = peripheral.wrap("BigReactors-Turbine_1")
- monitor.setTextColor(1)
- monitor.setBackgroundColor(128)
- monitor.clear()
- local width, height = monitor.getSize()
- print("Monitor size: Columns:"..width..", Rows:"..height)
- makePercent = 100
- capacitorCount = 56
- capacitorBasic = 1000000
- capacitorStandard = 5000000
- capacitorVibrant = 25000000
- totalCapacity = (capacitorCount) * (capacitorVibrant)
- reactorRunning = false
- reactor.setActive(false)
- while true do
- capacitorLevel = capacitor.getEnergyStored()
- capacitorAdjusted = (capacitorLevel) * (capacitorCount)
- capacitorFillPct = ((capacitorAdjusted) / (totalCapacity)) * (100)
- capacitorInt = math.floor(capacitorFillPct)
- reactorCasingTemp = math.floor(reactor.getCasingTemperature())
- reactorRodLevel = reactor.getControlRodLevel(1)
- turbineSpeed_1 = math.floor(turbine_1.getRotorSpeed())
- turbineSpeed_2 = math.floor(turbine_2.getRotorSpeed())
- if (capacitorFillPct < 30) and (reactorRunning == false) then
- reactorRunning = true
- elseif (capacitorFillPct >=99) and (reactorRunning == true) then
- reactorRunning = false
- end
- if reactorRunning == true then
- reactor.setActive(true)
- if reactor.getActive() == false then
- reactor.setActive(true)
- end
- if reactorCasingTemp < 720 and (reactorRodLevel ~= 0) then
- reactor.setAllControlRodLevels(0)
- elseif (reactorCasingTemp >= 720) and (reactorRodLevel ~= 80) then
- reactor.setAllControlRodLevels(60)
- end
- if (reactorCasingTemp >= 720) then
- if (turbineSpeed_1 < 1780) and (turbine_1.getFluidFlowRateMax() ~= 2000) then
- turbine_1.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_2 < 1780) and (turbine_2.getFluidFlowRateMax() ~= 2000) then
- turbine_2.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_1 > 1780) and (turbineSpeed_1 <= 1850) and (turbine_1.getFluidFlowRateMax() ~= 2000) then
- turbine_1.setFluidFlowRateMax(2000)
- turbine_1.setInductorEngaged(true)
- end
- if (turbineSpeed_2 > 1780) and (turbineSpeed_2 <= 1850) and (turbine_2.getFluidFlowRateMax() ~= 2000) then
- turbine_2.setFluidFlowRateMax(2000)
- turbine_2.setInductorEngaged(true)
- end
- if (turbineSpeed_1 > 1850) and (turbine_1.getFluidFlowRateMax() ~= 0) then
- turbine_1.setFluidFlowRateMax(0)
- end
- if (turbineSpeed_2 > 1850) and (turbine_2.getFluidFlowRateMax() ~= 0) then
- turbine_2.setFluidFlowRateMax(0)
- end
- end
- end
- if reactorRunning == false then
- reactor.setActive(false)
- if reactor.getActive == true then
- reactor.setActive(false)
- end
- if turbine_1.getFluidFlowRateMax() ~= 0 then
- turbine_1.setFluidFlowRateMax(0)
- end
- if turbine_1.getInductorEngaged() ~= false then
- turbine_1.setInductorEngaged(false)
- end
- if turbine_2.getFluidFlowRateMax() ~= 0 then
- turbine_2.setFluidFlowRateMax(0)
- end
- if turbine_2.getInductorEngaged() ~= false then
- turbine_2.setInductorEngaged(false)
- end
- end
- --monitor.drawBox(1,14,20,26)
- monitor.setCursorPos(1,1)
- monitor.write(capacitorInt)
- monitor.setCursorPos(1,2)
- monitor.write(turbineSpeed_1)
- monitor.setCursorPos(1,3)
- monitor.write(turbineSpeed_2)
- sleep(0.2)
- monitor.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement