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