Advertisement
PlatinKinggg

Funktionen-BigReactors

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