· 4 months ago · May 27, 2025, 12:35 PM
1--[[
2Dies ist die erste Funktion, die bei Programmstart aufgeführt wird. Die darin aufgerufenen Funktionen initialisieren das Programm und alle notwendigen Variablen. Darüber hinaus werden alle Anzeigefenster erzeugt.
3]]
4
5function programInitialize()
6 systemStart()
7 configTable = config.load()
8 config.check()
9
10 if debugLevel == 0 then
11 handler(globalVariables)
12 elseif debugLevel == 1 then
13 globalVariables()
14 end
15
16 globalTables()
17 windowCreate.foundation()
18 windowCreate.interface()
19 windowCreate.aboutAutor()
20 windowCreate.optionMain()
21 windowCreate.pageMain()
22 windowCreate.pageRF()
23 windowCreate.pageFuel()
24 windowCreate.pageEfficiency()
25 windowCreate.optionSetting()
26 windowCreate.systemControl()
27 reactorAutostart()
28end
29
30
31--[[
32In dieser Funktion wird der optische Start des Programms durchgeführt. Anzeigen auf dem Terminal und dem angeschlossenen Monitor erscheinen. Zudem wird hier die initialisierung der Peripherie eingeleitet.
33]]
34
35function systemStart()
36 peripheralInitialize()
37 windowCreate.bootScreen()
38 monitor.clear()
39 display.bootScreen("PC fährt hoch...")
40 term.clear()
41 term.setTextColor(colors.white)
42 term.setCursorPos(1,1)
43 print("Reaktoranzeige Stavros V.: 1.1")
44 print("Powered by PlatinKinggg")
45 sleep(0.75)
46 term.setTextColor(colors.red)
47 print("Initialisiere")
48 sleep(1)
49 term.setTextColor(colors.white)
50 print(".")
51 sleep(0.5)
52 print("..")
53 sleep(0.5)
54 print("...")
55 sleep(0.5)
56 term.setTextColor(colors.red)
57 print("Suche nach Programmkonflikten startet jetzt")
58 term.setTextColor(colors.green)
59 print("Keine Initialisierungsfehler detektiert")
60 print("Beginne mit Anzeige")
61 sleep(0.5)
62 term.clear()
63 term.setTextColor(colors.white)
64 term.setCursorPos(1,1)
65 print("Reaktoranzeige Stavros V.: 1.1")
66 print("Powered by PlatinKinggg")
67 term.setTextColor(colors.red)
68 print(" ")
69 print("Drücke Entf um das System neuzustarten")
70 term.setTextColor(colors.white)
71end
72
73
74--[[
75In dieser Funktion werden die Peripheriegeräte Turbinen, Monitor und Alaram hier initialisiert und mit einem Wrap versehen.
76]]
77
78--[[
79Folgende Big Reactor - Turbinen API Methoden sind vorhanden (MC Version 1.12.2):
80ID-Entry | Method
811 getActive
822 getBladeEfficiency
833 getConnected
844 getEnergyCapacity
855 getEnergyProducedLastTick
866 getEnergyStats
877 getEnergyStored
888 getFluidAmountMax
899 getFluidFlowRate
9010 getFluidFlowRateMax
9111 getFluidFlowRateMaxMax
9212 getInductorEngaged
9313 getInputAmount
9414 getInputType
9515 getMaximumCoordinate
9616 getMinimumCoordinate
9717 getMultiblockAssembled
9818 getNumberofBlades
9919 getOutputAmount
10020 getOutputType
10121 getRotorMass
10222 getRotorSpeed
10323 help
10424 isMethodAvailable
10525 mbGetMaximumCoordinate
10626 mbGetMinimumCoordinate
10727 mbGetMultiblockControllerTypeName
10828 mbIsAssembled
10929 mbIsConnected
11030 mbIsDisassembled
11131 mbIsPaused
11232 setActive
11333 setFluidFlowRateMax
11434 setInductorEngaged
11535 setVentAll
11636 setVentNone
11737 setVentOverflow
118]]
119
120function peripheralInitialize()
121 for key, value in pairs(peripheral.getNames()) do
122 if peripheral.getType(value) == "BigReactors-Reactor" then
123 reactor = peripheral.wrap(value)
124 elseif peripheral.getType(value) == "monitor" then
125 monitor = peripheral.wrap(value)
126 elseif peripheral.getType(value) == "industrialAlarm" then
127 alarm = peripheral.wrap(value)
128 end
129 end
130 sleep(1)
131 if reactor == nil then
132 print("An das Netzwerk ist kein Reaktor angeschlossen")
133 print("Programm wird gestoppt und der CC-Computer in 10 Sekunden neugestartet")
134 sleep(10)
135 os.reboot()
136 elseif monitor == nil then
137 print("An das Netzwerk ist kein Monitor angeschlossen")
138 print("Programm wird gestoppt und der CC-Computer in 10 Sekunden neugestartet")
139 sleep(10)
140 os.reboot()
141 end
142 monitorCheck()
143 monitor.setBackgroundColor(colors.black)
144 monitor.clear()
145end
146
147function monitorCheck()
148 monitorWidth, monitorHeight = monitor.getSize()
149 if monitorWidth < 39 then
150 print("Bildschirm nicht Breit genug! Bitte den Monitor auf 4 Blöcke Breite erweitern")
151 sleep(1)
152 print("Programm wird gestoppt und der CC-Computer in 10 Sekunden neugestartet")
153 sleep(10)
154 os.reboot()
155 elseif monitorHeight < 19 then
156 print("Bildschirm nicht Hoch genug! Bitte den Monitor auf 3 Blöcke Breite erweitern")
157 sleep(1)
158 print("Programm wird gestoppt und der CC-Computer in 10 Sekunden neugestartet")
159 sleep(10)
160 os.reboot()
161 end
162end
163
164function globalVariables()
165 configTableText = {}
166 configTableInfo = {}
167
168 configTableInfo[1] = "Auswahl Programmsprache:"
169 configTableText[1] = {"Deutsch", "Englisch"}
170 if configTable[1] == 1 then
171 --WIP: Table language <- Table Deutsch
172 elseif configTable[1] == 2 then
173 --WIP: Table language <- Table Englisch
174 end
175
176 configTableInfo[2] = "Reaktor startet bei Programmstart:"
177 configTableText[2] = {"Aktiv", "Kein Autostart"}
178 if configTable[2] == 1 then
179 autostart = true
180 else
181 autostart = false
182 end
183
184 configTableInfo[3] = "Format Uhrzeitanzeige:"
185 configTableText[3] = {"24 Stunden Anzeige ohne Uhr Suffix", "24 Stunden Anzeige mit Uhr Suffix", "AM/PM Zeit mit AM/PM Suffix", "AM/PM Zeit ohne AM/PM Suffix"}
186 if configTable[3] == 1 then
187 dayTime = os.date("%R") -- 24 Stunden Anzeige ohne "Uhr" Suffix
188 elseif configTable[3] == 2 then
189 dayTime = os.date("%R Uhr") -- 24 Stunden Anzeige mit "Uhr" Suffix
190 elseif configTable[3] == 3 then
191 dayTime = os.date("%I:%M") -- AM/PM Zeit ohne "AM/PM" Suffix
192 elseif configTable[3] == 4 then
193 dayTime = os.date("%I:%M %p") -- AM/PM Zeit mit "AM/PM" Suffix
194 end
195
196 configTableInfo[4] = "Format Datumsanzeige:"
197 configTableText[4] = {"Datumsangabe Deutsch", "Datumsangabe Englisch I", "Datumsangabe Englisch II", "Datumsangabe Europäisch"}
198 if configTable[4] == 1 then
199 dateTime = os.date("%d.%m.%Y") -- Datumsangabe Deutsch
200 elseif configTable[4] == 2 then
201 dateTime = os.date("%d/%m/%Y") -- Datumsangabe Englisch I
202 elseif configTable[4] == 3 then
203 dateTime = os.date("%m/%d/%Y") -- Datumsangabe Englisch II
204 elseif configTable[4] == 4 then
205 dateTime = os.date("%Y/%m/%d") -- Datumsangabe Europäisch
206 end
207
208 configTableInfo[5] = "Startseite bei Programmstart:"
209 configTableText[5] = {"Übersicht", "Energieproduktion", "Brennstoff-Info", "Brennstoff-Effizienz"}
210 if page == nil then
211 if configTable[5] == 1 then
212 page = 1
213 pageHeader = "Übersicht"
214 elseif configTable[5] == 2 then
215 page = 2
216 pageHeader = "Energieproduktion"
217 elseif configTable[5] == 3 then
218 page = 3
219 pageHeader = "Brennstoff-Info"
220 elseif configTable[5] == 4 then
221 page = 4
222 pageHeader = "Brennstoff-Effizienz"
223 end
224 end
225
226 for i = 6, 12, 1 do
227 local variableName
228 if configTable[i] == 1 then
229 variableName = colors.white
230 elseif configTable[i] == 2 then
231 variableName = colors.orange
232 elseif configTable[i] == 3 then
233 variableName = colors.magenta
234 elseif configTable[i] == 4 then
235 variableName = colors.lightBlue
236 elseif configTable[i] == 5 then
237 variableName = colors.yellow
238 elseif configTable[i] == 6 then
239 variableName = colors.lime
240 elseif configTable[i] == 7 then
241 variableName = colors.pink
242 elseif configTable[i] == 8 then
243 variableName = colors.gray
244 elseif configTable[i] == 9 then
245 variableName = colors.lightGray
246 elseif configTable[i] == 10 then
247 variableName = colors.cyan
248 elseif configTable[i] == 11 then
249 variableName = colors.purple
250 elseif configTable[i] == 12 then
251 variableName = colors.blue
252 elseif configTable[i] == 13 then
253 variableName = colors.brown
254 elseif configTable[i] == 14 then
255 variableName = colors.green
256 elseif configTable[i] == 15 then
257 variableName = colors.red
258 elseif configTable[i] == 16 then
259 variableName = colors.black
260 end
261 if i == 6 then
262 configTableInfo[i] = "Hintergrundfarbe Tastenleiste:"
263 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
264 backgroundWindowBackgroundColor = variableName
265 elseif i == 7 then
266 configTableInfo[i] = "Hintergrundfarbe der Tasten:"
267 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
268 buttonWindowBackgroundColor = variableName
269 elseif i == 8 then
270 configTableInfo[i] = "Schriftfarbe der Tasten:"
271 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
272 buttonWindowTextColor = variableName
273 elseif i == 9 then
274 configTableInfo[i] = "Hintergrundfarbe der Header/Datum Anzeige:"
275 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
276 textWindowBackgroundColor = variableName
277 elseif i == 10 then
278 configTableInfo[i] = "Schriftfarbe der Header/Datum Anzeige:"
279 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
280 textWindowTextColor = variableName
281 elseif i == 11 then
282 configTableInfo[i] = "Hintergrundfarbe der Seite Übersicht:"
283 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
284 paigeMainBackgroundColor = variableName
285 elseif i == 12 then
286 configTableInfo[i] = "Schriftfarbe der Seite Übersicht:"
287 configTableText[i] = {"Weiß", "Orange", "Magenta", "Hellblau", "Gelb", "Limette", "Pink", "Grau", "HellGrau", "Cyan", "Lila", "Blau", "Braun", "Grün", "Rot", "Schwarz"}
288 paigeMainTextColor = variableName
289 end
290 end
291
292 if fuelBurnedLastTick == nil then
293 fuelBurnedLastTick = {}
294 end
295
296 fuelBurnedLastTickRaw = reactor.getFuelConsumedLastTick()
297
298 if fuelBurnedLastTickRaw < 1 then
299 fuelBurnedLastTick [1] = string.format("%.3f", reactor.getFuelConsumedLastTick())
300 fuelBurnedLastTick [2] = " mB/Tick"
301 elseif fuelBurnedLastTickRaw < 1000 then
302 fuelBurnedLastTick [1] = string.format("%.1f", reactor.getFuelConsumedLastTick())
303 fuelBurnedLastTick [2] = " mB/Tick"
304 elseif fuelBurnedLastTickRaw < 1000000 then
305 fuelBurnedLastTick [1] = string.format("%.32f", (reactor.getFuelConsumedLastTick() / 1000))
306 fuelBurnedLastTick [2] = " B/Tick"
307 end
308
309 if fuelAmount == nil then
310 fuelAmount = {}
311 end
312
313 fuelAmountRaw = reactor.getFuelAmount()
314 if fuelAmountRaw < 1000 then
315 fuelAmount[1] = reactor.getFuelAmount()
316 fuelAmount[2] = " mB"
317 elseif fuelAmountRaw < 1000000 then
318 fuelAmount[1] = reactor.getFuelAmount() / 1000
319 fuelAmount[2] = " B"
320 elseif fuelAmountRaw < 1000000000 then
321 fuelAmount[1] = reactor.getFuelAmount() / 1000000
322 fuelAmount[2] = " KB"
323 end
324
325 fuelTankCapacity = reactor.getFuelAmountMax()
326 fuelAmountPercent = math.ceil((fuelAmountRaw / fuelTankCapacity) * 100)
327 fuelConsumendLastTick = reactor.getFuelConsumedLastTick()
328 fuelTemperature = math.ceil(reactor.getFuelTemperature())
329 ejectWaste = reactor.doEjectWaste
330 fuelTankWaste = reactor.getWasteAmount()
331 fuelReactivity = reactor.getFuelReactivity()
332 reactorActive = reactor.getActive()
333 connected = reactor.getConnected()
334 setAllControlRodLevels = reactor.setAllControlRodLevels
335 setActive = reactor.setActive
336 casingTemperature = reactor.getCasingTemperature()
337 controlRodCount = reactor.getNumberOfControlRods()
338 getControlRodLevel = reactor.getControlRodLevel(0)
339
340 if reactor.isActivelyCooled() then
341 activeCooling = true
342 hotFluidProducedLastTick = reactor.getHotFluidProducedLastTick()
343 coolantTankCapacity = reactor.getCoolantFluidStats().fluidCapacity
344 hotFluidAmount = reactor.getHotFluidAmount()
345 fluidType = reactor.getCoolantFluidStats().fluidType
346 coldFluidAmount = reactor.getCoolantFluidStats().fluidAmount
347 activeEfficiency = math.floor(hotFluidProducedLastTick / fuelConsumendLastTick)
348
349 else
350 activeCooling = false
351
352 if storedRF == nil then
353 storedRF = {}
354 end
355
356 storedRFRaw = reactor.getEnergyStats().energyStored
357 if storedRFRaw >= 1000000000 then
358 storedRF[1] = storedRFRaw / 1000000000
359 storedRF[2] = " gRF"
360 elseif storedRFRaw >= 1000000 then
361 storedRF[1] = storedRFRaw / 1000000
362 storedRF[2] = " mRF"
363 elseif storedRFRaw >= 1000 then
364 storedRF[1] = storedRFRaw / 1000
365 storedRF[2] = " kRF"
366 elseif storedRFRaw > 0 then
367 storedRF[1] = storedRFRaw
368 storedRF[2] = " RF"
369 else
370 storedRF[1] = 0
371 storedRF[2] = " RF"
372 end
373
374 capacityRFRaw = reactor.getEnergyStats().energyCapacity
375 if capacityRF == nil then
376 capacityRF = {}
377 end
378 if capacityRFRaw >= 1000000000 then
379 capacityRF[1] = math.floor(capacityRFRaw / 1000000000)
380 capacityRF[2] = " GRF"
381 elseif capacityRFRaw >= 1000000 then
382 capacityRF[1] = math.floor(capacityRFRaw / 1000000)
383 capacityRF[2] = " MRF"
384 elseif capacityRFRaw >= 1000 then
385 capacityRF[1] = math.floor(capacityRFRaw / 1000)
386 capacityRF[2] = " KRF"
387 elseif capacityRFRaw > 0 then
388 capacityRF[1] = math.floor(capacityRFRaw)
389 capacityRF[2] = " RF"
390 else
391 capacityRF[1] = 0
392 capacityRF[2] = " RF"
393 end
394
395 producedRFLastTickRaw = reactor.getEnergyStats().energyProducedLastTick
396
397 if producedRFLastTick == nil then
398 producedRFLastTick = {}
399 end
400
401 if producedRFLastTickRaw >= 1000000000 then
402 producedRFLastTick[1] = math.floor(producedRFLastTickRaw / 1000000000)
403 producedRFLastTick[2] = " GRF/Tick"
404 elseif producedRFLastTickRaw >= 1000000 then
405 producedRFLastTick[1] = math.floor(producedRFLastTickRaw / 1000000)
406 producedRFLastTick[2] = " MRF/Tick"
407 elseif producedRFLastTickRaw >= 1000 then
408 producedRFLastTick[1] = math.floor(producedRFLastTickRaw / 1000)
409 producedRFLastTick[2] = " KRF/Tick"
410 elseif producedRFLastTickRaw > 0 then
411 producedRFLastTick[1] = math.floor(producedRFLastTickRaw)
412 producedRFLastTick[2] = " RF/Tick"
413 else
414 producedRFLastTick[1] = 0
415 producedRFLastTick[2] = " RF/Tick"
416 end
417
418 passivEfficiencyRaw = math.floor((producedRFLastTickRaw / fuelBurnedLastTickRaw))
419
420 if passivEfficiency == nil then
421 passivEfficiency = {}
422 end
423
424 if passivEfficiencyRaw >= 1000000 then
425 passivEfficiency[1] = math.floor(passivEfficiencyRaw / 1000000)
426 passivEfficiency[2] = " MRF/Tick/mB"
427 elseif passivEfficiencyRaw >= 1000 then
428 passivEfficiency[1] = math.floor(passivEfficiencyRaw / 1000)
429 passivEfficiency[2] = " KRF/Tick/mB"
430 elseif passivEfficiencyRaw > 0 then
431 passivEfficiency[1] = math.floor(passivEfficiencyRaw)
432 passivEfficiency[2] = " RF/Tick/mB"
433 else
434 passivEfficiency[1] = 0
435 passivEfficiency[2] = " RF/Tick/mB"
436 end
437
438 end
439
440 if controlRodSteeringTimer == nil then
441 controlRodSteeringTimer = 0
442 end
443
444 if storedRFOld == nil then
445 storedRFOld = 0
446 end
447
448 if fuelTemperatureOld == nil then
449 fuelTemperatureOld = 0
450 end
451
452 fuelTemperatureSweetSpot = 1273
453
454 if currentOptionPage == nil then
455 currentOptionPage = 1
456 end
457
458--[[
459Mit diesem Abschnitt wird die RF Produktion der letzten 5 Minuten aufgezeichnet. Hierzu wird eine Table angelegt und jede Sekunde die aktuelle Energieproduktion darin hinterlegt und zusammengerechnet.
460]]
461
462 if rfProducedHistory == nil then
463 rfProducedHistory = {producedRFLastTickRaw * 20}
464 end
465
466 if table.getn(rfProducedHistory) < 300 then
467 table.insert(rfProducedHistory, (producedRFLastTickRaw * 20))
468 else
469 table.remove(rfProducedHistory, 1)
470 table.insert(rfProducedHistory, (producedRFLastTickRaw * 20))
471 end
472
473 rfProducedHistoryTotal = 0
474
475 for key, value in ipairs(rfProducedHistory) do
476 rfProducedHistoryTotal = rfProducedHistoryTotal + value
477 end
478
479 if rfProducedHistorySum == nil then
480 rfProducedHistorySum = {}
481 end
482
483 if rfProducedHistoryTotal >= 1000000000 then
484 rfProducedHistorySum[1] = string.format("%.2f", rfProducedHistoryTotal / 1000000000)
485 rfProducedHistorySum[2] = " GRF"
486 elseif rfProducedHistoryTotal >= 1000000 then
487 rfProducedHistorySum[1] = string.format("%.2f", rfProducedHistoryTotal/ 1000000)
488 rfProducedHistorySum[2] = " MRF"
489 elseif rfProducedHistoryTotal >= 1000 then
490 rfProducedHistorySum[1] = string.format("%.2f", rfProducedHistoryTotal/ 1000)
491 rfProducedHistorySum[2] = " KRF"
492 elseif rfProducedHistoryTotal > 0 then
493 rfProducedHistorySum[1] = string.format("%.2f", rfProducedHistoryTotal)
494 rfProducedHistorySum[2] = " RF"
495 else
496 rfProducedHistorySum[1] = 0
497 rfProducedHistorySum[2] = " RF"
498 end
499
500
501--[[
502Mit diesem Abschnitt wird der Brennstoffverbrauch der letzten 5 Minuten aufgezeichnet. Hierzu wird eine Table angelegt und jede Sekunde die aktuellen Verbrauchswerte darin hinterlegt und zusammengerechnet.
503]]
504 fuelBurnedLastTickOld= fuelBurnedLastTickRaw
505 if fuelBurnedHistory == nil then
506 fuelBurnedHistory = {fuelBurnedLastTickRaw}
507 end
508
509 if table.getn(fuelBurnedHistory) < 300 then
510 table.insert(fuelBurnedHistory, (fuelBurnedLastTickRaw * 20))
511 else
512 table.remove(fuelBurnedHistory, 1)
513 table.insert(fuelBurnedHistory, (fuelBurnedLastTickRaw * 20))
514 end
515
516 fuelBurnedHistoryTotal = 0
517 for key, value in ipairs(fuelBurnedHistory) do
518 fuelBurnedHistoryTotal = fuelBurnedHistoryTotal + value
519 end
520
521 if fuelBurnedHistorySum == nil then
522 fuelBurnedHistorySum = {}
523 end
524
525 if fuelBurnedHistoryTotal < 1 then
526 fuelBurnedHistorySum[1] = string.format("%.3f", fuelBurnedHistoryTotal)
527 fuelBurnedHistorySum[2] = " mB"
528 elseif fuelBurnedHistoryTotal < 1000 then
529 fuelBurnedHistorySum[1] = string.format("%.1f", fuelBurnedHistoryTotal)
530 fuelBurnedHistorySum[2] = " mB"
531 elseif fuelBurnedHistoryTotal < 1000000 then
532 fuelBurnedHistorySum[1] = string.format("%.2f", (fuelBurnedHistoryTotal / 1000))
533 fuelBurnedHistorySum[2] = " B"
534 else
535 fuelBurnedHistorySum[1] = string.format("%.3f", (fuelBurnedHistoryTotal / 1000000))
536 fuelBurnedHistorySum[2] = " KB"
537 end
538end
539
540
541--[[
542In dieser Funktion werden die globalen Tables für verschiedene Zwecke initialisiert. Da die Werte in den Tables statisch sind, ist diese Funktion gesondert definiert und nicht in der globalVariables-Funktion eingebettet.
543]]
544
545function globalTables()
546 --SystemControlText[currentSettingsPage][settingsWindow][text]
547 SystemControlText = { { {}, {}, {}, {} }, { {}, {}, {}, {} }, { {}, {}, {}, {} } }
548
549
550 SystemControlText[1][1][1] = "Über den Autor"
551 SystemControlText[1][1][2] = "dieses Programms"
552
553 SystemControlText[1][2][1] = "test"
554 SystemControlText[1][2][2] = "test"
555
556 SystemControlText[1][3][1] = "test"
557 SystemControlText[1][3][2] = "test"
558
559 SystemControlText[1][4][1] = "test"
560 SystemControlText[1][4][2] = "test"
561
562
563 SystemControlText[2][1][1] = "Reaktor"
564 SystemControlText[2][1][2] = "Herunterfahren"
565 SystemControlText[2][1][3] = "Hochfahren"
566
567 SystemControlText[2][2][1] = "Steuerstäbe"
568 SystemControlText[2][2][2] = "Zurücksetzen"
569
570 SystemControlText[2][3][1] = "Manuelle"
571 SystemControlText[2][3][2] = "Abfallentleerung"
572
573 SystemControlText[2][4][1] = "Reaktorsteuerung"
574 SystemControlText[2][4][2] = "Neustarten"
575
576
577 aboutAutorText = {}
578
579 aboutAutorText[1] = "Über das Programm: Stavros - Reaktosteuerung"
580 aboutAutorText[2] = " "
581 aboutAutorText[3] = "Vielen Dank für die Nutzung meines Programms :)"
582 aboutAutorText[4] = "Mein Name ist Domenic Halking aka PlatinKinggg und"
583 aboutAutorText[5] = "die Reaktorsteuerung über ein selbstgeschriebenes"
584 aboutAutorText[6] = "Programm, hat mich schon seit Jahren interessiert."
585 aboutAutorText[7] = "Deshalb habe ich mit dem Programmieren angefangen."
586 aboutAutorText[8] = "Ich hoffe, das Ergebnis hier stellt Dich"
587 aboutAutorText[9] = "zufrieden und hilft Dir, deinen Reaktor gut im"
588 aboutAutorText[10] = "Auge zu behalten."
589 aboutAutorText[11] = "Falls dir das Programm gefällt, würde ich mich"
590 aboutAutorText[12] = "über ein Spende per PayPal freuen. Vielen Dank"
591 aboutAutorText[13] = " "
592 aboutAutorText[14] = "https://paypal.me/DHalking"
593
594end
595
596function alarmTrigger()
597 if fuelAmountRaw < (fuelTankCapacity / 4) then
598 rs.setOutput("top", true)
599 else
600 rs.setOutput("top", false)
601 end
602end
603
604function controlRodSteering()
605
606 controlMethod = 2
607
608 if controlMethod == 1 then
609
610 if storedRFRaw <= (capacityRFRaw * 0.01) then
611 setAllControlRodLevels(getControlRodLevel - 25)
612
613 elseif storedRFRaw >= (capacityRFRaw * 0.99) then
614 setAllControlRodLevels(getControlRodLevel + 25)
615
616 elseif storedRFRaw > storedRFOld then
617
618 if storedRFRaw >= (capacityRFRaw * 0.90) then
619 setAllControlRodLevels(getControlRodLevel + 9)
620
621 elseif storedRFRaw >= (capacityRFRaw * 0.80) then
622 setAllControlRodLevels(getControlRodLevel + 7)
623
624 elseif storedRFRaw >= (capacityRFRaw * 0.7) then
625 setAllControlRodLevels(getControlRodLevel + 5)
626
627 elseif storedRFRaw >= (capacityRFRaw * 0.6) or storedRFRaw >= (storedRFOld * 1.03) then
628 setAllControlRodLevels(getControlRodLevel + 3)
629
630 else
631 setAllControlRodLevels(getControlRodLevel + 1)
632 end
633
634 elseif storedRFRaw < storedRFOld then
635
636 if storedRFRaw <= (capacityRFRaw * 0.1) then
637 setAllControlRodLevels(getControlRodLevel - 9)
638
639 elseif storedRFRaw <= (capacityRFRaw * 0.2) then
640 setAllControlRodLevels(getControlRodLevel - 7)
641
642 elseif storedRFRaw <= (capacityRFRaw * 0.3) then
643 setAllControlRodLevels(getControlRodLevel - 5)
644
645 elseif storedRFRaw <= (capacityRFRaw * 0.4) or storedRFRaw <= (storedRFOld * 0.97) then
646 setAllControlRodLevels(getControlRodLevel - 3)
647
648 else
649 setAllControlRodLevels(getControlRodLevel - 1)
650 end
651 end
652
653 elseif controlMethod == 2 then
654
655 if fuelTemperature > 2000 then
656 setAllControlRodLevels(getControlRodLevel + 9)
657
658 elseif fuelTemperature > (fuelTemperatureSweetSpot * 1.4) then
659 setAllControlRodLevels(getControlRodLevel + 7)
660
661 elseif fuelTemperature > (fuelTemperatureSweetSpot * 1.3) then
662 setAllControlRodLevels(getControlRodLevel + 5)
663
664 elseif fuelTemperature > (fuelTemperatureSweetSpot * 1.2) then
665 setAllControlRodLevels(getControlRodLevel + 3)
666
667 elseif fuelTemperature > fuelTemperatureSweetSpot then
668 setAllControlRodLevels(getControlRodLevel + 1)
669
670 elseif fuelTemperature < (fuelTemperatureSweetSpot * 0.2) then
671 setAllControlRodLevels(getControlRodLevel - 9)
672
673 elseif fuelTemperature < (fuelTemperatureSweetSpot * 0.4) then
674 setAllControlRodLevels(getControlRodLevel - 7)
675
676 elseif fuelTemperature < (fuelTemperatureSweetSpot * 0.6) then
677 setAllControlRodLevels(getControlRodLevel - 5)
678
679 elseif fuelTemperature < (fuelTemperatureSweetSpot * 0.8) then
680 setAllControlRodLevels(getControlRodLevel - 3)
681
682 elseif fuelTemperature < fuelTemperatureSweetSpot then
683 setAllControlRodLevels(getControlRodLevel - 1)
684
685 end
686 end
687
688 fuelTemperatureOld = fuelTemperature
689 storedRFOld = storedRFRaw
690 controlRodSteeringTimer = 0
691end
692
693function deleteProgram()
694 fs.delete("startUp")
695 fs.delete("Reaktoranzeige")
696 fs.delete("Programmkonfiguration")
697 fs.delete("ReadMeVariables")
698end
699
700config = {
701 save = (function()
702 local configFile = io.open("Programmkonfiguration", "w")
703 configFile:write(textutils.serialise(configTable))
704 configFile:close()
705 end),
706
707 load = (function()
708 if fs.exists("Programmkonfiguration") == false then
709 print(" ")
710 term.setTextColor(colors.yellow)
711 print("Keine Programmkonfigurations-Datei gefunden. Lege Datei nun an.")
712 term.setTextColor(colors.white)
713 print(" ")
714 configTable = config.restore()
715 end
716 local configFile = io.open("Programmkonfiguration", "r")
717 local configSerialse = configFile:read("a")
718 configFile:close()
719 configTable = textutils.unserialise(configSerialse)
720 return configTable
721 end),
722
723 check = (function()
724 if type(configTable) ~= "table" then
725 configTable = config.restore()
726 else
727 local configTableLength = 0
728 for _ in pairs(configTable) do
729 configTableLength = configTableLength + 1
730 end
731 if configTableLength ~= 12 then
732 term.setTextColor(colors.red)
733 print("Fehler in der Länge der Programmkonfiguration...")
734 term.setTextColor(colors.white)
735 configTable = config.restore()
736 elseif configTable[1] < 1 or configTable[1] > 2 then -- Sprache
737 term.setTextColor(colors.red)
738 print("Fehler in der Zeitanzeige Einstellung...")
739 term.setTextColor(colors.white)
740 configTable = config.restore()
741 elseif configTable[2] < 1 or configTable[2] > 2 then -- Auto-Einschalten
742 term.setTextColor(colors.red)
743 print("Fehler in der Zeitanzeige Einstellung...")
744 term.setTextColor(colors.white)
745 configTable = config.restore()
746 elseif configTable[3] < 1 or configTable[3] > 4 then -- Uhrzeit
747 term.setTextColor(colors.red)
748 print("Fehler in der Zeitanzeige Einstellung...")
749 term.setTextColor(colors.white)
750 configTable = config.restore()
751 elseif configTable[4] < 1 or configTable[4] > 4 then -- Datum
752 term.setTextColor(colors.red)
753 print("Fehler in der Datumsanzeige Einstellung...")
754 term.setTextColor(colors.white)
755 configTable = config.restore()
756 elseif configTable[5] < 1 or configTable[5] > 5 then -- Startseite
757 term.setTextColor(colors.red)
758 print("Fehler in der Startseiten Einstellung")
759 term.setTextColor(colors.white)
760 configTable = config.restore()
761 elseif configTable[6] < 1 or configTable[6] > 16 then -- StartseiteHintergrundfarbe buttonWindows
762 term.setTextColor(colors.red)
763 print("Fehler in der Einstellung zur Tasten-Hintergrundfarbe...")
764 term.setTextColor(colors.white)
765 configTable = config.restore()
766 elseif configTable[7] < 1 or configTable[7] > 16 then -- Schriftfarbe buttonWindows
767 term.setTextColor(colors.red)
768 print("Fehler in der Einstellung zur Tasten-Schriftfarbe...")
769 term.setTextColor(colors.white)
770 configTable = config.restore()
771 elseif configTable[8] < 1 or configTable[8] > 16 then -- Hintergrundfarbe textWindows
772 term.setTextColor(colors.red)
773 print("Fehler in der Einstellung zur Textanzeige-Hintergrundfarbe...")
774 term.setTextColor(colors.white)
775 configTable = config.restore()
776 elseif configTable[9] < 1 or configTable[9] > 16 then -- Schriftfarbe textWindows
777 term.setTextColor(colors.red)
778 print("Fehler in der Einstellung zur Textanzeige-Schriftfarbe...")
779 term.setTextColor(colors.white)
780 configTable = config.restore()
781 elseif configTable[10] < 1 or configTable[10] > 16 then -- Hintergrundfarbe buttonWindowBackgroundColor
782 term.setTextColor(colors.red)
783 print("Fehler in der Hintergrundfarbe der Tastenleiste...")
784 term.setTextColor(colors.white)
785 configTable = config.restore()
786 elseif configTable[11] < 1 or configTable[11] > 16 then -- Hintergrundfarbe Übersicht
787 term.setTextColor(colors.red)
788 print("Fehler in der Hintergrundfarbe der Seite Übersicht...")
789 term.setTextColor(colors.white)
790 configTable = config.restore()
791 elseif configTable[12] < 1 or configTable[12] > 16 then -- Schriftfarbe Übersicht
792 term.setTextColor(colors.red)
793 print("Fehler in der Schriftfarbe der Seite Übersicht...")
794 term.setTextColor(colors.white)
795 configTable = config.restore()
796 end
797 end
798 end),
799
800 restore = (function()
801 configTable = {1, 1, 1, 1, 1, 16, 2, 16, 13, 16, 16, 1}
802 -- ConfigTable Werte: Sprache, Auto-Einschalten, Zeit, Datum, Buttonfenster Farbe, Buttonfenster Textfarbe, Textfenster Textfarbe, Textfenster Textfarbe, Hintergrundfarbe Übersicht, Schriftfarbe Übersicht
803
804 local configFile = io.open("Programmkonfiguration", "w")
805 configFile:write(textutils.serialise(configTable))
806 configFile:close()
807 term.setTextColor(colors.red)
808 print("Die Standardeinstellungen werden nun geladen!")
809 term.setTextColor(colors.white)
810 return configTable
811 end)
812}
813
814function writeTextToWindow(windowName, windowLength, windowHeight, backgroundColor, textColor, text1, text1SetOffX, text1SetOffY, text2, text2SetOffX, text2SetOffY)
815
816 if text2 == true then
817 text2 = "Aktiv"
818 elseif text2 == false then
819 text2 = "Inaktiv"
820 end
821
822 windowName.setBackgroundColor(backgroundColor)
823 windowName.setTextColor(textColor)
824 windowName.clear()
825
826 local textLength1 = string.len(text1)
827 local drawPositionX1
828 local drawPositionY1
829
830 if text2 then
831 local textLength2 = string.len(text2)
832 local drawPositionX2
833 local drawPositionY2
834
835 if text1SetOffX == "left" then
836 drawPositionX1 = 2
837 else
838 drawPositionX1 = (math.floor((windowLength - textLength1) / 2) + text1SetOffX)
839 end
840
841 if text2SetOffX == "left" then
842 drawPositionX2 = 2
843 else
844 drawPositionX2 = (math.ceil((windowLength - textLength2) / 2) + text2SetOffX)
845 end
846
847 if text1SetOffY == "split" then
848 drawPositionY1 = 2
849 drawPositionY2 = windowHeight
850 elseif windowHeight <= 3 then
851 drawPositionY1 = 1
852 drawPositionY2 = 2
853 elseif windowHeight == 4 then
854 drawPositionY1 = 2
855 drawPositionY2 = 3
856 else
857 if math.fmod(windowHeight / 2, 2) == 0 then
858 drawPositionY1 = (windowHeight / 2) - 1 + text1SetOffY
859 drawPositionY2 = drawPositionY1 + 2 + text2SetOffY
860 else
861 drawPositionY1 = (math.floor(windowHeight / 2)) + text1SetOffY
862 drawPositionY2 = drawPositionY1 + 2 + text2SetOffY
863 end
864 end
865
866 windowName.setCursorPos(drawPositionX2 , drawPositionY2)
867 windowName.write(text2)
868 windowName.setCursorPos(drawPositionX1 , drawPositionY1)
869 windowName.write(text1)
870
871 else
872 if text1SetOffX == "left" then
873 drawPositionX1 = 2
874 else
875 drawPositionX1 = (math.floor((windowLength - textLength1) / 2) + text1SetOffX)
876 end
877
878 if math.fmod(windowHeight / 2, 2) == 0 then
879 drawPositionY1 = (windowHeight / 2) + text1SetOffY
880 else
881 drawPositionY1 = (math.ceil(windowHeight / 2)) + text1SetOffY
882 end
883
884 windowName.setCursorPos(drawPositionX1 , drawPositionY1)
885 windowName.write(text1)
886 end
887end
888
889windowCreate = {
890 foundation = (function()
891 backgroundButtonWindowInfo = {1, monitorHeight - 4, monitorWidth, 5}
892 backgroundButtonWindow = window.create(monitor, backgroundButtonWindowInfo[1], backgroundButtonWindowInfo[2], backgroundButtonWindowInfo[3], backgroundButtonWindowInfo[4])
893
894 foundationWindowInfo = {1, 6, monitorWidth, monitorHeight - 10}
895 foundationWindow = window.create(monitor, foundationWindowInfo[1], foundationWindowInfo[2], foundationWindowInfo[3], foundationWindowInfo[4])
896
897 usableWidth = foundationWindowInfo[3]
898 usableWidthHalf = math.ceil(foundationWindowInfo[3] / 2)
899 usableWidthHalfRest = foundationWindowInfo[3] - usableWidthHalf
900
901 usableHeightFull = foundationWindowInfo[4]
902 usableHeightHalf = math.ceil(foundationWindowInfo[4] / 2)
903 usableHeightHalfRest = foundationWindowInfo[4] - usableHeightHalf
904
905 usableHeight1 = math.ceil(foundationWindowInfo[4] / 4)
906 usableHeight2 = math.ceil((foundationWindowInfo[4] - usableHeight1) / 3)
907 usableHeight3 = math.ceil((foundationWindowInfo[4] - usableHeight1 - usableHeight2) / 2)
908 usableHeight4 = foundationWindowInfo[4] - usableHeight1 - usableHeight2 - usableHeight3
909 end),
910
911 bootScreen = (function()
912 bootWindowInfo = {}
913 bootWindow = {}
914
915 bootWindowInfo[1] = {1, 1, monitorWidth, monitorHeight}
916 bootWindowInfo[2] = {3, 3, monitorWidth - 4, monitorHeight - 4}
917 bootWindowInfo[3] = {4, 4, monitorWidth - 6, monitorHeight - 6}
918 bootWindowInfo[4] = {5, 5, monitorWidth - 8, monitorHeight - 8}
919 bootWindowInfo[5] = {6, 6, monitorWidth - 10, monitorHeight - 10}
920 bootWindowInfo[6] = {7, 7, monitorWidth - 12, monitorHeight - 12}
921 bootWindowInfo[7] = {8, 8, monitorWidth - 14, monitorHeight - 14}
922
923 for i = 1, 7, 1 do
924 bootWindow[i] = window.create(monitor, bootWindowInfo[i][1], bootWindowInfo[i][2], bootWindowInfo[i][3], bootWindowInfo[i][4])
925 end
926 end),
927
928 aboutAutor = (function()
929 aboutAutorWindowInfo = {1, 1, usableWidth, usableHeightFull + 5}
930
931 aboutAutorWindow = window.create(monitor, aboutAutorWindowInfo[1], aboutAutorWindowInfo[2], aboutAutorWindowInfo[3], aboutAutorWindowInfo[4])
932 end),
933
934 interface = (function()
935 leftButtonWindowInfo = {2, 2, 5, 3}
936 leftButtonWindow = window.create(backgroundButtonWindow, leftButtonWindowInfo[1], leftButtonWindowInfo[2], leftButtonWindowInfo[3], leftButtonWindowInfo[4])
937
938 rightButtonWindowInfo = {backgroundButtonWindowInfo[3] - 5, 2, 5, 3}
939 rightButtonWindow = window.create(backgroundButtonWindow , rightButtonWindowInfo[1], rightButtonWindowInfo[2], rightButtonWindowInfo[3], rightButtonWindowInfo[4])
940
941 if math.fmod(backgroundButtonWindowInfo[3], 2) == 0 then
942 leftCenterButtonWindowInfo = {8, 2 ,(backgroundButtonWindowInfo[3] / 2) - 8, 3}
943 leftCenterButtonWindow = window.create(backgroundButtonWindow, leftCenterButtonWindowInfo[1], leftCenterButtonWindowInfo[2], leftCenterButtonWindowInfo[3], leftCenterButtonWindowInfo[4])
944
945 rightCenterButtonWindowInfo = {(backgroundButtonWindowInfo[3] / 2) + 2, 2,(backgroundButtonWindowInfo[3] / 2) - 8, 3}
946 rightCenterButtonWindow = window.create(backgroundButtonWindow, rightCenterButtonWindowInfo[1], rightCenterButtonWindowInfo[2], rightCenterButtonWindowInfo[3], rightCenterButtonWindowInfo[4])
947
948 else
949
950 leftCenterButtonWindowInfo = {8, 2 ,math.floor(backgroundButtonWindowInfo[3] / 2) - 7, 3}
951 leftCenterButtonWindow = window.create(backgroundButtonWindow, leftCenterButtonWindowInfo[1], leftCenterButtonWindowInfo[2], leftCenterButtonWindowInfo[3], leftCenterButtonWindowInfo[4])
952
953 rightCenterButtonWindowInfo = {math.ceil(backgroundButtonWindowInfo[3] / 2) + 1, 2, math.floor(backgroundButtonWindowInfo[3] / 2) - 7, 3}
954 rightCenterButtonWindow = window.create(backgroundButtonWindow, rightCenterButtonWindowInfo[1], rightCenterButtonWindowInfo[2], rightCenterButtonWindowInfo[3], rightCenterButtonWindowInfo[4])
955 end
956
957 optionButtonWindowInfo = {1, 1, 7, 5}
958 optionButtonWindow = window.create(monitor, optionButtonWindowInfo[1], optionButtonWindowInfo[2], optionButtonWindowInfo[3], optionButtonWindowInfo[4])
959
960 timeTextWindowInfo = {monitorWidth - 11, 1, 12, 5}
961 timeTextWindow = window.create(monitor, timeTextWindowInfo[1], timeTextWindowInfo[2], timeTextWindowInfo[3], timeTextWindowInfo[4])
962
963 headerTextWindowInfo = {optionButtonWindowInfo[3] + 1, 1, monitorWidth - optionButtonWindowInfo[3] - timeTextWindowInfo[3] , 5}
964 headerTextWindow = window.create(monitor, headerTextWindowInfo[1], headerTextWindowInfo[2], headerTextWindowInfo[3], headerTextWindowInfo[4])
965 end),
966
967 optionMain = (function()
968
969 optionMainWindowInfo = {}
970 optionMainWindow = {}
971
972 optionMainWindowInfo[1] = {1, 1, usableWidth, usableHeight1}
973 optionMainWindowInfo[2] = {1, (1 + usableHeight1), usableWidth, usableHeight2}
974 optionMainWindowInfo[3] = {1, (1 + usableHeight1 + usableHeight2), usableWidth, usableHeight3}
975 optionMainWindowInfo[4] = {1, (1 + usableHeight1 + usableHeight2 + usableHeight3), usableWidth, usableHeight4}
976
977 optionMainWindow[1] = window.create(foundationWindow, optionMainWindowInfo[1][1], optionMainWindowInfo[1][2], optionMainWindowInfo[1][3], optionMainWindowInfo[1][4])
978 optionMainWindow[2] = window.create(foundationWindow, optionMainWindowInfo[2][1], optionMainWindowInfo[2][2], optionMainWindowInfo[2][3], optionMainWindowInfo[2][4])
979 optionMainWindow[3] = window.create(foundationWindow, optionMainWindowInfo[3][1], optionMainWindowInfo[3][2], optionMainWindowInfo[3][3], optionMainWindowInfo[3][4])
980 optionMainWindow[4] = window.create(foundationWindow, optionMainWindowInfo[4][1], optionMainWindowInfo[4][2], optionMainWindowInfo[4][3], optionMainWindowInfo[4][4])
981 end),
982
983 optionSetting = (function()
984 optionSettingWindowInfo = {4, 3, usableWidth - 5, 7}
985 optionSettingWindow = window.create(foundationWindow, optionSettingWindowInfo[1], optionSettingWindowInfo[2], optionSettingWindowInfo[3], optionSettingWindowInfo[4])
986 end),
987
988 systemControl = (function()
989 systemControlWindowInfo = {}
990 systemControlWindow = {}
991
992 systemControlWindowInfo[1] = {1, 1, usableWidthHalf, usableHeightHalf}
993 systemControlWindowInfo[2] = {1 + usableWidthHalf, 1, usableWidthHalfRest, usableHeightHalf}
994 systemControlWindowInfo[3] = {1 , 1 + usableHeightHalf, usableWidthHalf, usableHeightHalfRest}
995 systemControlWindowInfo[4] = {1 + usableWidthHalf, 1 + usableHeightHalf, usableWidthHalfRest, usableHeightHalfRest}
996
997 systemControlWindow[1] = window.create(foundationWindow, systemControlWindowInfo[1][1], systemControlWindowInfo[1][2], systemControlWindowInfo[1][3], systemControlWindowInfo[1][4])
998 systemControlWindow[2] = window.create(foundationWindow, systemControlWindowInfo[2][1], systemControlWindowInfo[2][2], systemControlWindowInfo[2][3], systemControlWindowInfo[2][4])
999 systemControlWindow[3] = window.create(foundationWindow, systemControlWindowInfo[3][1], systemControlWindowInfo[3][2], systemControlWindowInfo[3][3], systemControlWindowInfo[3][4])
1000 systemControlWindow[4] = window.create(foundationWindow, systemControlWindowInfo[4][1], systemControlWindowInfo[4][2], systemControlWindowInfo[4][3], systemControlWindowInfo[4][4])
1001 end),
1002
1003 pageMain = (function()
1004 paigeMainWindow1Info = {1, 1, usableWidthHalf, usableHeight1}
1005 paigeMainWindow2Info = {1 + usableWidthHalf, 1, usableWidthHalfRest, usableHeight1}
1006 paigeMainWindow3Info = {1, (1 + usableHeight1), usableWidthHalf, usableHeight2}
1007 paigeMainWindow4Info = {1 + usableWidthHalf, (1 + usableHeight1), usableWidthHalfRest, usableHeight2}
1008 paigeMainWindow5Info = {1, (1 + usableHeight1 + usableHeight2), usableWidthHalf, usableHeight3}
1009 paigeMainWindow6Info = {1 + usableWidthHalf, (1 + usableHeight1 + usableHeight2), usableWidthHalfRest, usableHeight3}
1010 paigeMainWindow7Info = {1, (1 + usableHeight1 + usableHeight2 + usableHeight3), usableWidthHalf, usableHeight4}
1011 paigeMainWindow8Info = {1 + usableWidthHalf, (1 + usableHeight1 + usableHeight2 + usableHeight3), usableWidthHalfRest, usableHeight4}
1012
1013 paigeMainWindow1 = window.create(foundationWindow, paigeMainWindow1Info[1], paigeMainWindow1Info[2], paigeMainWindow1Info[3], paigeMainWindow1Info[4])
1014 paigeMainWindow2 = window.create(foundationWindow, paigeMainWindow2Info[1], paigeMainWindow2Info[2], paigeMainWindow2Info[3], paigeMainWindow2Info[4])
1015 paigeMainWindow3 = window.create(foundationWindow, paigeMainWindow3Info[1], paigeMainWindow3Info[2], paigeMainWindow3Info[3], paigeMainWindow3Info[4])
1016 paigeMainWindow4 = window.create(foundationWindow, paigeMainWindow4Info[1], paigeMainWindow4Info[2], paigeMainWindow4Info[3], paigeMainWindow4Info[4])
1017 paigeMainWindow5 = window.create(foundationWindow, paigeMainWindow5Info[1], paigeMainWindow5Info[2], paigeMainWindow5Info[3], paigeMainWindow5Info[4])
1018 paigeMainWindow6 = window.create(foundationWindow, paigeMainWindow6Info[1], paigeMainWindow6Info[2], paigeMainWindow6Info[3], paigeMainWindow6Info[4])
1019 paigeMainWindow7 = window.create(foundationWindow, paigeMainWindow7Info[1], paigeMainWindow7Info[2], paigeMainWindow7Info[3], paigeMainWindow7Info[4])
1020 paigeMainWindow8 = window.create(foundationWindow, paigeMainWindow8Info[1], paigeMainWindow8Info[2], paigeMainWindow8Info[3], paigeMainWindow8Info[4])
1021 end),
1022
1023 pageRF = (function()
1024 pageRFWindowInfo = {}
1025 pageRFWindow = {}
1026
1027 pageRFWindowInfo[1] = {1, 1, 11, usableHeightFull - 1}
1028 pageRFWindowInfo[2] = {5, 2, 3, usableHeightFull - 2}
1029 pageRFWindowInfo[3] = {6, usableHeightFull - (math.ceil((storedRFRaw / capacityRFRaw) * (usableHeightFull - 2))), 1, (math.ceil((storedRFRaw / capacityRFRaw) * (usableHeightFull - 2)))}
1030 pageRFWindowInfo[4] = {1, usableHeightFull, 11, 1}
1031 pageRFWindowInfo[5] = {12, 1, usableWidth - 11, math.ceil(usableHeightFull / 3)}
1032 pageRFWindowInfo[6] = {12, pageRFWindowInfo[5][4] + 1, usableWidth - 11, math.ceil((usableHeightFull - pageRFWindowInfo[5][4]) / 2)}
1033 pageRFWindowInfo[7] = {12, pageRFWindowInfo[5][4] + pageRFWindowInfo[6][4] + 1, usableWidth - 11, usableHeightFull - pageRFWindowInfo[5][4] - pageRFWindowInfo[6][4]}
1034
1035 pageRFWindow[1] = window.create(foundationWindow, pageRFWindowInfo[1][1], pageRFWindowInfo[1][2], pageRFWindowInfo[1][3], pageRFWindowInfo[1][4])
1036 pageRFWindow[2] = window.create(foundationWindow, pageRFWindowInfo[2][1], pageRFWindowInfo[2][2], pageRFWindowInfo[2][3], pageRFWindowInfo[2][4])
1037 pageRFWindow[3] = window.create(foundationWindow, pageRFWindowInfo[3][1], pageRFWindowInfo[3][2], pageRFWindowInfo[3][3], pageRFWindowInfo[3][4])
1038 pageRFWindow[4] = window.create(foundationWindow, pageRFWindowInfo[4][1], pageRFWindowInfo[4][2], pageRFWindowInfo[4][3], pageRFWindowInfo[4][4])
1039 pageRFWindow[5] = window.create(foundationWindow, pageRFWindowInfo[5][1], pageRFWindowInfo[5][2], pageRFWindowInfo[5][3], pageRFWindowInfo[5][4])
1040 pageRFWindow[6] = window.create(foundationWindow, pageRFWindowInfo[6][1], pageRFWindowInfo[6][2], pageRFWindowInfo[6][3], pageRFWindowInfo[6][4])
1041 pageRFWindow[7] = window.create(foundationWindow, pageRFWindowInfo[7][1], pageRFWindowInfo[7][2], pageRFWindowInfo[7][3], pageRFWindowInfo[7][4])
1042 end),
1043
1044 pageFuel = (function()
1045 pageFuelWindowInfo = {}
1046 pageFuelWindow = {}
1047
1048 pageFuelWindowInfo[1] = {1, 1, 11, usableHeightFull - 1}
1049 pageFuelWindowInfo[2] = {5, 2, 3, usableHeightFull - 2}
1050
1051 pageFuelWindowInfo[3] = {6, usableHeightFull - (math.ceil((fuelAmountRaw / fuelTankCapacity) * (usableHeightFull - 2))), 1, (math.ceil((fuelAmountRaw / fuelTankCapacity) * (usableHeightFull - 2)))}
1052 pageFuelWindowInfo[4] = {1, usableHeightFull, 11, 1}
1053 pageFuelWindowInfo[5] = {12, 1, usableWidth - 11, math.ceil(usableHeightFull / 3)}
1054 pageFuelWindowInfo[6] = {12, pageFuelWindowInfo[5][4] + 1, usableWidth - 11, math.ceil((usableHeightFull - pageFuelWindowInfo[5][4]) / 2)}
1055 pageFuelWindowInfo[7] = {12, pageFuelWindowInfo[5][4] + pageFuelWindowInfo[6][4] + 1, usableWidth - 11, usableHeightFull - pageFuelWindowInfo[5][4] - pageFuelWindowInfo[6][4]}
1056
1057 pageFuelWindow[1] = window.create(foundationWindow, pageFuelWindowInfo[1][1], pageFuelWindowInfo[1][2], pageFuelWindowInfo[1][3], pageFuelWindowInfo[1][4])
1058 pageFuelWindow[2] = window.create(foundationWindow, pageFuelWindowInfo[2][1], pageFuelWindowInfo[2][2], pageFuelWindowInfo[2][3], pageFuelWindowInfo[2][4])
1059 pageFuelWindow[3] = window.create(foundationWindow, pageFuelWindowInfo[3][1], pageFuelWindowInfo[3][2], pageFuelWindowInfo[3][3], pageFuelWindowInfo[3][4])
1060 pageFuelWindow[4] = window.create(foundationWindow, pageFuelWindowInfo[4][1], pageFuelWindowInfo[4][2], pageFuelWindowInfo[4][3], pageFuelWindowInfo[4][4])
1061 pageFuelWindow[5] = window.create(foundationWindow, pageFuelWindowInfo[5][1], pageFuelWindowInfo[5][2], pageFuelWindowInfo[5][3], pageFuelWindowInfo[5][4])
1062 pageFuelWindow[6] = window.create(foundationWindow, pageFuelWindowInfo[6][1], pageFuelWindowInfo[6][2], pageFuelWindowInfo[6][3], pageFuelWindowInfo[6][4])
1063 pageFuelWindow[7] = window.create(foundationWindow, pageFuelWindowInfo[7][1], pageFuelWindowInfo[7][2], pageFuelWindowInfo[7][3], pageFuelWindowInfo[7][4])
1064 end),
1065
1066
1067 pageEfficiency = (function()
1068
1069 pageEfficiencyWindowInfo = {}
1070 pageEfficiencyWindow = {}
1071
1072 pageEfficiencyWindowInfo[1] = {1, 1, usableWidth, math.ceil(usableHeightFull / 3)}
1073 pageEfficiencyWindowInfo[2] = {1, pageEfficiencyWindowInfo[1][4] + 1, usableWidthHalf, math.ceil((usableHeightFull - pageEfficiencyWindowInfo[1][4]) / 2)}
1074 pageEfficiencyWindowInfo[3] = {usableWidthHalf + 1, pageEfficiencyWindowInfo[1][4] + 1, usableWidthHalfRest, math.ceil((usableHeightFull - pageEfficiencyWindowInfo[1][4]) / 2)}
1075 pageEfficiencyWindowInfo[4] = {1, pageEfficiencyWindowInfo[1][4] + pageEfficiencyWindowInfo[2][4] + 1, usableWidthHalf, usableHeightFull - pageEfficiencyWindowInfo[1][4] - pageEfficiencyWindowInfo[2][4]}
1076 pageEfficiencyWindowInfo[5] = {usableWidthHalf + 1, pageEfficiencyWindowInfo[1][4] + pageEfficiencyWindowInfo[2][4] + 1, usableWidthHalfRest, usableHeightFull - pageEfficiencyWindowInfo[1][4] - pageEfficiencyWindowInfo[2][4]}
1077
1078 pageEfficiencyWindow[1] = window.create(foundationWindow, pageEfficiencyWindowInfo[1][1], pageEfficiencyWindowInfo[1][2], pageEfficiencyWindowInfo[1][3], pageEfficiencyWindowInfo[1][4])
1079 pageEfficiencyWindow[2] = window.create(foundationWindow, pageEfficiencyWindowInfo[2][1], pageEfficiencyWindowInfo[2][2], pageEfficiencyWindowInfo[2][3], pageEfficiencyWindowInfo[2][4])
1080 pageEfficiencyWindow[3] = window.create(foundationWindow, pageEfficiencyWindowInfo[3][1], pageEfficiencyWindowInfo[3][2], pageEfficiencyWindowInfo[3][3], pageEfficiencyWindowInfo[3][4])
1081 pageEfficiencyWindow[4] = window.create(foundationWindow, pageEfficiencyWindowInfo[4][1], pageEfficiencyWindowInfo[4][2], pageEfficiencyWindowInfo[4][3], pageEfficiencyWindowInfo[4][4])
1082 pageEfficiencyWindow[5] = window.create(foundationWindow, pageEfficiencyWindowInfo[5][1], pageEfficiencyWindowInfo[5][2], pageEfficiencyWindowInfo[5][3], pageEfficiencyWindowInfo[5][4])
1083
1084 end),
1085}
1086
1087
1088
1089
1090
1091display = {
1092 bootScreen = (function(text)
1093 colorBackground = colors.white
1094 for i = 1, 7, 1 do
1095 if colorBackground == colors.white then
1096 colorBackground = colors.black
1097 else
1098 colorBackground = colors.white
1099 end
1100 bootWindow[i].setBackgroundColor(colorBackground)
1101 bootWindow[i].clear()
1102 end
1103
1104 writeTextToWindow(bootWindow[7], bootWindowInfo[7][3], bootWindowInfo[7][4], colors.black, colors.white, text, 1, 0)
1105 end),
1106
1107 interface = (function(leftCenterButtonText, rightCenterButtonText)
1108 if leftCenterButtonText == nil then
1109 leftCenterButtonText = "unbelegt"
1110 end
1111 if rightCenterButtonText == nil then
1112 rightCenterButtonText = "unbelegt"
1113 end
1114
1115 backgroundButtonWindow.setBackgroundColor(backgroundWindowBackgroundColor)
1116 backgroundButtonWindow.clear()
1117 writeTextToWindow(rightButtonWindow, rightButtonWindowInfo[3], rightButtonWindowInfo[4], buttonWindowBackgroundColor, buttonWindowTextColor, ">" , 1, 0)
1118 writeTextToWindow(leftButtonWindow, leftButtonWindowInfo[3], leftButtonWindowInfo[4], buttonWindowBackgroundColor, buttonWindowTextColor, "<", 1, 0)
1119 writeTextToWindow(leftCenterButtonWindow, leftCenterButtonWindowInfo[3], leftCenterButtonWindowInfo[4], buttonWindowBackgroundColor, buttonWindowTextColor, leftCenterButtonText, 1, 0)
1120 writeTextToWindow(rightCenterButtonWindow, rightCenterButtonWindowInfo[3], rightCenterButtonWindowInfo[4], buttonWindowBackgroundColor, buttonWindowTextColor, rightCenterButtonText, 1, 0)
1121 writeTextToWindow(optionButtonWindow, optionButtonWindowInfo[3], optionButtonWindowInfo[4], buttonWindowBackgroundColor, buttonWindowTextColor, "Menü", 1, 0)
1122
1123 writeTextToWindow(timeTextWindow, timeTextWindowInfo[3], timeTextWindowInfo[4], textWindowBackgroundColor, textWindowTextColor, dayTime, 0, 0, dateTime, 0, 0)
1124
1125 writeTextToWindow(headerTextWindow, headerTextWindowInfo[3], headerTextWindowInfo[4], textWindowBackgroundColor, textWindowTextColor, "Stavros - Reaktorsteuerung", 2, 0, pageHeader, 2, 0)
1126 end),
1127
1128
1129--[[
1130In dieser Funktion wird die "Über den Autor" Seite geladen und angezeigt.
1131]]
1132
1133 aboutAutor = (function()
1134 aboutAutorWindow.setBackgroundColor(colors.black)
1135 aboutAutorWindow.setTextColor(colors.white)
1136 aboutAutorWindow.clear()
1137
1138 for i = 1, 14, 1 do
1139 aboutAutorWindow.setCursorPos(1 + (math.ceil((aboutAutorWindowInfo[3] - string.len(aboutAutorText[i])) / 2)), ((aboutAutorWindowInfo[4] - 14) / 2) + i)
1140 aboutAutorWindow.write(aboutAutorText[i])
1141 end
1142 end),
1143
1144 optionMain = (function()
1145 foundationWindow.setBackgroundColor(colors.red)
1146 foundationWindow.clear()
1147
1148 local counter1 = 1
1149 local counter2 = 1
1150 local colorBackground
1151
1152 if currentOptionPage == 2 then
1153 counter1 = counter1 + 4
1154 elseif currentOptionPage == 3 then
1155 counter1 = counter1 + 8
1156 end
1157
1158 for i = counter1, (counter1 + 3), 1 do
1159 if currentOptionPage == 1 or currentOptionPage == 3 then
1160 if (counter2 / 2) == math.ceil(counter2 / 2) then
1161 colorBackground = colors.gray
1162 else
1163 colorBackground = colors.black
1164 end
1165
1166 elseif currentOptionPage == 2 then
1167 if (counter2 / 2) == math.ceil(counter2 / 2) then
1168 colorBackground = colors.black
1169 else
1170 colorBackground = colors.gray
1171 end
1172 end
1173
1174 writeTextToWindow(optionMainWindow[counter2], optionMainWindowInfo[counter2][3], optionMainWindowInfo[counter2][4], colorBackground, colors.white, configTableInfo[i], "left", 0, configTableText[i][configTable[i]], 1, 0)
1175 counter2 = counter2 + 1
1176 end
1177 end),
1178
1179 optionSettingEntry = (function(i)
1180 if currentOptionPage == 2 then
1181 i = i + 4
1182 elseif currentOptionPage == 3 then
1183 i = i + 8
1184 end
1185
1186 if (configTable[i] + configTableManipulator) > (table.getn(configTableText[i])) then
1187 configTableManipulator = configTableManipulator - table.getn(configTableText[i])
1188 elseif (configTable[i] + configTableManipulator) < 1 then
1189 configTableManipulator = configTableManipulator + table.getn(configTableText[i])
1190 end
1191
1192 foundationWindow.setBackgroundColor(colors.black)
1193 foundationWindow.clear()
1194
1195 writeTextToWindow(optionSettingWindow, optionSettingWindowInfo[3], optionSettingWindowInfo[4], colors.black, colors.white, configTableInfo[i], 1, 0, configTableText[i][configTable[i] + configTableManipulator], 1, 0)
1196 selectedConfig = i
1197 newConfigValue = (configTable[i] + configTableManipulator)
1198 end),
1199
1200
1201 systemControl = (function()
1202 foundationWindow.setBackgroundColor(colors.white)
1203 foundationWindow.clear()
1204
1205 for i = 1, 4, 1 do
1206 local setOff = 0
1207 local colorBackground = colors.black
1208
1209 if i == 2 or i == 3 then
1210 colorBackground = colors.lightGray
1211 elseif SystemControlText[currentSettingsPage][i][1] == "Reaktor" and reactorActive == false then
1212 setOff = setOff + 1
1213 end
1214
1215 writeTextToWindow(systemControlWindow[i], systemControlWindowInfo[i][3], systemControlWindowInfo[i][4], colorBackground, colors.white, SystemControlText[currentSettingsPage][i][1], 1, 0, SystemControlText[currentSettingsPage][i][2 + setOff], 1, 0)
1216
1217 end
1218 end),
1219
1220 pageMain = (function()
1221 foundationWindow.setBackgroundColor(colors.white)
1222 foundationWindow.clear()
1223
1224 writeTextToWindow(paigeMainWindow1, paigeMainWindow1Info[3], paigeMainWindow1Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Reaktor ist:", 0, 0, reactorActive, 0, 0)
1225
1226 if activeCooling ~= true then
1227 writeTextToWindow(paigeMainWindow2, paigeMainWindow2Info[3], paigeMainWindow2Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Reaktor arbeitet:", 0, 0, "Passiv gekühlt", 0, 0)
1228 else
1229 writeTextToWindow(paigeMainWindow2, paigeMainWindow2Info[3], paigeMainWindow2Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Reaktor arbeitet:", 0, 0, "Aktiv gekühlt", 0, 0)
1230 end
1231
1232 writeTextToWindow(paigeMainWindow3, paigeMainWindow3Info[3], paigeMainWindow3Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Reaktorspeicher:", 0, 0, string.format("%.2f", storedRF[1]) .. storedRF[2] .. " gespeichert", 0, 0)
1233
1234 writeTextToWindow(paigeMainWindow4, paigeMainWindow4Info[3], paigeMainWindow4Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Reaktorspeicher zu:", 0, 0, math.ceil((storedRFRaw / capacityRFRaw) * 100) .. "% voll", 0, 0)
1235
1236 writeTextToWindow(paigeMainWindow5, paigeMainWindow5Info[3], paigeMainWindow5Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Brennstoff Verbrauch:", 0, 0, fuelBurnedLastTick[1] .. fuelBurnedLastTick[2], 0, 0)
1237
1238 writeTextToWindow(paigeMainWindow6, paigeMainWindow6Info[3], paigeMainWindow6Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Brennstoff-Effizienz:", 0, 0, passivEfficiency[1] .. passivEfficiency[2], 0, 0)
1239
1240 writeTextToWindow(paigeMainWindow7, paigeMainWindow7Info[3], paigeMainWindow7Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Brennstofffüllstand", 0, 0, fuelAmountPercent .. " % - " .. string.format("%.2f", fuelAmount[1]) .. fuelAmount[2], 0, 0)
1241
1242 writeTextToWindow(paigeMainWindow8, paigeMainWindow8Info[3], paigeMainWindow8Info[4], paigeMainBackgroundColor, paigeMainTextColor, "Steuerstab-Einschub", 0, 0, "Zu " .. getControlRodLevel .. "% eingeschoben", 0, 0)
1243 end),
1244
1245 pageRF = (function()
1246 foundationWindow.clear()
1247 writeTextToWindow(pageRFWindow[1], pageRFWindowInfo[1][3], pageRFWindowInfo[1][4], colors.black, colors.white, "100%", -2, "split", "0%" , -2, "split")
1248 pageRFWindow[2].setBackgroundColor(colors.lightGray)
1249 pageRFWindow[2].clear()
1250 pageRFWindow[3].setBackgroundColor(colors.red)
1251 pageRFWindow[3].clear()
1252 writeTextToWindow(pageRFWindow[4], pageRFWindowInfo[4][3], pageRFWindowInfo[4][4], colors.black, colors.white, "RF-Speicher", 1, 0)
1253 writeTextToWindow(pageRFWindow[5], pageRFWindowInfo[5][3], pageRFWindowInfo[5][4], colors.black, colors.white, "Energieproduktion", 1, 0, producedRFLastTick[1] .. producedRFLastTick[2] , 0, 0)
1254 writeTextToWindow(pageRFWindow[6], pageRFWindowInfo[6][3], pageRFWindowInfo[6][4], colors.black, colors.white, "Energiespeichergröße des Reaktors", 0, 0, capacityRF[1] .. capacityRF[2], 0, 0)
1255 writeTextToWindow(pageRFWindow[7], pageRFWindowInfo[7][3], pageRFWindowInfo[7][4], colors.black, colors.white, "RF-Produktion der letzten 5 Minuten", 1, 0, rfProducedHistorySum[1] .. rfProducedHistorySum[2] , 0, 0)
1256 end),
1257
1258 pageFuel = (function()
1259 foundationWindow.clear()
1260 writeTextToWindow(pageFuelWindow[1], pageFuelWindowInfo[1][3], pageFuelWindowInfo[1][4], colors.black, colors.white, "100%", -2, "split", "0%" , -2, "split")
1261 pageFuelWindow[2].setBackgroundColor(colors.lightGray)
1262 pageFuelWindow[2].clear()
1263 pageFuelWindow[3].setBackgroundColor(colors.red)
1264 pageFuelWindow[3].clear()
1265 writeTextToWindow(pageFuelWindow[4], pageFuelWindowInfo[4][3], pageFuelWindowInfo[4][4], colors.black, colors.white, "Brennstoff", 1, 0)
1266
1267 writeTextToWindow(pageFuelWindow[5], pageFuelWindowInfo[5][3], pageFuelWindowInfo[5][4], colors.black, colors.white, "Brennstoffverbrauch", 1, 0, fuelBurnedLastTick[1] .. fuelBurnedLastTick[2] , 0, 0)
1268 writeTextToWindow(pageFuelWindow[6], pageFuelWindowInfo[6][3], pageFuelWindowInfo[6][4], colors.black, colors.white, "Brennstoffaufnahme des Reaktors", 0, 0, string.format("%.2f", fuelAmount[1]) .. fuelAmount[2], 0, 0)
1269 writeTextToWindow(pageFuelWindow[7], pageFuelWindowInfo[7][3], pageFuelWindowInfo[7][4], colors.black, colors.white, "Brennstoffbedarf der letzten 5 Minuten", 1, 0, fuelBurnedHistorySum[1] .. fuelBurnedHistorySum[2] , 0, 0)
1270 end),
1271
1272
1273 pageEfficiency = (function()
1274
1275 foundationWindow.setBackgroundColor(colors.white)
1276 foundationWindow.clear()
1277
1278 local tempDifferenceValue
1279 local tempDifferenceText
1280 tempDifferenceValue = 1293 - fuelTemperature
1281
1282 if reactorActive == true then
1283 if tempDifferenceValue < 0 then
1284 tempDifferenceText = "Reaktor arbeitet " .. (tempDifferenceValue * -1) .. " K über Soll-Temperatur"
1285 elseif tempDifferenceValue > 0 then
1286 tempDifferenceText = "Reaktor arbeitet " .. tempDifferenceValue .. " K unter Soll-Temperatur"
1287 else
1288 tempDifferenceText = "Reaktor arbeitet in der Soll-Temperatur"
1289 end
1290 else
1291 tempDifferenceText = "Der Reaktor ist im Moment ausgeschaltet"
1292 end
1293
1294 writeTextToWindow(pageEfficiencyWindow[1], pageEfficiencyWindowInfo[1][3], pageEfficiencyWindowInfo[1][4], colors.black, colors.white, tempDifferenceText, 1, 0)
1295
1296 writeTextToWindow(pageEfficiencyWindow[2], pageEfficiencyWindowInfo[2][3], pageEfficiencyWindowInfo[2][4], colors.black, colors.white, "Ist-Betriebstemperatur:", 1, 0, fuelTemperature .. " K", 1 ,0)
1297
1298 writeTextToWindow(pageEfficiencyWindow[3], pageEfficiencyWindowInfo[3][3], pageEfficiencyWindowInfo[3][4], colors.black, colors.white, "Soll-Betriebstemperatur:", 1, 0, 1293 .. " K", 1 ,0)
1299
1300 writeTextToWindow(pageEfficiencyWindow[4], pageEfficiencyWindowInfo[4][3], pageEfficiencyWindowInfo[4][4], colors.black, colors.white, "Brennstoff-Effizienz", 1, 0, string.format("%.1f", fuelReactivity) .. " %", 1 ,0)
1301
1302 writeTextToWindow(pageEfficiencyWindow[5], pageEfficiencyWindowInfo[5][3], pageEfficiencyWindowInfo[5][4], colors.black, colors.white, "Brennstoff-Verbrauch:", 1, 0, fuelBurnedLastTick[1] .. fuelBurnedLastTick[2], 1 ,0)
1303
1304 end),
1305}
1306
1307function touchCheck(input1, input2, infoTable, offSetY)
1308 if offSetY == nil then
1309 offSetY = 0
1310 end
1311 if input1 >= infoTable[1] and input1 <= (infoTable[1] + infoTable[3] - 1) and input2 >= (infoTable[2] + offSetY) and input2 <= (infoTable[2] + infoTable[4] - 1 + offSetY) then
1312 return true
1313 else
1314 return false
1315 end
1316end
1317
1318function reactorAutostart()
1319 if autostart == true and reactorActive == false then
1320 setActive(true)
1321 end
1322end
1323
1324function baseTask()
1325 timerID = os.startTimer(1)
1326
1327 if debugLevel == 0 then
1328 handler(globalVariables)
1329 elseif debugLevel == 1 then
1330 globalVariables()
1331 end
1332
1333 if debugLevel == 0 then
1334 handler(alarmTrigger)
1335 elseif debugLevel == 1 then
1336 alarmTrigger()
1337 end
1338
1339
1340 controlRodSteeringTimer = controlRodSteeringTimer + 1
1341 if controlRodSteeringTimer >= 4 and reactorActive == true then
1342 if debugLevel == 0 then
1343 handler(controlRodSteering)
1344 elseif debugLevel == 1 then
1345 controlRodSteering()
1346 end
1347 end
1348end
1349
1350function handler(functionName)
1351 if pcall(functionName) then
1352 else
1353 term.clear()
1354 term.setCursorPos(1, 1)
1355 printError("Warnung\n\nFehler bei der Reaktoranbindung aufgetreten!\nBitte Verbindung überprüfen!\n\nSystem wird in 30 Sekunden neugestartet...")
1356 display.bootScreen("! Fehler bei Programmstart !")
1357 os.sleep(30)
1358 os.reboot()
1359 end
1360end
1361
1362function pageCheck()
1363 if page < 1 then
1364 page = 4
1365 elseif page > 4 then
1366 page = 1
1367 end
1368end