SHOW:
|
|
- or go back to the newest paste.
1 | print('ReactorControl Engaged. View Monitor.') | |
2 | ||
3 | emptyflag=0 | |
4 | offlineflag=0 | |
5 | flashflag=0 | |
6 | ||
7 | reactorA=peripheral.wrap('BigReactors-Reactor_1') | |
8 | reactorB=peripheral.wrap('BigReactors-Reactor_0') | |
9 | monitor=peripheral.wrap('top') | |
10 | ||
11 | monitor.setTextScale(1) | |
12 | monitor.setBackgroundColor(colors.black) | |
13 | ||
14 | while true do | |
15 | monitor.clear() | |
16 | monitor.setCursorPos(1,1) | |
17 | monitor.setTextColor(colors.white) | |
18 | monitor.write('Fuel Level:') | |
19 | monitor.setCursorPos(1,2) | |
20 | monitor.setTextColor(colors.yellow) | |
21 | monitor.write(math.floor((((reactorA.getFuelAmount()+reactorB.getFuelAmount())/(reactorA.getFuelAmountMax()+reactorB.getFuelAmountMax()))*100)+0.5)..'% Fuel') | |
22 | monitor.setCursorPos(1,3) | |
23 | monitor.setTextColor(colors.lightBlue) | |
24 | monitor.write(math.floor((((reactorA.getWasteAmount()+reactorB.getWasteAmount())/(reactorA.getFuelAmountMax()+reactorB.getFuelAmountMax()))*100)+0.5)..'% Waste') | |
25 | monitor.setCursorPos(1,5) | |
26 | monitor.setTextColor(colors.white) | |
27 | monitor.write('Control Rod Levels:') | |
28 | monitor.setTextColor(colors.green) | |
29 | monitor.setCursorPos(1,6) | |
30 | monitor.write('Rod 1a: '..(100-(reactorA.getControlRodLevel(0)))..'% Depth') | |
31 | monitor.setCursorPos(22,6) | |
32 | monitor.write('Rod 1b: '..(100-(reactorB.getControlRodLevel(0)))..'% Depth') | |
33 | monitor.setCursorPos(1,7) | |
34 | monitor.write('Rod 2a: '..(100-(reactorA.getControlRodLevel(1)))..'% Depth') | |
35 | monitor.setCursorPos(22,7) | |
36 | monitor.write('Rod 2b: '..(100-(reactorB.getControlRodLevel(1)))..'% Depth') | |
37 | monitor.setCursorPos(1,8) | |
38 | monitor.write('Rod 3a: '..(100-(reactorA.getControlRodLevel(2)))..'% Depth') | |
39 | monitor.setCursorPos(22,8) | |
40 | monitor.write('Rod 3b: '..(100-(reactorB.getControlRodLevel(2)))..'% Depth') | |
41 | monitor.setCursorPos(1,9) | |
42 | monitor.write('Rod 4a: '..(100-(reactorA.getControlRodLevel(3)))..'% Depth') | |
43 | monitor.setCursorPos(22,9) | |
44 | monitor.write('Rod 4b: '..(100-(reactorB.getControlRodLevel(3)))..'% Depth') | |
45 | monitor.setCursorPos(1,10) | |
46 | monitor.write('Rod 5a: '..(100-(reactorA.getControlRodLevel(4)))..'% Depth') | |
47 | monitor.setCursorPos(22,10) | |
48 | monitor.write('Rod 5b: '..(100-(reactorB.getControlRodLevel(4)))..'% Depth') | |
49 | monitor.setCursorPos(1,12) | |
50 | monitor.setTextColor(colors.white) | |
51 | monitor.write('Temperature:') | |
52 | monitor.setCursorPos(1,13) | |
53 | if reactorA.getTemperature()>=650 then | |
54 | monitor.setTextColor(colors.purple) | |
55 | else if reactorA.getTemperature()>=950 then | |
56 | monitor.setTextColor(colors.red) | |
57 | else | |
58 | monitor.setTextColor(colors.green) | |
59 | end | |
60 | end | |
61 | monitor.write('Reactor A: '..reactorA.getTemperature()..'C') | |
62 | monitor.setCursorPos(1,14) | |
63 | if reactorB.getTemperature()>=650 then | |
64 | monitor.setTextColor(colors.purple) | |
65 | else if reactorB.getTemperature()>=950 then | |
66 | monitor.setTextColor(colors.red) | |
67 | else | |
68 | monitor.setTextColor(colors.green) | |
69 | end | |
70 | end | |
71 | monitor.write('Reactor B: '..reactorB.getTemperature()..'C') | |
72 | monitor.setCursorPos(1,16) | |
73 | monitor.setTextColor(colors.white) | |
74 | monitor.write('Flux:') | |
75 | monitor.setCursorPos(1,17) | |
76 | monitor.setTextColor(colors.green) | |
77 | monitor.write('Reactor A: '..reactorA.getEnergyStored()..' RF Stored ') | |
78 | ||
79 | if reactorA.getEnergyProducedLastTick()>=500 and reactorA.getEnergyProducedLastTick()<2000 then | |
80 | monitor.setTextColor(colors.orange) | |
81 | end | |
82 | ||
83 | if reactorA.getEnergyProducedLastTick()>=2000 then | |
84 | monitor.setTextColor(colors.red) | |
85 | end | |
86 | monitor.write((math.floor(reactorA.getEnergyProducedLastTick()+0.5))..'RF/t') | |
87 | ||
88 | monitor.setCursorPos(1,18) | |
89 | monitor.setTextColor(colors.green) | |
90 | monitor.write('Reactor B: '..reactorB.getEnergyStored()..' RF Stored ') | |
91 | ||
92 | if reactorB.getEnergyProducedLastTick()>=500 and reactorB.getEnergyProducedLastTick()<2000 then | |
93 | monitor.setTextColor(colors.orange) | |
94 | end | |
95 | ||
96 | if reactorB.getEnergyProducedLastTick()>=2000 then | |
97 | monitor.setTextColor(colors.red) | |
98 | end | |
99 | monitor.write((math.floor(reactorB.getEnergyProducedLastTick()+0.5))..'RF/t') | |
100 | ||
101 | monitor.setCursorPos(1,20) | |
102 | monitor.setTextColor(colors.orange) | |
103 | monitor.write('Warnings:') | |
104 | ||
105 | if flashflag==0 then | |
106 | flashflag=1 | |
107 | if offlineflag==1 then | |
108 | monitor.setCursorPos(1,21) | |
109 | monitor.setTextColor(colors.lightGray) | |
110 | monitor.write('OFFLINE - Manual Override') | |
111 | end | |
112 | if emptyflag==1 then | |
113 | monitor.setCursorPos(1,21) | |
114 | monitor.setTextColor(colors.pink) | |
115 | monitor.write('OFFLINE - Fuel Exhausted') | |
116 | end | |
117 | if emptyflag==0 and offlineflag==0 and reactorA.getControlRodLevel(0)>75 then | |
118 | monitor.setCursorPos(1,21) | |
119 | monitor.setTextColor(colors.yellow) | |
120 | monitor.write('ONLINE - Low Power Mode') | |
121 | end | |
122 | if emptyflag==0 and offlineflag==0 and reactorA.getControlRodLevel(0)<=75 then | |
123 | monitor.setCursorPos(1,21) | |
124 | monitor.setTextColor(colors.orange) | |
125 | monitor.write('ONLINE - High Power Mode') | |
126 | end | |
127 | else | |
128 | flashflag=0 | |
129 | monitor.setCursorPos(1,21) | |
130 | monitor.clearLine() | |
131 | end | |
132 | ||
133 | if reactorA.getEnergyStored()<=10000000 and reactorA.getEnergyStored()>100 then | |
134 | reactorA.setAllControlRodLevels(0+(math.floor(reactorA.getEnergyStored()/100000))) | |
135 | else | |
136 | reactorA.setAllControlRodLevels(0) | |
137 | end | |
138 | ||
139 | if reactorB.getEnergyStored()<=10000000 and reactorB.getEnergyStored()>100 then | |
140 | reactorB.setAllControlRodLevels(0+(math.floor(reactorB.getEnergyStored()/100000))) | |
141 | else | |
142 | reactorB.setAllControlRodLevels(0) | |
143 | end | |
144 | ||
145 | if (reactorA.getFuelAmount()<=100 or reactorB.getFuelAmount()<=100) and offlineflag==0 then | |
146 | reactorA.setAllControlRodLevels(100) | |
147 | reactorA.setActive(false) | |
148 | reactorB.setAllControlRodLevels(100) | |
149 | reactorB.setActive(false) | |
150 | emptyflag=1 | |
151 | else | |
152 | emptyflag=0 | |
153 | end | |
154 | ||
155 | if rs.getInput('bottom')==false and emptyflag==0 then | |
156 | reactorA.setActive(true) | |
157 | reactorB.setActive(true) | |
158 | offlineflag=0 | |
159 | end | |
160 | ||
161 | if rs.getInput('bottom')==true and emptyflag==0 then | |
162 | reactorA.setActive(false) | |
163 | reactorA.setAllControlRodLevels(100) | |
164 | reactorB.setActive(false) | |
165 | reactorB.setAllControlRodLevels(100) | |
166 | offlineflag=1 | |
167 | end | |
168 | sleep(1) | |
169 | end |