neuroticfox

DC Hybrid v1.0

May 28th, 2026 (edited)
148
0
Never
6
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.34 KB | None | 0 0
  1. local component = require("component")
  2. local computer  = require("computer")
  3. local event     = require("event")
  4. local keyboard  = require("keyboard")
  5. local tty       = require("tty")
  6.  
  7. -- Wrap Reactor Components -------------------------------------------------
  8.  
  9. if not component.isAvailable("draconic_reactor") then
  10.   print("Reactor not connected. Please connect the computer to the reactor with an Adapter block.")
  11.   os.exit()
  12. end
  13.  
  14. local reactor = component.draconic_reactor
  15.  
  16. -- This is 1 by default, but changes based on modpack.
  17. -- Check "Mod Options > Draconic Evolution > Tweaks > reactorOutputMultiplier"
  18. -- and change this value to match.
  19. local reactorOutputMultiplier = 1.0
  20.  
  21. ----------------------------------------------------------------------------
  22.  
  23. -- Gate helpers -------------------------------------------------------------
  24.  
  25. local MAX_GATE_FLOW = 2147000000.0
  26. local STARTUP_CHARGE_FLOW = 5000000.0
  27.  
  28. -- PID only engages within 50C of target. Outside that window the base math
  29. -- runs free and the bias is reset, giving a clean handoff on entry.
  30. local PID_TEMP_WINDOW = 150.0
  31. local PID_FIELD_WINDOW = 2.0
  32.  
  33. local function clamp(value, minValue, maxValue)
  34.   if value ~= value then return minValue end
  35.   if value < minValue then return minValue end
  36.   if value > maxValue then return maxValue end
  37.   return value
  38. end
  39.  
  40. local function setGateFlow(gate, value)
  41.   value = tonumber(value) or 0.0
  42.   value = clamp(value, 0.0, MAX_GATE_FLOW)
  43.   value = value + 0.0
  44.  
  45.   if gate.setFlowOverride then
  46.     return gate.setFlowOverride(value)
  47.   elseif gate.setSignalLowFlow then
  48.     return gate.setSignalLowFlow(math.floor(value + 0.5))
  49.   else
  50.     error("Flux gate does not expose setFlowOverride or setSignalLowFlow.")
  51.   end
  52. end
  53.  
  54. local function getGateFlow(gate)
  55.   if gate.getFlowOverride then
  56.     return gate.getFlowOverride()
  57.   elseif gate.getSignalLowFlow then
  58.     return gate.getSignalLowFlow()
  59.   elseif gate.getFlow then
  60.     return gate.getFlow()
  61.   end
  62.   return 0.0
  63. end
  64.  
  65. local function enableGateOverride(gate)
  66.   if gate.setOverrideEnabled then
  67.     pcall(gate.setOverrideEnabled, true)
  68.   end
  69. end
  70.  
  71. local function safeReactorCall(name)
  72.   if reactor[name] then
  73.     pcall(reactor[name])
  74.   end
  75. end
  76.  
  77. -- DC14-style smart gate lookup.
  78. local function smartGateLookup()
  79.   local fluxGates = {}
  80.  
  81.   for address in pairs(component.list("flux_gate")) do
  82.     fluxGates[#fluxGates + 1] = address
  83.   end
  84.  
  85.   if #fluxGates < 2 then
  86.     print("Not enough flux gates connected; please connect inflow and outflow flux gates with Adapter blocks.")
  87.     os.exit()
  88.   end
  89.  
  90.   local inputFlux  = component.proxy(fluxGates[1])
  91.   local outputFlux = component.proxy(fluxGates[2])
  92.  
  93.   if not inputFlux or not outputFlux then
  94.     print("Not enough flux gates connected; please connect inflow and outflow flux gates with Adapter blocks.")
  95.     os.exit()
  96.   end
  97.  
  98.   enableGateOverride(outputFlux)
  99.   enableGateOverride(inputFlux)
  100.  
  101.   local infoOne = reactor.getReactorInfo()
  102.   local satOne = infoOne.energySaturation or 0.0
  103.   local fieldOne = infoOne.fieldStrength or 0.0
  104.  
  105.   safeReactorCall("chargeReactor")
  106.   setGateFlow(inputFlux, 1.0)
  107.   os.sleep(0.5)
  108.  
  109.   local infoTwo = reactor.getReactorInfo()
  110.   local satTwo = infoTwo.energySaturation or 0.0
  111.   local fieldTwo = infoTwo.fieldStrength or 0.0
  112.  
  113.   setGateFlow(inputFlux, 0.0)
  114.   safeReactorCall("stopReactor")
  115.  
  116.   if satTwo <= satOne or fieldTwo <= fieldOne then
  117.     local oldAddr = inputFlux.address
  118.     inputFlux = component.proxy(outputFlux.address)
  119.     outputFlux = component.proxy(oldAddr)
  120.   end
  121.  
  122.   enableGateOverride(outputFlux)
  123.   enableGateOverride(inputFlux)
  124.  
  125.   return inputFlux, outputFlux
  126. end
  127.  
  128. local input_flux, output_flux = smartGateLookup()
  129.  
  130. local keyStatus = "Keys: [S] swap flux gates  [X] force close  [Up/Down] temp +/-100C  [Left/Right] field +/-0.25%"
  131.  
  132. local targetTemp = nil
  133. local targetShield = nil
  134.  
  135. local function swapFluxGates()
  136.   local oldGate = input_flux
  137.   input_flux = output_flux
  138.   output_flux = oldGate
  139.  
  140.   enableGateOverride(input_flux)
  141.   enableGateOverride(output_flux)
  142.  
  143.   keyStatus = "Flux gates swapped. Keys: [S] swap flux gates  [X] force close  [Up/Down] temp +/-100C  [Left/Right] field +/-0.25%"
  144. end
  145.  
  146. local function adjustTargetTemp(offset)
  147.   targetTemp = clamp((tonumber(targetTemp) or 8000.0) + offset, 2500.0, 15000.0)
  148.   keyStatus = string.format("Target temp now %.0fC. Keys: [S] swap  [X] exit  [Up/Down] temp +/-100C  [Left/Right] field +/-0.25%%", targetTemp)
  149. end
  150.  
  151. local function adjustTargetField(offsetPercent)
  152.   local currentPercent = (tonumber(targetShield) or 0.5) * 100.0
  153.   currentPercent = clamp(currentPercent + offsetPercent, 1.0, 100.0)
  154.   targetShield = currentPercent / 100.0
  155.   keyStatus = string.format("Target field now %.2f%%. Keys: [S] swap  [X] exit  [Up/Down] temp +/-100C  [Left/Right] field +/-0.25%%", currentPercent)
  156. end
  157.  
  158. local function handleKeys(timeout)
  159.   local ev, _, char, code = event.pull(timeout or 0.025)
  160.  
  161.   if ev == "key_down" then
  162.     if char == string.byte("s") or char == string.byte("S") then
  163.       swapFluxGates()
  164.     elseif char == string.byte("x") or char == string.byte("X") then
  165.       tty.clear()
  166.       print("Force closed.")
  167.       os.exit()
  168.     elseif code == keyboard.keys.up then
  169.       adjustTargetTemp(100.0)
  170.     elseif code == keyboard.keys.down then
  171.       adjustTargetTemp(-100.0)
  172.     elseif code == keyboard.keys.right then
  173.       adjustTargetField(0.25)
  174.     elseif code == keyboard.keys.left then
  175.       adjustTargetField(-0.25)
  176.     end
  177.   end
  178. end
  179.  
  180. -- This script has no GUI start button, so after the DC14 gate probe stops
  181. -- the reactor, immediately arm a real startup cycle.
  182. local startupChargeArmed = true
  183.  
  184. -- Persistent temp correction in raw RF/t.
  185. -- Two-way: trim may subtract output when hot, or add output when cool.
  186. local tempOutputBias = 0.0
  187. local tempLastError = nil
  188.  
  189. -- PID only activates within PID_TEMP_WINDOW of target. Base math handles
  190. -- everything outside that range and resets bias for a clean handoff.
  191. local TEMP_P_RF = 0.0
  192. local TEMP_I_RF_PER_SEC = 50000.0
  193. local TEMP_BIAS_LEAK = 0.9994
  194. local TEMP_RELEASE_LEAK = 0.5000
  195. local TEMP_HOLD_LEAK = 0.9998
  196. local TEMP_TRIM_DEADBAND = 0.0
  197. local TRIM_EPSILON_RF = 1.0
  198.  
  199. -- Persistent field correction in raw RF/t.
  200. -- One-way only: field trim may only subtract input. It cannot force field rise.
  201. local fieldInputBias = 0.0
  202. local fieldLastError = nil
  203.  
  204. -- Extra damped field trim. Still scaled from inputBase, just less twitchy.
  205. local FIELD_TRIM_DEADBAND = 0.00005
  206. local FIELD_P_INPUT_FRACTION = 0.95
  207. local FIELD_I_INPUT_FRACTION_PER_SEC = 0.20
  208. local FIELD_BIAS_LEAK = 0.9925
  209. local FIELD_RELEASE_LEAK = 0.9850
  210. local FIELD_HOLD_LEAK = 0.9920
  211. local FIELD_MAX_TRIM_FRACTION = 0.65
  212.  
  213. ----------------------------------------------------------------------------
  214.  
  215. -- Control Variables --------------------------------------------------------
  216.  
  217. local tArgs = {...}
  218. targetTemp = tonumber(tArgs[1]) or 8000.0
  219. targetShield = tonumber(tArgs[2]) or 0.5
  220.  
  221. if targetTemp < 2500.0 then
  222.   targetTemp = 2500.0
  223. elseif targetTemp > 15000.0 then
  224.   targetTemp = 15000.0
  225. end
  226.  
  227. if targetShield < 0.01 then
  228.   targetShield = 0.01
  229. elseif targetShield > 1.0 then
  230.   targetShield = 1.0
  231. end
  232.  
  233. ----------------------------------------------------------------------------
  234.  
  235. local function resetTempBias()
  236.   tempOutputBias = 0.0
  237.   tempLastError = nil
  238. end
  239.  
  240. local function resetFieldBias()
  241.   fieldInputBias = 0.0
  242.   fieldLastError = nil
  243. end
  244.  
  245. ----------------------------------------------------------------------------
  246.  
  247. -- EMA state for display smoothing only. Never used for reactor control.
  248. local EMA_ALPHA = 0.05
  249. local emaGrossOutput = nil
  250. local emaNetOutput   = nil
  251. local emaEfficiency  = nil
  252.  
  253. local function emaUpdate(current, newValue)
  254.   if current == nil then return newValue end
  255.   return current + EMA_ALPHA * (newValue - current)
  256. end
  257.  
  258. -- Last known gate values for display. Updated after gates are set each tick.
  259. local displayInputFlow  = 0.0
  260. local displayOutputFlow = 0.0
  261.  
  262. local function update()
  263.   local lastTick = computer.uptime()
  264.  
  265.   while true do
  266.     tty.clear()
  267.  
  268.     local now = computer.uptime()
  269.     local dt = clamp(now - lastTick, 0.001, 0.25)
  270.     lastTick = now
  271.  
  272.     local reactorInfo = reactor.getReactorInfo()
  273.  
  274.     -- One-tick projected field ---------------------------------------------
  275.     -- The reactor info appears one tick behind the flux gate effect.
  276.     -- Control/readout use projected field = raw field + one tick input - one tick drain.
  277.  
  278.     local rawFieldStrength = reactorInfo.fieldStrength
  279.     local lastInputFlow = getGateFlow(input_flux)
  280.     local oneTickFieldDelta = lastInputFlow - reactorInfo.fieldDrainRate
  281.  
  282.     local projectedFieldStrength = clamp(
  283.       rawFieldStrength + oneTickFieldDelta,
  284.       0.0,
  285.       reactorInfo.maxFieldStrength
  286.     )
  287.  
  288.     local rawFieldPercent = (rawFieldStrength / reactorInfo.maxFieldStrength) * 100.0
  289.     local projectedFieldPercent = (projectedFieldStrength / reactorInfo.maxFieldStrength) * 100.0
  290.     local oneTickFieldDeltaPercent = (oneTickFieldDelta / reactorInfo.maxFieldStrength) * 100.0
  291.  
  292.     -- Generation stats EMA — display only, never used for control.
  293.     local rawGross = reactorInfo.generationRate
  294.     local rawNet   = rawGross - displayInputFlow
  295.     local rawEff   = 0.0
  296.     if displayInputFlow > 0.0 then
  297.       rawEff = ((displayOutputFlow - displayInputFlow) / displayInputFlow) * 100.0
  298.     end
  299.  
  300.     emaGrossOutput = emaUpdate(emaGrossOutput, rawGross)
  301.     emaNetOutput   = emaUpdate(emaNetOutput,   rawNet)
  302.     emaEfficiency  = emaUpdate(emaEfficiency,  rawEff)
  303.  
  304.     -- Field display values (not gate-dependent)
  305.     local RELATIVE_FIELD_SAFETY = 3.0
  306.     local minFieldFraction = (reactorInfo.fieldDrainRate / reactorInfo.maxFieldStrength) * RELATIVE_FIELD_SAFETY
  307.     local relativeField = 0.0
  308.     if (1.0 - minFieldFraction) > 0.0 then
  309.       relativeField = ((rawFieldPercent / 100.0) - minFieldFraction) / (1.0 - minFieldFraction) * 100.0
  310.     end
  311.     relativeField = clamp(relativeField, 0.0, 100.0)
  312.  
  313.     -- Adjusted = what the DE UI shows (raw + one tick of drain offset)
  314.     local adjustedDisplayField = rawFieldPercent + (reactorInfo.fieldDrainRate / reactorInfo.maxFieldStrength * 100.0)
  315.  
  316.     local targetSatPercent = 0.0
  317.  
  318.     -- CALCULATIONS ---------------------------------------
  319.  
  320.     local targetTemp50  = math.min((targetTemp / 10000.0) * 50.0, 99.0)
  321.     local coreSat       = reactorInfo.energySaturation / reactorInfo.maxEnergySaturation
  322.     local convLVL       = (reactorInfo.fuelConversion / reactorInfo.maxFuelConversion * 1.3) - 0.3
  323.  
  324.     local targetTempResist = ((targetTemp50^4) / (100.0 - targetTemp50))
  325.  
  326.     local targetTempExpo = -(targetTempResist * convLVL) - 1000.0 * convLVL + targetTempResist
  327.  
  328.     local term1 = 1334.1 - (3.0 * targetTempExpo)
  329.     local term2 = (1200690.0 - (2700.0 * targetTempExpo))^2
  330.     local term3 = ((-1350.0 * targetTempExpo) + (((-4.0 * term1^3 + term2)^(1.0 / 2.0)) / 2.0) + 600345.0)^(1.0 / 3.0)
  331.     local targetNegCSat = -(term1 / (3.0 * term3)) - (term3 / 3.0)
  332.  
  333.     local targetCoreSat = 1.0 - (targetNegCSat / 99.0)
  334.     local targetSat = targetCoreSat * reactorInfo.maxEnergySaturation
  335.     targetSatPercent = targetCoreSat * 100.0
  336.  
  337.     local saturationError = reactorInfo.energySaturation - targetSat
  338.  
  339.     local tempDrainFactor = 0.0
  340.     if reactorInfo.temperature > 8000.0 then
  341.       tempDrainFactor = 1.0 + ((reactorInfo.temperature - 8000.0)^2 * 0.0000025)
  342.     elseif reactorInfo.temperature > 2000.0 then
  343.       tempDrainFactor = 1.0
  344.     elseif reactorInfo.temperature > 1000.0 then
  345.       tempDrainFactor = (reactorInfo.temperature - 1000.0) / 1000.0
  346.     end
  347.  
  348.     local baseMaxRFt = (reactorInfo.maxEnergySaturation / 1000.0) * reactorOutputMultiplier * 1.5
  349.     local fieldDrain = math.min(tempDrainFactor * math.max(0.01, (1.0 - coreSat)) * (baseMaxRFt / 10.923556), MAX_GATE_FLOW)
  350.  
  351.     local fieldNegPercent = 1.0 - targetShield
  352.  
  353.     -- Subtract one tick of drain from target to compensate for DE UI display lag.
  354.     -- DE reads one tick ahead of what the script sees, so it always shows slightly high.
  355.     local adjustedShield = targetShield - (reactorInfo.fieldDrainRate / reactorInfo.maxFieldStrength)
  356.  
  357.     local fieldStrengthError = (reactorInfo.maxFieldStrength * adjustedShield) - rawFieldStrength
  358.  
  359.     local availableField = math.max(1.0, reactorInfo.maxFieldStrength - rawFieldStrength)
  360.     local requiredInput = math.min((reactorInfo.maxFieldStrength * reactorInfo.fieldDrainRate) / availableField, availableField)
  361.  
  362.     -- Print the clean UI now that all values are computed
  363.     local currentSatPercent = (reactorInfo.energySaturation / reactorInfo.maxEnergySaturation) * 100.0
  364.  
  365.     print("=== Generation Statistics ===")
  366.     print(string.format("  Gross Output:  %.0f RF/t", emaGrossOutput or 0.0))
  367.     print(string.format("  Net Output:    %.0f RF/t", emaNetOutput or 0.0))
  368.     print(string.format("  Efficiency:    %.1f%%", emaEfficiency or 0.0))
  369.     print("")
  370.     print("=== Reactor Stats ===")
  371.     print(string.format("  Target Temp:   %.0f C", targetTemp))
  372.     print(string.format("  Temperature:   %.1f C", reactorInfo.temperature))
  373.     print(string.format("  Target Sat:    %.2f%%", targetSatPercent))
  374.     print(string.format("  Saturation:    %.2f%%", currentSatPercent))
  375.     print("")
  376.     print("=== Field Strength ===")
  377.     print(string.format("  Adjusted:      %.4f%%", adjustedDisplayField))
  378.     print(string.format("  Tickback:      %.4f%%", rawFieldPercent))
  379.     print(string.format("  Relative:      %.2f%%", relativeField))
  380.     print("")
  381.     print("=== Gates ===")
  382.     print(string.format("  Input Gate ID:   %s", tostring(input_flux.address)))
  383.     print(string.format("  Reactor Input:   %.0f RF/t", displayInputFlow))
  384.     print(string.format("  Output Gate ID:  %s", tostring(output_flux.address)))
  385.     print(string.format("  Reactor Output:  %.0f RF/t", displayOutputFlow))
  386.     print("")
  387.     print(keyStatus)
  388.     print("")
  389.  
  390.     -------------------------------------------------------
  391.  
  392.     if reactorInfo.temperature >= 2000.0 and reactorInfo.status == "warming_up" then
  393.       safeReactorCall("activateReactor")
  394.     end
  395.  
  396.     if reactorInfo.status == "running" then
  397.       startupChargeArmed = false
  398.     end
  399.  
  400.     if startupChargeArmed and reactorInfo.status ~= "running" then
  401.       resetTempBias()
  402.       resetFieldBias()
  403.  
  404.       safeReactorCall("chargeReactor")
  405.       setGateFlow(output_flux, 0.0)
  406.       setGateFlow(input_flux, STARTUP_CHARGE_FLOW)
  407.  
  408.       print("Startup charge armed.")
  409.       print(string.format("Setting output flux gate to %.0f RF/t", 0.0))
  410.       print(string.format("Setting input flux gate to %.0f RF/t", STARTUP_CHARGE_FLOW))
  411.  
  412.     elseif reactorInfo.status == "running" then
  413.  
  414.       if reactorInfo.fuelConversion / reactorInfo.maxFuelConversion > 0.85 then
  415.         reactor.stopReactor()
  416.       end
  417.  
  418.       local outputBase = math.min(saturationError, (reactorInfo.maxEnergySaturation / 40.0))
  419.  
  420.       -- Temperature trim:
  421.       -- PID only activates within PID_TEMP_WINDOW (50C) of target.
  422.       -- Outside that window resetTempBias() keeps bias clean for handoff.
  423.       -- Two-way: negative error (hot) subtracts output, positive error (cool) adds output.
  424.       local tempError = targetTemp - reactorInfo.temperature
  425.       local tempPidTrim = 0.0
  426.  
  427.       if math.abs(tempError) <= PID_TEMP_WINDOW then
  428.         -- Accumulate bias in whichever direction error points.
  429.         if tempLastError ~= nil and (tempLastError * tempError < 0.0) then
  430.           -- Error crossed zero, reset bias for clean handoff.
  431.           tempOutputBias = 0.0
  432.         end
  433.  
  434.         tempOutputBias = (tempOutputBias * TEMP_BIAS_LEAK) + (tempError * TEMP_I_RF_PER_SEC * dt)
  435.  
  436.         if math.abs(tempOutputBias) < TRIM_EPSILON_RF then
  437.           tempOutputBias = 0.0
  438.         end
  439.  
  440.         tempPidTrim = (tempError * TEMP_P_RF) + tempOutputBias
  441.  
  442.         tempLastError = tempError
  443.       else
  444.         resetTempBias()
  445.       end
  446.  
  447.       local outputNeeded = clamp(outputBase + tempPidTrim, 0.0, MAX_GATE_FLOW)
  448.       setGateFlow(output_flux, outputNeeded)
  449.  
  450.  
  451.  
  452.       local inputBase = math.min(fieldStrengthError + requiredInput, reactorInfo.maxFieldStrength)
  453.  
  454.       local currentFieldPercent = rawFieldPercent
  455.       local targetFieldPercent = adjustedShield * 100.0
  456.  
  457.       -- Field trim:
  458.       -- Above target field = negative error = subtract input.
  459.       -- Below target field = positive error = PID is NOT allowed to add input.
  460.       local fieldPercentError = targetFieldPercent - currentFieldPercent
  461.       local fieldPidTrim = 0.0
  462.       local fieldTrimLimit = math.max(1000.0, inputBase * FIELD_MAX_TRIM_FRACTION)
  463.  
  464.       if math.abs(fieldPercentError) <= PID_FIELD_WINDOW then
  465.         if fieldPercentError < -FIELD_TRIM_DEADBAND then
  466.           -- Field is high. Accumulate negative input trim.
  467.           if fieldLastError ~= nil and fieldLastError > 0.0 then
  468.             fieldInputBias = 0.0
  469.           end
  470.  
  471.           fieldInputBias = (fieldInputBias * FIELD_BIAS_LEAK) +
  472.             (fieldPercentError * inputBase * FIELD_I_INPUT_FRACTION_PER_SEC * dt)
  473.  
  474.           fieldInputBias = clamp(fieldInputBias, -fieldTrimLimit, 0.0)
  475.  
  476.           fieldPidTrim = (fieldPercentError * inputBase * FIELD_P_INPUT_FRACTION) + fieldInputBias
  477.           fieldPidTrim = clamp(fieldPidTrim, -fieldTrimLimit, 0.0)
  478.  
  479.         elseif fieldPercentError > FIELD_TRIM_DEADBAND then
  480.           -- Field is low. PID cannot add input.
  481.           -- Release negative trim and let base math handle field recovery.
  482.           fieldInputBias = fieldInputBias * FIELD_RELEASE_LEAK
  483.           fieldInputBias = clamp(fieldInputBias, -fieldTrimLimit, 0.0)
  484.  
  485.           if math.abs(fieldInputBias) < TRIM_EPSILON_RF then
  486.             fieldInputBias = 0.0
  487.           end
  488.  
  489.           fieldPidTrim = fieldInputBias
  490.  
  491.           if fieldPidTrim > 0.0 then
  492.             fieldPidTrim = 0.0
  493.           end
  494.  
  495.         else
  496.           -- Very close to target. Hold trim briefly, but bleed faster than before.
  497.           fieldInputBias = fieldInputBias * FIELD_HOLD_LEAK
  498.           fieldInputBias = clamp(fieldInputBias, -fieldTrimLimit, 0.0)
  499.  
  500.           if math.abs(fieldInputBias) < TRIM_EPSILON_RF then
  501.             fieldInputBias = 0.0
  502.           end
  503.  
  504.           fieldPidTrim = fieldInputBias
  505.  
  506.           if fieldPidTrim > 0.0 then
  507.             fieldPidTrim = 0.0
  508.           end
  509.         end
  510.  
  511.         fieldLastError = fieldPercentError
  512.       else
  513.         resetFieldBias()
  514.       end
  515.  
  516.       local inputNeeded = clamp(inputBase + fieldPidTrim, 0.0, reactorInfo.maxFieldStrength)
  517.       setGateFlow(input_flux, inputNeeded)
  518.       displayInputFlow  = inputNeeded
  519.       displayOutputFlow = outputNeeded
  520.  
  521.     elseif reactorInfo.status == "warming_up" then
  522.  
  523.       resetTempBias()
  524.       resetFieldBias()
  525.  
  526.       setGateFlow(output_flux, 0.0)
  527.       setGateFlow(input_flux, STARTUP_CHARGE_FLOW)
  528.       displayInputFlow  = STARTUP_CHARGE_FLOW
  529.       displayOutputFlow = 0.0
  530.       print("Reactor Charging; flooding reactor")
  531.  
  532.     elseif reactorInfo.status == "stopping" then
  533.  
  534.       resetTempBias()
  535.       resetFieldBias()
  536.  
  537.       setGateFlow(output_flux, 0.0)
  538.       setGateFlow(input_flux, requiredInput)
  539.       displayInputFlow  = requiredInput
  540.       displayOutputFlow = 0.0
  541.       print(string.format("Setting input flux gate to %.0f RF/t", getGateFlow(input_flux)))
  542.  
  543.     else
  544.       resetTempBias()
  545.       resetFieldBias()
  546.     end
  547.  
  548.  
  549.  
  550.     handleKeys(0.025)
  551.   end
  552. end
  553.  
  554. update()
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment