This commit is contained in:
Navid Sassan 2025-12-09 22:37:03 +01:00
parent 61e83d70e7
commit d455e99ed0

View File

@ -97,6 +97,7 @@ local monitor = nil
local lastDisplayUpdate = 0
local reactorInfo = {}
local shutdownRequested = false
local chargeRequested = false -- Track when user requests charging
local errorMessage = ""
local fieldErrors = {} -- Track specific field read errors
@ -448,6 +449,12 @@ local function processStateMachine()
return
end
-- Reactor is no longer cold - clear charge request flag
if chargeRequested then
chargeRequested = false
print("[INFO] Reactor started, charge request cleared")
end
if reactorStatus == "cooling" then
if state == STATES.EMERGENCY or state == STATES.SHUTDOWN then
-- Keep current state during cooldown
@ -571,9 +578,16 @@ local function controlReactor()
outputRate = 0
else
-- OFFLINE: Reactor is cold, no action needed
inputRate = 0
outputRate = 0
-- OFFLINE: Reactor is cold
if chargeRequested then
-- User requested charge - provide input flux to start charging the field
inputRate = CONFIG.emergency_field_input
outputRate = 0
else
-- No action needed
inputRate = 0
outputRate = 0
end
end
-- Apply the flow rates with rate limiting
@ -886,12 +900,13 @@ local function handleInput()
-- Charge reactor
if state == STATES.OFFLINE or state == STATES.SHUTDOWN then
shutdownRequested = false
chargeRequested = true -- Flag to provide input flux
if reactor then
pcall(function()
reactor.chargeReactor()
end)
end
print("Charging reactor...")
print("Charging reactor... providing input flux")
end
elseif key == keys.x then
-- Force exit