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_2")
- local reactor = peripheral.wrap("BigReactors-Reactor_0")
- local turbine_1 = peripheral.wrap("BigReactors-Turbine_17")
- local turbine_2 = peripheral.wrap("BigReactors-Turbine_13")
- local turbine_3 = peripheral.wrap("BigReactors-Turbine_2")
- local turbine_4 = peripheral.wrap("BigReactors-Turbine_4")
- local turbine_5 = peripheral.wrap("BigReactors-Turbine_5")
- local turbine_6 = peripheral.wrap("BigReactors-Turbine_6")
- local turbine_7 = peripheral.wrap("BigReactors-Turbine_7")
- local turbine_8 = peripheral.wrap("BigReactors-Turbine_8")
- local turbine_9 = peripheral.wrap("BigReactors-Turbine_9")
- local turbine_10 = peripheral.wrap("BigReactors-Turbine_10")
- local turbine_11 = peripheral.wrap("BigReactors-Turbine_11")
- local turbine_12 = peripheral.wrap("BigReactors-Turbine_12")
- local turbine_13 = peripheral.wrap("BigReactors-Turbine_14")
- local turbine_14 = peripheral.wrap("BigReactors-Turbine_15")
- local turbine_15 = peripheral.wrap("BigReactors-Turbine_16")
- local turbine_16 = peripheral.wrap("BigReactors-Turbine_18")
- local turbine_17 = peripheral.wrap("BigReactors-Turbine_19")
- local turbine_18 = peripheral.wrap("BigReactors-Turbine_20")
- monitor.setTextColor(1)
- monitor.setTextScale(2)
- monitor.setBackgroundColor(128)
- monitor.clear()
- local width, height = monitor.getSize()
- print("Monitor size: Columns:"..width..", Rows:"..height)
- makePercent = 100
- capacitorCount = 720
- capacitorBasic = 1000000
- capacitorStandard = 5000000
- capacitorVibrant = 25000000
- totalCapacity = (capacitorCount) * (capacitorVibrant)
- reactorRunning = false
- reactor.setActive(false)
- turbine_1.setActive(true)
- turbine_1.setInductorEngaged(false)
- turbine_2.setActive(true)
- turbine_2.setInductorEngaged(false)
- turbine_3.setActive(true)
- turbine_3.setInductorEngaged(false)
- turbine_4.setActive(true)
- turbine_4.setInductorEngaged(false)
- turbine_5.setActive(true)
- turbine_5.setInductorEngaged(false)
- turbine_6.setActive(true)
- turbine_6.setInductorEngaged(false)
- turbine_7.setActive(true)
- turbine_7.setInductorEngaged(false)
- turbine_8.setActive(true)
- turbine_8.setInductorEngaged(false)
- turbine_9.setActive(true)
- turbine_9.setInductorEngaged(false)
- turbine_10.setActive(true)
- turbine_10.setInductorEngaged(false)
- turbine_11.setActive(true)
- turbine_11.setInductorEngaged(false)
- turbine_12.setActive(true)
- turbine_12.setInductorEngaged(false)
- turbine_13.setActive(true)
- turbine_13.setInductorEngaged(false)
- turbine_14.setActive(true)
- turbine_14.setInductorEngaged(false)
- turbine_15.setActive(true)
- turbine_15.setInductorEngaged(false)
- turbine_16.setActive(true)
- turbine_16.setInductorEngaged(false)
- turbine_17.setActive(true)
- turbine_17.setInductorEngaged(false)
- turbine_18.setActive(true)
- turbine_18.setInductorEngaged(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())
- turbineSpeed_3 = math.floor(turbine_3.getRotorSpeed())
- turbineSpeed_4 = math.floor(turbine_4.getRotorSpeed())
- turbineSpeed_5 = math.floor(turbine_5.getRotorSpeed())
- turbineSpeed_6 = math.floor(turbine_6.getRotorSpeed())
- turbineSpeed_7 = math.floor(turbine_7.getRotorSpeed())
- turbineSpeed_8 = math.floor(turbine_8.getRotorSpeed())
- turbineSpeed_9 = math.floor(turbine_9.getRotorSpeed())
- turbineSpeed_10 = math.floor(turbine_10.getRotorSpeed())
- turbineSpeed_11 = math.floor(turbine_11.getRotorSpeed())
- turbineSpeed_12 = math.floor(turbine_12.getRotorSpeed())
- turbineSpeed_13 = math.floor(turbine_13.getRotorSpeed())
- turbineSpeed_14 = math.floor(turbine_14.getRotorSpeed())
- turbineSpeed_15 = math.floor(turbine_15.getRotorSpeed())
- turbineSpeed_16 = math.floor(turbine_16.getRotorSpeed())
- turbineSpeed_17 = math.floor(turbine_17.getRotorSpeed())
- turbineSpeed_18 = math.floor(turbine_18.getRotorSpeed())
- turbineSpeedMin = math.min(turbineSpeed_1, turbineSpeed_2, turbineSpeed_3, turbineSpeed_4, turbineSpeed_5, turbineSpeed_6, turbineSpeed_7, turbineSpeed_8, turbineSpeed_9, turbineSpeed_10, turbineSpeed_11, turbineSpeed_12, turbineSpeed_13, turbineSpeed_14, turbineSpeed_15, turbineSpeed_16, turbineSpeed_17, turbineSpeed_18)
- turbineSpeedMax = math.max(turbineSpeed_1, turbineSpeed_2, turbineSpeed_3, turbineSpeed_4, turbineSpeed_5, turbineSpeed_6, turbineSpeed_7, turbineSpeed_8, turbineSpeed_9, turbineSpeed_10, turbineSpeed_11, turbineSpeed_12, turbineSpeed_13, turbineSpeed_14, turbineSpeed_15, turbineSpeed_16, turbineSpeed_17, turbineSpeed_18)
- 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 < 1000 and (reactorRodLevel ~= 0) then
- reactor.setAllControlRodLevels(0)
- elseif (reactorCasingTemp >= 1000) and (reactorRodLevel ~= 30) then
- reactor.setAllControlRodLevels(30)
- end
- if (reactorCasingTemp >= 1000) 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_3 < 1780) and (turbine_3.getFluidFlowRateMax() ~= 2000) then
- turbine_3.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_4 < 1780) and (turbine_4.getFluidFlowRateMax() ~= 2000) then
- turbine_4.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_5 < 1780) and (turbine_5.getFluidFlowRateMax() ~= 2000) then
- turbine_5.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_6 < 1780) and (turbine_6.getFluidFlowRateMax() ~= 2000) then
- turbine_6.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_7 < 1780) and (turbine_7.getFluidFlowRateMax() ~= 2000) then
- turbine_7.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_8 < 1780) and (turbine_8.getFluidFlowRateMax() ~= 2000) then
- turbine_8.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_9 < 1780) and (turbine_9.getFluidFlowRateMax() ~= 2000) then
- turbine_9.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_10 < 1780) and (turbine_10.getFluidFlowRateMax() ~= 2000) then
- turbine_10.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_11 < 1780) and (turbine_11.getFluidFlowRateMax() ~= 2000) then
- turbine_11.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_12 < 1780) and (turbine_12.getFluidFlowRateMax() ~= 2000) then
- turbine_12.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_13 < 1780) and (turbine_13.getFluidFlowRateMax() ~= 2000) then
- turbine_13.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_14 < 1780) and (turbine_14.getFluidFlowRateMax() ~= 2000) then
- turbine_14.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_15 < 1780) and (turbine_15.getFluidFlowRateMax() ~= 2000) then
- turbine_15.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_16 < 1780) and (turbine_16.getFluidFlowRateMax() ~= 2000) then
- turbine_16.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_17 < 1780) and (turbine_17.getFluidFlowRateMax() ~= 2000) then
- turbine_17.setFluidFlowRateMax(2000)
- end
- if (turbineSpeed_18 < 1780) and (turbine_18.getFluidFlowRateMax() ~= 2000) then
- turbine_18.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_3 > 1780) and (turbineSpeed_3 <= 1850) and (turbine_3.getFluidFlowRateMax() ~= 2000) then
- turbine_3.setFluidFlowRateMax(2000)
- turbine_3.setInductorEngaged(true)
- end
- if (turbineSpeed_4 > 1780) and (turbineSpeed_4 <= 1850) and (turbine_4.getFluidFlowRateMax() ~= 2000) then
- turbine_4.setFluidFlowRateMax(2000)
- turbine_4.setInductorEngaged(true)
- end
- if (turbineSpeed_5 > 1780) and (turbineSpeed_5 <= 1850) and (turbine_5.getFluidFlowRateMax() ~= 2000) then
- turbine_5.setFluidFlowRateMax(2000)
- turbine_5.setInductorEngaged(true)
- end
- if (turbineSpeed_6 > 1780) and (turbineSpeed_6 <= 1850) and (turbine_6.getFluidFlowRateMax() ~= 2000) then
- turbine_6.setFluidFlowRateMax(2000)
- turbine_6.setInductorEngaged(true)
- end
- if (turbineSpeed_7 > 1780) and (turbineSpeed_7 <= 1850) and (turbine_7.getFluidFlowRateMax() ~= 2000) then
- turbine_7.setFluidFlowRateMax(2000)
- turbine_7.setInductorEngaged(true)
- end
- if (turbineSpeed_8 > 1780) and (turbineSpeed_8 <= 1850) and (turbine_8.getFluidFlowRateMax() ~= 2000) then
- turbine_8.setFluidFlowRateMax(2000)
- turbine_8.setInductorEngaged(true)
- end
- if (turbineSpeed_9 > 1780) and (turbineSpeed_9 <= 1850) and (turbine_9.getFluidFlowRateMax() ~= 2000) then
- turbine_9.setFluidFlowRateMax(2000)
- turbine_9.setInductorEngaged(true)
- end
- if (turbineSpeed_10 > 1780) and (turbineSpeed_10 <= 1850) and (turbine_10.getFluidFlowRateMax() ~= 2000) then
- turbine_10.setFluidFlowRateMax(2000)
- turbine_10.setInductorEngaged(true)
- end
- if (turbineSpeed_11 > 1780) and (turbineSpeed_11 <= 1850) and (turbine_11.getFluidFlowRateMax() ~= 2000) then
- turbine_11.setFluidFlowRateMax(2000)
- turbine_11.setInductorEngaged(true)
- end
- if (turbineSpeed_12 > 1780) and (turbineSpeed_12 <= 1850) and (turbine_12.getFluidFlowRateMax() ~= 2000) then
- turbine_12.setFluidFlowRateMax(2000)
- turbine_12.setInductorEngaged(true)
- end
- if (turbineSpeed_13 > 1780) and (turbineSpeed_13 <= 1850) and (turbine_13.getFluidFlowRateMax() ~= 2000) then
- turbine_13.setFluidFlowRateMax(2000)
- turbine_13.setInductorEngaged(true)
- end
- if (turbineSpeed_14 > 1780) and (turbineSpeed_14 <= 1850) and (turbine_14.getFluidFlowRateMax() ~= 2000) then
- turbine_14.setFluidFlowRateMax(2000)
- turbine_14.setInductorEngaged(true)
- end
- if (turbineSpeed_15 > 1780) and (turbineSpeed_15 <= 1850) and (turbine_15.getFluidFlowRateMax() ~= 2000) then
- turbine_15.setFluidFlowRateMax(2000)
- turbine_15.setInductorEngaged(true)
- end
- if (turbineSpeed_16 > 1780) and (turbineSpeed_16 <= 1850) and (turbine_16.getFluidFlowRateMax() ~= 2000) then
- turbine_16.setFluidFlowRateMax(2000)
- turbine_16.setInductorEngaged(true)
- end
- if (turbineSpeed_17 > 1780) and (turbineSpeed_17 <= 1850) and (turbine_17.getFluidFlowRateMax() ~= 2000) then
- turbine_17.setFluidFlowRateMax(2000)
- turbine_17.setInductorEngaged(true)
- end
- if (turbineSpeed_18 > 1780) and (turbineSpeed_18 <= 1850) and (turbine_18.getFluidFlowRateMax() ~= 2000) then
- turbine_18.setFluidFlowRateMax(2000)
- turbine_18.setInductorEngaged(true)
- end
- -----------------------------------------------------------------------------------------------------------
- if (turbineSpeed_1 > 1850) and (turbine_1.getFluidFlowRateMax() ~= 0) then
- turbine_1.setFluidFlowRateMax(0)
- turbine_1.setInductorEngaged(true)
- end
- if (turbineSpeed_2 > 1850) and (turbine_2.getFluidFlowRateMax() ~= 0) then
- turbine_2.setFluidFlowRateMax(0)
- turbine_2.setInductorEngaged(true)
- end
- if (turbineSpeed_3 > 1850) and (turbine_3.getFluidFlowRateMax() ~= 0) then
- turbine_3.setFluidFlowRateMax(0)
- turbine_3.setInductorEngaged(true)
- end
- if (turbineSpeed_4 > 1850) and (turbine_4.getFluidFlowRateMax() ~= 0) then
- turbine_4.setFluidFlowRateMax(0)
- turbine_4.setInductorEngaged(true)
- end
- if (turbineSpeed_5 > 1850) and (turbine_5.getFluidFlowRateMax() ~= 0) then
- turbine_5.setFluidFlowRateMax(0)
- turbine_5.setInductorEngaged(true)
- end
- if (turbineSpeed_6 > 1850) and (turbine_6.getFluidFlowRateMax() ~= 0) then
- turbine_6.setFluidFlowRateMax(0)
- turbine_6.setInductorEngaged(true)
- end
- if (turbineSpeed_7 > 1850) and (turbine_7.getFluidFlowRateMax() ~= 0) then
- turbine_7.setFluidFlowRateMax(0)
- turbine_7.setInductorEngaged(true)
- end
- if (turbineSpeed_8 > 1850) and (turbine_8.getFluidFlowRateMax() ~= 0) then
- turbine_8.setFluidFlowRateMax(0)
- turbine_8.setInductorEngaged(true)
- end
- if (turbineSpeed_9 > 1850) and (turbine_9.getFluidFlowRateMax() ~= 0) then
- turbine_9.setFluidFlowRateMax(0)
- turbine_9.setInductorEngaged(true)
- end
- if (turbineSpeed_10 > 1850) and (turbine_10.getFluidFlowRateMax() ~= 0) then
- turbine_10.setFluidFlowRateMax(0)
- turbine_10.setInductorEngaged(true)
- end
- if (turbineSpeed_11 > 1850) and (turbine_11.getFluidFlowRateMax() ~= 0) then
- turbine_11.setFluidFlowRateMax(0)
- turbine_11.setInductorEngaged(true)
- end
- if (turbineSpeed_12 > 1850) and (turbine_12.getFluidFlowRateMax() ~= 0) then
- turbine_12.setFluidFlowRateMax(0)
- turbine_12.setInductorEngaged(true)
- end
- if (turbineSpeed_13 > 1850) and (turbine_13.getFluidFlowRateMax() ~= 0) then
- turbine_13.setFluidFlowRateMax(0)
- turbine_13.setInductorEngaged(true)
- end
- if (turbineSpeed_14 > 1850) and (turbine_14.getFluidFlowRateMax() ~= 0) then
- turbine_14.setFluidFlowRateMax(0)
- turbine_14.setInductorEngaged(true)
- end
- if (turbineSpeed_15 > 1850) and (turbine_15.getFluidFlowRateMax() ~= 0) then
- turbine_15.setFluidFlowRateMax(0)
- turbine_15.setInductorEngaged(true)
- end
- if (turbineSpeed_16 > 1850) and (turbine_16.getFluidFlowRateMax() ~= 0) then
- turbine_16.setFluidFlowRateMax(0)
- turbine_16.setInductorEngaged(true)
- end
- if (turbineSpeed_17 > 1850) and (turbine_17.getFluidFlowRateMax() ~= 0) then
- turbine_17.setFluidFlowRateMax(0)
- turbine_17.setInductorEngaged(true)
- end
- if (turbineSpeed_18 > 1850) and (turbine_18.getFluidFlowRateMax() ~= 0) then
- turbine_18.setFluidFlowRateMax(0)
- turbine_18.setInductorEngaged(true)
- 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
- if turbine_3.getFluidFlowRateMax() ~= 0 then
- turbine_3.setFluidFlowRateMax(0)
- end
- if turbine_3.getInductorEngaged() ~= false then
- turbine_3.setInductorEngaged(false)
- end
- if turbine_4.getFluidFlowRateMax() ~= 0 then
- turbine_4.setFluidFlowRateMax(0)
- end
- if turbine_4.getInductorEngaged() ~= false then
- turbine_4.setInductorEngaged(false)
- end
- if turbine_5.getFluidFlowRateMax() ~= 0 then
- turbine_5.setFluidFlowRateMax(0)
- end
- if turbine_5.getInductorEngaged() ~= false then
- turbine_5.setInductorEngaged(false)
- end
- if turbine_6.getFluidFlowRateMax() ~= 0 then
- turbine_6.setFluidFlowRateMax(0)
- end
- if turbine_6.getInductorEngaged() ~= false then
- turbine_6.setInductorEngaged(false)
- end
- if turbine_7.getFluidFlowRateMax() ~= 0 then
- turbine_7.setFluidFlowRateMax(0)
- end
- if turbine_7.getInductorEngaged() ~= false then
- turbine_7.setInductorEngaged(false)
- end
- if turbine_8.getFluidFlowRateMax() ~= 0 then
- turbine_8.setFluidFlowRateMax(0)
- end
- if turbine_8.getInductorEngaged() ~= false then
- turbine_8.setInductorEngaged(false)
- end
- if turbine_9.getFluidFlowRateMax() ~= 0 then
- turbine_9.setFluidFlowRateMax(0)
- end
- if turbine_9.getInductorEngaged() ~= false then
- turbine_9.setInductorEngaged(false)
- end
- if turbine_10.getFluidFlowRateMax() ~= 0 then
- turbine_10.setFluidFlowRateMax(0)
- end
- if turbine_10.getInductorEngaged() ~= false then
- turbine_10.setInductorEngaged(false)
- end
- if turbine_11.getFluidFlowRateMax() ~= 0 then
- turbine_11.setFluidFlowRateMax(0)
- end
- if turbine_11.getInductorEngaged() ~= false then
- turbine_11.setInductorEngaged(false)
- end
- if turbine_12.getFluidFlowRateMax() ~= 0 then
- turbine_12.setFluidFlowRateMax(0)
- end
- if turbine_12.getInductorEngaged() ~= false then
- turbine_12.setInductorEngaged(false)
- end
- if turbine_13.getFluidFlowRateMax() ~= 0 then
- turbine_13.setFluidFlowRateMax(0)
- end
- if turbine_13.getInductorEngaged() ~= false then
- turbine_13.setInductorEngaged(false)
- end
- if turbine_14.getFluidFlowRateMax() ~= 0 then
- turbine_14.setFluidFlowRateMax(0)
- end
- if turbine_14.getInductorEngaged() ~= false then
- turbine_14.setInductorEngaged(false)
- end
- if turbine_15.getFluidFlowRateMax() ~= 0 then
- turbine_15.setFluidFlowRateMax(0)
- end
- if turbine_15.getInductorEngaged() ~= false then
- turbine_15.setInductorEngaged(false)
- end
- if turbine_16.getFluidFlowRateMax() ~= 0 then
- turbine_16.setFluidFlowRateMax(0)
- end
- if turbine_16.getInductorEngaged() ~= false then
- turbine_16.setInductorEngaged(false)
- end
- if turbine_17.getFluidFlowRateMax() ~= 0 then
- turbine_17.setFluidFlowRateMax(0)
- end
- if turbine_17.getInductorEngaged() ~= false then
- turbine_17.setInductorEngaged(false)
- end
- if turbine_18.getFluidFlowRateMax() ~= 0 then
- turbine_18.setFluidFlowRateMax(0)
- end
- if turbine_18.getInductorEngaged() ~= false then
- turbine_18.setInductorEngaged(false)
- end
- end
- ------------------------------------------------------------------------------
- --monitor.drawBox(1,14,20,26)
- monitor.setCursorPos(1,1)
- monitor.write("Batterie Füllstand: "..capacitorInt.."%")
- monitor.setCursorPos(1,2)
- monitor.write("Max Turbine Speed: ".. turbineSpeedMax .."rpm")
- monitor.setCursorPos(1,3)
- monitor.write("Min Turbine Speed: ".. turbineSpeedMin .."rpm")
- monitor.setCursorPos(1,4)
- sleep(0.2)
- monitor.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement