SHOW:
|
|
- or go back to the newest paste.
| 1 | ||
| 2 | function Check() | |
| 3 | if peripheral.find("Induction Matrix") == nil then
| |
| 4 | - | if peripheral.find("Basic Energy Cube") == nil then
|
| 4 | + | |
| 5 | - | else cube = peripheral.find("Basic Energy Cube")
|
| 5 | + | |
| 6 | - | name = "Basic Energy Cube" |
| 6 | + | |
| 7 | return name | |
| 8 | - | if peripheral.find("Advanced Energy Cube") == nil then
|
| 8 | + | |
| 9 | - | else cube = peripheral.find("Advanced Energy Cube")
|
| 9 | + | |
| 10 | - | name = "Advanced Energy Cube" |
| 10 | + | |
| 11 | count = 0 | |
| 12 | - | if peripheral.find("Elite Energy Cube") == nil then
|
| 12 | + | |
| 13 | - | else cube = peripheral.find("Elite Energy Cube")
|
| 13 | + | |
| 14 | - | name = "Elite Energy Cube" |
| 14 | + | |
| 15 | used = '' | |
| 16 | - | if peripheral.find("Ultimate Energy Cube") == nil then
|
| 16 | + | |
| 17 | - | else cube = peripheral.find("Ultimate Energy Cube")
|
| 17 | + | |
| 18 | - | name = "Ultimate Energy Cube" |
| 18 | + | |
| 19 | count = count + 1 | |
| 20 | end | |
| 21 | for i=0, total - math.floor(percentage / 2) do | |
| 22 | empty = empty .. "-" | |
| 23 | count = count + 1 | |
| 24 | end | |
| 25 | ||
| 26 | t_monitor.setTextColor(colors.white) | |
| 27 | t_monitor.write(start) | |
| 28 | ||
| 29 | t_monitor.setTextColor(colors.white) | |
| 30 | t_monitor.write(used) | |
| 31 | ||
| 32 | t_monitor.setTextColor(colors.gray) | |
| 33 | t_monitor.write(empty) | |
| 34 | ||
| 35 | t_monitor.setTextColor(colors.white) | |
| 36 | t_monitor.write(last) | |
| 37 | return raw | |
| 38 | end | |
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | monitor = peripheral.wrap("right")
| |
| 43 | t_monitor = peripheral.wrap("top")
| |
| 44 | ||
| 45 | previous = 0 | |
| 46 | ||
| 47 | function eng_cube() | |
| 48 | monitor.clear() | |
| 49 | monitor.setCursorPos(1,1) | |
| 50 | monitor.setTextScale(0.8) | |
| 51 | monitor.write(string.format("Showing Data For [%s]", name))
| |
| 52 | ||
| 53 | max = cube.getMaxEnergy() | |
| 54 | monitor.setCursorPos(1,2) | |
| 55 | monitor.write(string.format("Capacity: %s J", max))
| |
| 56 | ||
| 57 | current = cube.getEnergy() | |
| 58 | e_in = current - previous | |
| 59 | previous = current | |
| 60 | monitor.setCursorPos(1,3) | |
| 61 | monitor.write(string.format("I/O(+/-): %s J/T", e_in))
| |
| 62 | ||
| 63 | monitor.setCursorPos(1,4) | |
| 64 | monitor.write(string.format("Stored : %s J", current))
| |
| 65 | end | |
| 66 | ||
| 67 | ||
| 68 | function matrix() | |
| 69 | ||
| 70 | monitor.clear() | |
| 71 | monitor.setCursorPos(1,1) | |
| 72 | monitor.setTextScale(0.9) | |
| 73 | monitor.write("Power Managment")
| |
| 74 | monitor.setCursorPos(1,2) | |
| 75 | monitor.write(string.format("[%s]", name))
| |
| 76 | ||
| 77 | max = cube.getMaxEnergy() | |
| 78 | monitor.setCursorPos(1,3) | |
| 79 | monitor.write(string.format("Capacity : %s J", max))
| |
| 80 | ||
| 81 | e_in = cube.getInput() | |
| 82 | monitor.setCursorPos(1,4) | |
| 83 | monitor.write(string.format("Receiving : %s J/T", e_in))
| |
| 84 | ||
| 85 | e_out = cube.getOutput() | |
| 86 | monitor.setCursorPos(1,5) | |
| 87 | monitor.write(string.format("Outputting : %s J/T", e_out))
| |
| 88 | ||
| 89 | current = cube.getEnergy() | |
| 90 | monitor.setCursorPos(1,6) | |
| 91 | monitor.write(string.format("Stored : %s J", current))
| |
| 92 | ||
| 93 | cur_perc = (current / max) * 100 | |
| 94 | cur_perc = math.floor(cur_perc+0.5) | |
| 95 | ||
| 96 | t_monitor.clear() | |
| 97 | t_monitor.setCursorPos(1,1) | |
| 98 | t_monitor.setTextScale(0.9) | |
| 99 | t_monitor.write(string.format("Stored : %s Percent", cur_perc))
| |
| 100 | ||
| 101 | t_monitor.setCursorPos(1,3) | |
| 102 | val_max = progress_bar(cur_perc) | |
| 103 | ||
| 104 | cap = cube.getTransferCap() | |
| 105 | out_perc = (e_out / cap) * 100 | |
| 106 | out_perc = math.floor(out_perc+0.5) | |
| 107 | t_monitor.setCursorPos(1,5) | |
| 108 | t_monitor.write(string.format("Outputting : %s Percent", out_perc))
| |
| 109 | ||
| 110 | ||
| 111 | t_monitor.setCursorPos(1,6) | |
| 112 | val_out = progress_bar(out_perc) | |
| 113 | ||
| 114 | ||
| 115 | in_perc = (e_in / cap) * 100 | |
| 116 | in_perc = math.floor(in_perc+0.5) | |
| 117 | t_monitor.setCursorPos(1,8) | |
| 118 | t_monitor.write(string.format("Receiving : %s Percent", in_perc))
| |
| 119 | ||
| 120 | ||
| 121 | t_monitor.setCursorPos(1,9) | |
| 122 | val_in = progress_bar(in_perc) | |
| 123 | ||
| 124 | end | |
| 125 | ||
| 126 | while true do | |
| 127 | Check() | |
| 128 | if name == "Induction Matrix" | |
| 129 | then | |
| 130 | matrix() | |
| 131 | sleep(0.1) | |
| 132 | else | |
| 133 | eng_cube() | |
| 134 | sleep(0.05) | |
| 135 | end | |
| 136 | end | |
| 137 | ||
| 138 |