Persist manual control and pump states

This commit is contained in:
Codex Agent
2025-11-22 18:47:19 +01:00
parent f626c99f44
commit 511544c2eb
3 changed files with 21 additions and 0 deletions

View File

@@ -461,6 +461,21 @@ class Reactor:
if health:
self.health_monitor.load_snapshot(health)
LOGGER.info("Reactor state restored from %s", filepath)
# Back-fill pump state lists for compatibility.
if not plant.primary_pumps or len(plant.primary_pumps) < 2:
plant.primary_pumps = [
PumpState(active=self.primary_pump_active, flow_rate=plant.primary_loop.mass_flow_rate / 2, pressure=plant.primary_loop.pressure)
for _ in range(2)
]
if not plant.secondary_pumps or len(plant.secondary_pumps) < 2:
plant.secondary_pumps = [
PumpState(
active=self.secondary_pump_active,
flow_rate=plant.secondary_loop.mass_flow_rate / 2,
pressure=plant.secondary_loop.pressure,
)
for _ in range(2)
]
if len(plant.turbines) < len(self.turbines):
ambient = constants.ENVIRONMENT_TEMPERATURE
while len(plant.turbines) < len(self.turbines):