SHOW:
|
|
- or go back to the newest paste.
| 1 | - | os.loadAPI('monAPI')
|
| 1 | + | os.loadAPI "monAPI" |
| 2 | - | local mon = monAPI.wrapMonitor('left')
|
| 2 | + | local turbine1 |
| 3 | local reactor1 | |
| 4 | - | mon.setTextColour(colours.white) |
| 4 | + | local mon = monAPI.wrapMonitor("right")
|
| 5 | - | mon.setBackgroundColour(colours.black) |
| 5 | + | |
| 6 | mon.setTextColor(colors.white) | |
| 7 | - | mon.setCursorPos(1, 1) |
| 7 | + | mon.setBackgroundColor(colors.black) |
| 8 | mon.clear() | |
| 9 | - | local section1 = mon.createSection(1, 1, 7, 5) |
| 9 | + | mon.setCursorPos(1,1) |
| 10 | - | section1.setBackgroundColour(colours.orange) |
| 10 | + | mon.setTextScale(0.5) |
| 11 | ||
| 12 | - | section1.write('Hello')
|
| 12 | + | local section1 = mon.createSection(1,1,20,19) |
| 13 | - | section1.registerHitbox('tHello', 1, 1, 5, 1)
|
| 13 | + | |
| 14 | local section2 = mon.createSection(21,1,51,19) | |
| 15 | - | local section2 = mon.createSection(10, 12, 21, 21) |
| 15 | + | section2.clear() |
| 16 | - | section2.setTextColour(colours.lime) |
| 16 | + | local section3 = mon.createSection(52,1,82,19) |
| 17 | - | section2.drawBorder('-', '|', '+')
|
| 17 | + | section3.clear() |
| 18 | - | section2.setCursorPos(5,4) |
| 18 | + | |
| 19 | - | section2.write('Test')
|
| 19 | + | |
| 20 | while true do | |
| 21 | - | local section3 = mon.createSection(45, 18, 60, 19) |
| 21 | + | rednet.open("back")
|
| 22 | - | local w3, h3 = section3.getSize() |
| 22 | + | id,message = rednet.receive() |
| 23 | - | local sID3 = section3.getSectionID() |
| 23 | + | |
| 24 | - | section3.registerHitbox('click_here', 1, 1, w3, h3)
|
| 24 | + | if id == 158 then |
| 25 | - | function drawS3(showInfo) |
| 25 | + | section2.clear() |
| 26 | - | if showInfo then |
| 26 | + | section2.drawBorder('#','#','+')
|
| 27 | - | section3.clear() |
| 27 | + | section2.setCursorPos(2,3) |
| 28 | - | section3.setCursorPos(1,1) |
| 28 | + | section2.write('Turbine - Reactor Bank 1')
|
| 29 | - | section3.write('x, y: ' .. w3 .. ', ' .. h3)
|
| 29 | + | section2.setCursorPos(2,4) |
| 30 | - | section3.setCursorPos(1,2) |
| 30 | + | section2.write('Data Broadcast Received')
|
| 31 | - | section3.write('sectionID: ' .. sID3)
|
| 31 | + | section2.setCursorPos(2,5) |
| 32 | - | else |
| 32 | + | section2.write('System Status')
|
| 33 | - | section3.setBackgroundColour(colours.green) |
| 33 | + | section2.setCursorPos(2,6) |
| 34 | - | section3.clear() |
| 34 | + | section2.write('Turbine:')
|
| 35 | - | section3.setCursorPos(1, 1) |
| 35 | + | section2.setCursorPos(2,7) |
| 36 | - | section3.write('Click here!')
|
| 36 | + | if message["turbine1rpm"] >= 1725 then |
| 37 | - | end |
| 37 | + | section2.setTextColor(colors.green) |
| 38 | - | end |
| 38 | + | elseif message["turbine1rpm"] >= 800 then |
| 39 | - | local bDraw = false |
| 39 | + | section2.setTextColor(colors.orange) |
| 40 | - | drawS3(bDraw) |
| 40 | + | else |
| 41 | section2.setTextColor(colors.red) | |
| 42 | - | local section4 = mon.createSection(68, 32, 82, 40) |
| 42 | + | end |
| 43 | section2.write('RPM: '..message["turbine1rpm"]..'')
| |
| 44 | section2.setCursorPos(2,8) | |
| 45 | - | function checkForClick() |
| 45 | + | section2.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
|
| 46 | - | while true do |
| 46 | + | section2.setCursorPos(2,9) |
| 47 | - | local ev = {os.pullEvent()}
|
| 47 | + | section2.write('Generation: '..message["turbine1RFT"]..' rf/t')
|
| 48 | - | if ev[1] == 'monitor_touch' then |
| 48 | + | section2.setCursorPos(2,10) |
| 49 | - | local name, sectionID = mon.getHitbox(ev[3], ev[4]) |
| 49 | + | section2.write('Capacitor: '..message["turbine1capacitor"]..'')
|
| 50 | - | if name == 'click_here' then |
| 50 | + | section2.setCursorPos(2,11) |
| 51 | - | bDraw = not bDraw |
| 51 | + | section2.write('Reactor:')
|
| 52 | - | drawS3(bDraw) |
| 52 | + | section2.setCursorPos(2,12) |
| 53 | - | end |
| 53 | + | section2.write('Temp: '..message["reactor1Temp"]..'')
|
| 54 | - | end |
| 54 | + | section2.setCursorPos(2,13) |
| 55 | - | end |
| 55 | + | section2.write('Steam Pressure: '..message["reactor1Steam"]..'')
|
| 56 | - | end |
| 56 | + | section2.setCursorPos(2,14) |
| 57 | section2.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
| |
| 58 | - | function animate() |
| 58 | + | |
| 59 | - | while true do |
| 59 | + | elseif id == 159 then |
| 60 | - | section4.setBackgroundColour(colours.blue) |
| 60 | + | section3.clear() |
| 61 | - | section4.fill('o')
|
| 61 | + | section2.drawBorder('#','#','+')
|
| 62 | - | sleep(1) |
| 62 | + | section3.setCursorPos(2,3) |
| 63 | - | section4.setBackgroundColour(colours.lime) |
| 63 | + | section3.write('Turbine - Reactor Bank 2')
|
| 64 | - | section4.fill('O')
|
| 64 | + | section3.setCursorPos(2,4) |
| 65 | - | sleep(1) |
| 65 | + | section3.write('Data Broadcast Received')
|
| 66 | - | section4.setBackgroundColour(colours.red) |
| 66 | + | section3.setCursorPos(2,5) |
| 67 | - | section4.fill('0')
|
| 67 | + | section3.write('System Status')
|
| 68 | - | sleep(1) |
| 68 | + | section3.setCursorPos(2,6) |
| 69 | - | end |
| 69 | + | section3.write('Turbine:')
|
| 70 | - | end |
| 70 | + | section3.setCursorPos(2,7) |
| 71 | if message["turbine1rpm"] >= 1725 then | |
| 72 | - | parallel.waitForAll(animate, checkForClick) |
| 72 | + | mon.setTextColor(colors.green) |
| 73 | elseif message["turbine1rpm"] >= 800 then | |
| 74 | mon.setTextColor(colors.orange) | |
| 75 | else | |
| 76 | mon.setTextColor(colors.red) | |
| 77 | end | |
| 78 | section3.write('RPM: '..message["turbine1rpm"]..'')
| |
| 79 | section3.setCursorPos(2,8) | |
| 80 | if message["turbine1Flow"] >= 1950 then | |
| 81 | mon.setTextColor(colors.green) | |
| 82 | elseif message["turbine1Flow"] >= 1000 then | |
| 83 | mon.setTextColor(colors.orange) | |
| 84 | else | |
| 85 | mon.setTextColor(colors.red) | |
| 86 | end | |
| 87 | section3.write('Flow Rate: '..message["turbine1Flow"]..'mb/t')
| |
| 88 | section3.setCursorPos(2,9) | |
| 89 | if message["turbine1RFT"] >= 25000 then | |
| 90 | mon.setTextColor(colors.green) | |
| 91 | elseif message["turbine1RFT"] >= 14000 then | |
| 92 | mon.setTextColor(colors.orange) | |
| 93 | else | |
| 94 | mon.setTextColor(colors.red) | |
| 95 | end | |
| 96 | section3.write('Generation: '..message["turbine1RFT"]..' rf/t')
| |
| 97 | section3.setCursorPos(2,10) | |
| 98 | if message["turbine1capacitor"] >= 900000 then | |
| 99 | mon.setTextColor(colors.green) | |
| 100 | elseif message["turbine1capacitor"] >= 400000 then | |
| 101 | mon.setTextColor(colors.orange) | |
| 102 | else | |
| 103 | mon.setTextColor(colors.red) | |
| 104 | end | |
| 105 | section3.write('Capacitor: '..message["turbine1capacitor"]..'')
| |
| 106 | section3.setCursorPos(2,11) | |
| 107 | mon.setTextColor(colors.white) | |
| 108 | section3.write('Reactor:')
| |
| 109 | section3.setCursorPos(2,12) | |
| 110 | if message["reactor1Temp"] <= 700 then | |
| 111 | mon.setTextColor(colors.green) | |
| 112 | elseif message["reactor1Temp"] <= 800 then | |
| 113 | mon.setTextColor(colors.orange) | |
| 114 | else | |
| 115 | mon.setTextColor(colors.red) | |
| 116 | end | |
| 117 | section3.write('Temp: '..message["reactor1Temp"]..'')
| |
| 118 | section3.setCursorPos(2,13) | |
| 119 | if message["reactor1Steam"] >= 1950 then | |
| 120 | mon.setTextColor(colors.green) | |
| 121 | elseif message["reactor1Steam"] >= 1000 then | |
| 122 | mon.setTextColor(colors.orange) | |
| 123 | else | |
| 124 | mon.setTextColor(colors.red) | |
| 125 | end | |
| 126 | section3.write('Steam Pressure: '..message["reactor1Steam"]..'')
| |
| 127 | section3.setCursorPos(2,14) | |
| 128 | if message["reactor1Fuel"] <= 0.06 then | |
| 129 | mon.setTextColor(colors.green) | |
| 130 | elseif message["reactor1Fuel"] <= 0.05 then | |
| 131 | mon.setTextColor(colors.orange) | |
| 132 | else | |
| 133 | mon.setTextColor(colors.red) | |
| 134 | end | |
| 135 | section3.write('Fuel Consumption: '..message["reactor1Fuel"]..'')
| |
| 136 | end | |
| 137 | ||
| 138 | end |