SHOW:
|
|
- or go back to the newest paste.
| 1 | local monitor = peripheral.wrap("monitor_1")
| |
| 2 | local capacitor = peripheral.wrap("tile_blockcapacitorbank_name_1")
| |
| 3 | local reactor = peripheral.wrap("BigReactors-Reactor_0")
| |
| 4 | local turbine_1 = peripheral.wrap("BigReactors-Turbine_0")
| |
| 5 | local turbine_2 = peripheral.wrap("BigReactors-Turbine_1")
| |
| 6 | local turbine_3 = peripheral.wrap("BigReactors-Turbine_2")
| |
| 7 | local turbine_4 = peripheral.wrap("BigReactors-Turbine_4")
| |
| 8 | ||
| 9 | monitor.setTextColor(1) | |
| 10 | monitor.setBackgroundColor(128) | |
| 11 | monitor.clear() | |
| 12 | local width, height = monitor.getSize() | |
| 13 | print("Monitor size: Columns:"..width..", Rows:"..height)
| |
| 14 | - | capacitorCount = 56 |
| 14 | + | |
| 15 | makePercent = 100 | |
| 16 | capacitorCount = 112 | |
| 17 | capacitorBasic = 1000000 | |
| 18 | capacitorStandard = 5000000 | |
| 19 | capacitorVibrant = 25000000 | |
| 20 | totalCapacity = (capacitorCount) * (capacitorVibrant) | |
| 21 | ||
| 22 | reactorRunning = false | |
| 23 | reactor.setActive(false) | |
| 24 | turbine_1.setActive(true) | |
| 25 | turbine_1.setInductorEngaged(false) | |
| 26 | turbine_2.setActive(true) | |
| 27 | turbine_2.setInductorEngaged(false) | |
| 28 | turbine_3.setActive(true) | |
| 29 | turbine_3.setInductorEngaged(false) | |
| 30 | turbine_4.setActive(true) | |
| 31 | turbine_4.setInductorEngaged(false) | |
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | while true do | |
| 37 | capacitorLevel = capacitor.getEnergyStored() | |
| 38 | capacitorAdjusted = (capacitorLevel) * (capacitorCount) | |
| 39 | capacitorFillPct = ((capacitorAdjusted) / (totalCapacity)) * (100) | |
| 40 | capacitorInt = math.floor(capacitorFillPct) | |
| 41 | ||
| 42 | reactorCasingTemp = math.floor(reactor.getCasingTemperature()) | |
| 43 | reactorRodLevel = reactor.getControlRodLevel(1) | |
| 44 | ||
| 45 | turbineSpeed_1 = math.floor(turbine_1.getRotorSpeed()) | |
| 46 | turbineSpeed_2 = math.floor(turbine_2.getRotorSpeed()) | |
| 47 | turbineSpeed_3 = math.floor(turbine_3.getRotorSpeed()) | |
| 48 | turbineSpeed_4 = math.floor(turbine_4.getRotorSpeed()) | |
| 49 | - | elseif (reactorCasingTemp >= 720) and (reactorRodLevel ~= 80) then |
| 49 | + | |
| 50 | - | reactor.setAllControlRodLevels(60) |
| 50 | + | |
| 51 | reactorRunning = true | |
| 52 | elseif (capacitorFillPct >=99) and (reactorRunning == true) then | |
| 53 | reactorRunning = false | |
| 54 | end | |
| 55 | ||
| 56 | if reactorRunning == true then | |
| 57 | reactor.setActive(true) | |
| 58 | if reactor.getActive() == false then | |
| 59 | reactor.setActive(true) | |
| 60 | end | |
| 61 | if reactorCasingTemp < 720 and (reactorRodLevel ~= 0) then | |
| 62 | reactor.setAllControlRodLevels(0) | |
| 63 | elseif (reactorCasingTemp >= 720) and (reactorRodLevel ~= 30) then | |
| 64 | reactor.setAllControlRodLevels(30) | |
| 65 | end | |
| 66 | if (reactorCasingTemp >= 720) then | |
| 67 | if (turbineSpeed_1 < 1780) and (turbine_1.getFluidFlowRateMax() ~= 2000) then | |
| 68 | turbine_1.setFluidFlowRateMax(2000) | |
| 69 | end | |
| 70 | if (turbineSpeed_2 < 1780) and (turbine_2.getFluidFlowRateMax() ~= 2000) then | |
| 71 | turbine_2.setFluidFlowRateMax(2000) | |
| 72 | end | |
| 73 | if (turbineSpeed_3 < 1780) and (turbine_3.getFluidFlowRateMax() ~= 2000) then | |
| 74 | turbine_3.setFluidFlowRateMax(2000) | |
| 75 | end | |
| 76 | if (turbineSpeed_4 < 1780) and (turbine_4.getFluidFlowRateMax() ~= 2000) then | |
| 77 | turbine_4.setFluidFlowRateMax(2000) | |
| 78 | end | |
| 79 | if (turbineSpeed_1 > 1780) and (turbineSpeed_1 <= 1850) and (turbine_1.getFluidFlowRateMax() ~= 2000) then | |
| 80 | turbine_1.setFluidFlowRateMax(2000) | |
| 81 | turbine_1.setInductorEngaged(true) | |
| 82 | end | |
| 83 | if (turbineSpeed_2 > 1780) and (turbineSpeed_2 <= 1850) and (turbine_2.getFluidFlowRateMax() ~= 2000) then | |
| 84 | turbine_2.setFluidFlowRateMax(2000) | |
| 85 | turbine_2.setInductorEngaged(true) | |
| 86 | end | |
| 87 | if (turbineSpeed_3 > 1780) and (turbineSpeed_3 <= 1850) and (turbine_3.getFluidFlowRateMax() ~= 2000) then | |
| 88 | turbine_3.setFluidFlowRateMax(2000) | |
| 89 | turbine_3.setInductorEngaged(true) | |
| 90 | end | |
| 91 | if (turbineSpeed_4 > 1780) and (turbineSpeed_4 <= 1850) and (turbine_4.getFluidFlowRateMax() ~= 2000) then | |
| 92 | turbine_4.setFluidFlowRateMax(2000) | |
| 93 | turbine_4.setInductorEngaged(true) | |
| 94 | end | |
| 95 | if (turbineSpeed_1 > 1850) and (turbine_1.getFluidFlowRateMax() ~= 0) then | |
| 96 | turbine_1.setFluidFlowRateMax(0) | |
| 97 | end | |
| 98 | if (turbineSpeed_2 > 1850) and (turbine_2.getFluidFlowRateMax() ~= 0) then | |
| 99 | turbine_2.setFluidFlowRateMax(0) | |
| 100 | end | |
| 101 | if (turbineSpeed_3 > 1850) and (turbine_3.getFluidFlowRateMax() ~= 0) then | |
| 102 | turbine_3.setFluidFlowRateMax(0) | |
| 103 | end | |
| 104 | if (turbineSpeed_4 > 1850) and (turbine_4.getFluidFlowRateMax() ~= 0) then | |
| 105 | turbine_4.setFluidFlowRateMax(0) | |
| 106 | end | |
| 107 | end | |
| 108 | end | |
| 109 | ||
| 110 | if reactorRunning == false then | |
| 111 | reactor.setActive(false) | |
| 112 | if reactor.getActive == true then | |
| 113 | reactor.setActive(false) | |
| 114 | end | |
| 115 | if turbine_1.getFluidFlowRateMax() ~= 0 then | |
| 116 | turbine_1.setFluidFlowRateMax(0) | |
| 117 | end | |
| 118 | if turbine_1.getInductorEngaged() ~= false then | |
| 119 | turbine_1.setInductorEngaged(false) | |
| 120 | end | |
| 121 | if turbine_2.getFluidFlowRateMax() ~= 0 then | |
| 122 | turbine_2.setFluidFlowRateMax(0) | |
| 123 | end | |
| 124 | if turbine_2.getInductorEngaged() ~= false then | |
| 125 | turbine_2.setInductorEngaged(false) | |
| 126 | end | |
| 127 | if turbine_3.getFluidFlowRateMax() ~= 0 then | |
| 128 | turbine_3.setFluidFlowRateMax(0) | |
| 129 | end | |
| 130 | if turbine_3.getInductorEngaged() ~= false then | |
| 131 | turbine_3.setInductorEngaged(false) | |
| 132 | end | |
| 133 | if turbine_4.getFluidFlowRateMax() ~= 0 then | |
| 134 | turbine_4.setFluidFlowRateMax(0) | |
| 135 | end | |
| 136 | if turbine_4.getInductorEngaged() ~= false then | |
| 137 | turbine_4.setInductorEngaged(false) | |
| 138 | end | |
| 139 | end | |
| 140 | ||
| 141 | --monitor.drawBox(1,14,20,26) | |
| 142 | monitor.setCursorPos(1,1) | |
| 143 | monitor.write(capacitorInt) | |
| 144 | monitor.setCursorPos(1,2) | |
| 145 | monitor.write(turbineSpeed_1) | |
| 146 | monitor.setCursorPos(1,3) | |
| 147 | monitor.write(turbineSpeed_2) | |
| 148 | monitor.setCursorPos(1,4) | |
| 149 | monitor.write(turbineSpeed_3) | |
| 150 | monitor.setCursorPos(1,5) | |
| 151 | monitor.write(turbineSpeed_4) | |
| 152 | sleep(0.2) | |
| 153 | monitor.clear() | |
| 154 | end |