SHOW:
|
|
- or go back to the newest paste.
1 | --Don't need this | |
2 | function pack(...) | |
3 | - | local mon = peripheral.wrap("monitor_0") |
3 | + | retVal = {} |
4 | for i, v in ipairs(arg) do | |
5 | - | mon.clear() |
5 | + | table.insert(retVal, v) |
6 | - | mon.setTextColor(colors.white) |
6 | + | end |
7 | - | mon.setTextScale(1) |
7 | + | return retVal |
8 | end | |
9 | ||
10 | - | mon.setCursorPos(1,1) |
10 | + | --Don't need this either |
11 | - | mon.write("STATUS: ") |
11 | + | function writeToMonitors(monitors, word) |
12 | - | if reactor1.getActive(true) then |
12 | + | for i, v in ipairs(monitors) do |
13 | - | mon.setBackgroundColor(colors.lime) |
13 | + | v.setCursorPos(1,1) |
14 | - | mon.write("ACTIVE") |
14 | + | v.write(word) |
15 | - | else |
15 | + | end |
16 | - | mon.setBackgroundColor(colors.red) |
16 | + | |
17 | - | mon.write("INACTIVE") |
17 | + | |
18 | function getAllPeripherals(filter) | |
19 | retVal = {} | |
20 | - | mon.setBackgroundColor(colors.black) |
20 | + | filter = filter or false |
21 | peripherals = peripheral.getNames() | |
22 | - | mon.setCursorPos(1,4) |
22 | + | if not filter then |
23 | - | mon.write("Energy Production: " .. math.floor(reactor1.getEnergyProducedLastTick()) .. " RF/t") |
23 | + | return peripherals |
24 | end | |
25 | - | mon.setCursorPos(1,5) |
25 | + | for i,v in ipairs(peripherals) do |
26 | - | mon.write("Energy Stored: " .. math.floor(reactor1.getEnergyStored()) .. " RF") |
26 | + | if peripheral.getType(v) == filter then |
27 | table.insert(retVal, peripheral.wrap(v)) | |
28 | - | mon.setCursorPos(1,7) |
28 | + | end |
29 | - | mon.write("Fuel Tank " .. reactor1.getFuelAmountMax() .. " mB") |
29 | + | end |
30 | return retVal | |
31 | end | |
32 | - | mon.setCursorPos(1,8) |
32 | + | |
33 | - | mon.write("Fuel Available: " .. math.floor(reactor1.getFuelAmount()) .. " mB") |
33 | + | |
34 | ||
35 | - | mon.setCursorPos(1,9) |
35 | + | monitors = getAllPeripherals("monitor") |
36 | - | mon.write("Fuel Usage: " .. reactor1.getFuelConsumedLastTick() .. " mB/t") |
36 | + | |
37 | local reactor1 = peripheral.wrap("BigReactors-Reactor_0") | |
38 | - | mon.setCursorPos(1,10) |
38 | + | |
39 | - | mon.write("Fuel Temperature: " .. math.floor(reactor1.getFuelTemperature()) .." C") |
39 | + | |
40 | for i,v in ipairs(monitors) do | |
41 | - | mon.setCursorPos(1,11) |
41 | + | |
42 | - | mon.write("Casing Temperature:" .. math.floor(reactor1.getCasingTemperature()) .. " C") |
42 | + | |
43 | local mon = v | |
44 | - | sleep(5) |
44 | + | |
45 | mon.clear() | |
46 | mon.setTextColor(colors.white) | |
47 | mon.setTextScale(1) | |
48 | ||
49 | ||
50 | mon.setCursorPos(1,1) | |
51 | mon.write("STATUS: ") | |
52 | ||
53 | if reactor1.getActive(true) then | |
54 | mon.setBackgroundColor(colors.lime) | |
55 | mon.write("ACTIVE") | |
56 | else | |
57 | mon.setBackgroundColor(colors.red) | |
58 | mon.write("INACTIVE") | |
59 | end | |
60 | ||
61 | mon.setBackgroundColor(colors.black) | |
62 | ||
63 | mon.setCursorPos(1,4) | |
64 | mon.write("Energy Production: " .. math.floor(reactor1.getEnergyProducedLastTick()) .. " RF/t") | |
65 | ||
66 | mon.setCursorPos(1,5) | |
67 | mon.write("Energy Stored: " .. math.floor(reactor1.getEnergyStored()) .. " RF") | |
68 | ||
69 | mon.setCursorPos(1,7) | |
70 | mon.write("Fuel Tank " .. reactor1.getFuelAmountMax() .. " mB") | |
71 | ||
72 | ||
73 | mon.setCursorPos(1,8) | |
74 | mon.write("Fuel Available: " .. math.floor(reactor1.getFuelAmount()) .. " mB") | |
75 | ||
76 | mon.setCursorPos(1,9) | |
77 | mon.write("Fuel Usage: " .. reactor1.getFuelConsumedLastTick() .. " mB/t") | |
78 | ||
79 | mon.setCursorPos(1,10) | |
80 | mon.write("Fuel Temperature: " .. math.floor(reactor1.getFuelTemperature()) .." C") | |
81 | ||
82 | mon.setCursorPos(1,11) | |
83 | mon.write("Casing Temperature:" .. math.floor(reactor1.getCasingTemperature()) .. " C") | |
84 | end | |
85 | sleep(5) | |
86 | end |