SHOW:
|
|
- or go back to the newest paste.
1 | box1 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_12") | |
2 | box2 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_11") | |
3 | box3 = peripheral.wrap("tile_thermalexpansion_cell_basic_name_10") | |
4 | monitor = peripheral.wrap("monitor_116") | |
5 | ||
6 | function round(a,b) | |
7 | local m = 10^(b or 0) | |
8 | return math.floor(a * m + 0.5) / m | |
9 | end | |
10 | ||
11 | function maxStored(box) | |
12 | return box.getMaxEnergyStored() | |
13 | end | |
14 | ||
15 | function stored(box) | |
16 | return box.getEnergyStored() | |
17 | end | |
18 | ||
19 | function percentage(box) | |
20 | return round((stored(box) * 100) / maxStored(box), 2) | |
21 | end | |
22 | ||
23 | function start() | |
24 | print("Running energy system") | |
25 | monitor.write("Loading...") | |
26 | ||
27 | while true do | |
28 | monitor.clear() | |
29 | monitor.setCursorPos(1,1) | |
30 | monitor.write("Energy stored in the energy cells") | |
31 | monitor.setCursorPos(1,2) | |
32 | monitor.write("----------------------") | |
33 | monitor.setCursorPos(1,3) | |
34 | monitor.write("Box 1: "..stored(box1).."/"..maxStored(box1).." - "..percentage(box1).."%") | |
35 | monitor.setCursorPos(1,4) | |
36 | monitor.write("Box 2: "..stored(box2).."/"..maxStored(box2).." - "..percentage(box2).."%") | |
37 | monitor.setCursorPos(1,5) | |
38 | monitor.write("Box 3: "..stored(box3).."/"..maxStored(box3).." - "..percentage(box3).."%") | |
39 | - | start() |
39 | + | |
40 | end | |
41 | end | |
42 | ||
43 | - | --print(a.getEnergyStored()) |
43 | + | start() |