SHOW:
|
|
- or go back to the newest paste.
| 1 | - | os.loadAPI "monAPI" |
| 1 | + | local turbine |
| 2 | - | local turbine1 |
| 2 | + | local reactor |
| 3 | - | local reactor1 |
| 3 | + | turbine = peripheral.wrap("left")
|
| 4 | - | local mon = monAPI.wrapMonitor("right")
|
| 4 | + | reactor = peripheral.wrap("BigReactors-Reactor_0")
|
| 5 | ||
| 6 | - | mon.setTextColor(colors.white) |
| 6 | + | function wipeScreen() |
| 7 | - | mon.setBackgroundColor(colors.black) |
| 7 | + | term.clear() |
| 8 | - | mon.clear() |
| 8 | + | term.setCursorPos(1, 1) |
| 9 | - | mon.setCursorPos(1,1) |
| 9 | + | end |
| 10 | - | mon.setTextScale(0.5) |
| 10 | + | |
| 11 | while true do | |
| 12 | - | local section1 = mon.createSection(1,1,20,19) |
| 12 | + | sleep(0) |
| 13 | - | section1.clear() |
| 13 | + | --Turbine Info |
| 14 | - | local section2 = mon.createSection(21,1,51,19) |
| 14 | + | turbine1capacitor = turbine.getEnergyStored() |
| 15 | - | section2.clear() |
| 15 | + | turbine1rpm = turbine.getRotorSpeed() |
| 16 | - | local section3 = mon.createSection(52,1,82,19) |
| 16 | + | turbine1RFT = turbine.getEnergyProducedLastTick() |
| 17 | - | section3.clear() |
| 17 | + | turbine1Flow = turbine.getFluidFlowRate() |
| 18 | --Reactor Info | |
| 19 | reactor1Temp = reactor.getFuelTemperature() | |
| 20 | reactor1Steam = reactor.getEnergyProducedLastTick() | |
| 21 | - | rednet.open("back")
|
| 21 | + | reactor1Fuel = reactor.getFuelConsumedLastTick() |
| 22 | - | id,message = rednet.receive() |
| 22 | + | --make table of info |
| 23 | t = {}
| |
| 24 | - | if id == 158 then |
| 24 | + | t["bank"] = 3 |
| 25 | - | section2.clear() |
| 25 | + | t["turbine1capacitor"] = turbine.getEnergyStored() |
| 26 | - | section2.drawBorder('#','#','+')
|
| 26 | + | t["turbine1rpm"] = turbine.getRotorSpeed() |
| 27 | - | section2.setCursorPos(2,3) |
| 27 | + | t["turbine1RFT"] = turbine.getEnergyProducedLastTick() |
| 28 | - | section2.write('Turbine - Reactor Bank 1')
|
| 28 | + | t["turbine1Flow"] = turbine.getFluidFlowRate() |
| 29 | - | section2.setCursorPos(2,4) |
| 29 | + | t["reactor1Temp"] = reactor.getFuelTemperature() |
| 30 | - | section2.write('Data Broadcast Received')
|
| 30 | + | t["reactor1Steam"] = reactor.getEnergyProducedLastTick() |
| 31 | - | section2.setCursorPos(2,5) |
| 31 | + | t["reactor1Fuel"] = reactor.getFuelConsumedLastTick() |
| 32 | - | section2.write('System Status')
|
| 32 | + | sleep(1) |
| 33 | - | section2.setCursorPos(2,6) |
| 33 | + | rednet.open("bottom")
|
| 34 | - | section2.write('Turbine:')
|
| 34 | + | rednet.send(160, t) |
| 35 | - | section2.setCursorPos(2,7) |
| 35 | + | |
| 36 | - | if message["turbine1rpm"] >= 1725 then |
| 36 | + | wipeScreen() |
| 37 | - | section2.setTextColor(colors.green) |
| 37 | + | print('Reactor - Turbine Monitor')
|
| 38 | - | elseif message["turbine1rpm"] >= 800 then |
| 38 | + | term.setCursorPos(1,2) |
| 39 | - | section2.setTextColor(colors.orange) |
| 39 | + | print('Data Broadcast Live')
|
| 40 | - | else |
| 40 | + | term.setCursorPos(1,3) |
| 41 | - | section2.setTextColor(colors.red) |
| 41 | + | print('System Status')
|
| 42 | - | end |
| 42 | + | term.setCursorPos(1,4) |
| 43 | - | section2.write('RPM: '..message["turbine1rpm"]..'')
|
| 43 | + | print('Turbine:')
|
| 44 | - | section2.setCursorPos(2,8) |
| 44 | + | term.setCursorPos(1,5) |
| 45 | - | section2.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
|
| 45 | + | print('RPM: '..turbine.getRotorSpeed()..'')
|
| 46 | - | section2.setCursorPos(2,9) |
| 46 | + | term.setCursorPos(1,6) |
| 47 | - | section2.write('Generation: '..message["turbine1RFT"]..' rf/t')
|
| 47 | + | print('Flow Rate: '..turbine.getFluidFlowRate()..'mb/t')
|
| 48 | - | section2.setCursorPos(2,10) |
| 48 | + | term.setCursorPos(1,7) |
| 49 | - | section2.write('Capacitor: '..message["turbine1capacitor"]..'')
|
| 49 | + | print('Generation: '..turbine.getEnergyProducedLastTick()..' rf/t')
|
| 50 | - | section2.setCursorPos(2,11) |
| 50 | + | term.setCursorPos(1,8) |
| 51 | - | section2.write('Reactor:')
|
| 51 | + | print('Capacitor: '..turbine.getEnergyStored()..'')
|
| 52 | - | section2.setCursorPos(2,12) |
| 52 | + | term.setCursorPos(1,10) |
| 53 | - | section2.write('Temp: '..message["reactor1Temp"]..'')
|
| 53 | + | print('Reactor:')
|
| 54 | - | section2.setCursorPos(2,13) |
| 54 | + | term.setCursorPos(1,11) |
| 55 | - | section2.write('Steam Pressure: '..message["reactor1Steam"]..'')
|
| 55 | + | print('Temp: '..reactor.getFuelTemperature()..'')
|
| 56 | - | section2.setCursorPos(2,14) |
| 56 | + | term.setCursorPos(1,12) |
| 57 | - | section2.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
|
| 57 | + | print('Steam Pressure: '..reactor.getEnergyProducedLastTick()..'')
|
| 58 | - | |
| 58 | + | term.setCursorPos(1,13) |
| 59 | - | elseif id == 159 then |
| 59 | + | print('Fuel Consumption: '..reactor.getFuelConsumedLastTick()..'')
|
| 60 | - | section3.clear() |
| 60 | + | end |