SHOW:
|
|
- or go back to the newest paste.
| 1 | maxpower = 0 | |
| 2 | powerstored = 0 | |
| 3 | prevpower = 0 | |
| 4 | powerdif = 0 | |
| 5 | - | m = peripheral.wrap("monitor_0")
|
| 5 | + | m = peripheral.wrap("back")
|
| 6 | batteries = {
| |
| 7 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_0"),
| |
| 8 | - | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_1")
|
| 8 | + | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_1"),
|
| 9 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_2"),
| |
| 10 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_3"),
| |
| 11 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_4"),
| |
| 12 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_5"),
| |
| 13 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_6"),
| |
| 14 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_7"),
| |
| 15 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_8"),
| |
| 16 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_9"),
| |
| 17 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_10"),
| |
| 18 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_11"),
| |
| 19 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_12"),
| |
| 20 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_13"),
| |
| 21 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_14"),
| |
| 22 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_15"),
| |
| 23 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_16"),
| |
| 24 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_17"),
| |
| 25 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_18"),
| |
| 26 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_19"),
| |
| 27 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_20"),
| |
| 28 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_21"),
| |
| 29 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_22"),
| |
| 30 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_23"),
| |
| 31 | peripheral.wrap("tile_thermalexpansion_cell_resonant_name_24")
| |
| 32 | } | |
| 33 | ||
| 34 | for i = 1,#batteries do | |
| 35 | maxpower = maxpower + batteries[i].getMaxEnergyStored() | |
| 36 | end | |
| 37 | ||
| 38 | while true do | |
| 39 | sleep(1) | |
| 40 | prevpower = powerstored | |
| 41 | powerstored = 0 | |
| 42 | for i = 1,#batteries do | |
| 43 | powerstored = powerstored + batteries[i].getEnergyStored() | |
| 44 | end | |
| 45 | powerdif = math.ceil((powerstored-prevpower)/20) | |
| 46 | m.clear() | |
| 47 | m.setCursorPos(1, 1) | |
| 48 | m.setTextScale(2) | |
| 49 | m.write(" Bryceio's Power Monitor")
| |
| 50 | m.setCursorPos(1, 3) | |
| 51 | m.write("RF Stored:")
| |
| 52 | if m.isColor() and term.isColor() then | |
| 53 | if powerstored/maxpower < 1/3 then | |
| 54 | m.setTextColor(colors.red) | |
| 55 | elseif powerstored/maxpower >= 1/3 and powerstored/maxpower < 2/3 then | |
| 56 | m.setTextColor(colors.yellow) | |
| 57 | else | |
| 58 | m.setTextColor(colors.lime) | |
| 59 | end | |
| 60 | end | |
| 61 | m.setCursorPos(1, 4) | |
| 62 | m.write(powerstored.." ") | |
| 63 | if m.isColor() and term.isColor() then | |
| 64 | m.setTextColor(colors.white) | |
| 65 | end | |
| 66 | m.write("/ "..maxpower)
| |
| 67 | m.setCursorPos(1, 6) | |
| 68 | m.write("RF/T: ")
| |
| 69 | if powerdif >= 0 then | |
| 70 | if term.isColor() and m.isColor() then | |
| 71 | m.setTextColor(colors.lime) | |
| 72 | end | |
| 73 | m.write("+"..powerdif)
| |
| 74 | else | |
| 75 | if term.isColor() and m.isColor() then | |
| 76 | m.setTextColor(colors.red) | |
| 77 | end | |
| 78 | m.write(powerdif.." ") | |
| 79 | end | |
| 80 | if term.isColor() and m.isColor() then | |
| 81 | m.setTextColor(colors.white) | |
| 82 | end | |
| 83 | end |