# Reactor Maintenance Rewrite Tasks

## Current State
- Approved design iteration targets the simulation model, rule removal, action economy, reactor requirements, and editor layer workflow.
- Work is proceeding on branch `design-iteration-structural-editor` in methodical commits.
- Completed commits:
  - `787f1e5` Document approved design iteration.
  - `3d40617` Restore complete design system documentation.
  - `e1ac56d` Rework simulation rules.
- Design documentation must preserve every existing system-level rule unless a change explicitly supersedes it. Superseded sections must document the replacement behavior with equal detail.
- The next implementation iteration is the Win2D editor overhaul.

## Completed Work
- Created the approved implementation plan for:
  - single multi-service consumers,
  - count-based reactor requirements,
  - cell-derived doors,
  - 0-10 structural integrity,
  - fixed automatic rule systems,
  - quick/lengthy action economy,
  - all-seeing-eye viewing without persistent unlocking,
  - layer-aware editor visualization and tools.
- Repaired the design documentation after the hazard-interaction regression:
  - restored the complete surface hazard interaction matrix,
  - documented that leaked coolant plus leaked fuel directly holds unless mediated by heat/electricity,
  - expanded structural integrity, consumer, reactor, all-seeing-eye, and action-economy details.
- Reworked simulation state and systems:
  - removed data-driven rule predicates/effects/events from runtime state, validation, forecasts, serialization, and tests,
  - replaced explicit reactor consumer bindings with unbound reactor controls plus required fuel/coolant/electricity consumer counts,
  - made consumer props carrier-agnostic with per-carrier service state derived from networks beneath the cell,
  - moved doors from explicit edge state to door props on floor cells with orientation inferred from opposing wall cells,
  - added underground structural integrity, high-pressure degradation, automatic leak creation, structural forecasts, and repair-to-max behavior,
  - removed action budgets and made movement quick while mutating interactions resolve one simulation step,
  - removed persistent all-seeing-eye unlocking from simulation state,
  - bumped serialized level schema to version 3.
- Updated simulation tests for the replacement systems:
  - consumer derivation and disabled consumer service state,
  - count-based reactor readiness and reactor-under-network positive-flow requirement,
  - quick movement versus lengthy door interaction,
  - inferred door blocking,
  - structural degradation, automatic leaks, repair integrity reset,
  - schema version 3 round-tripping and old-schema rejection.
- Kept the Win2D project compiling after the simulation model changes with narrow compatibility edits. Full editor workflow/rendering work remains outstanding.
- Verified after the simulation rework:
  - `dotnet test tests\ReactorMaintenance.Simulation.Tests\ReactorMaintenance.Simulation.Tests.csproj` passed with 23 tests,
  - `dotnet build ReactorMaintenance.slnx` passed with 0 warnings.
- Reworked the Win2D editor workflow:
  - added the Surface/Electricity/Fuel/Coolant layer combobox,
  - filtered tools by active layer and fixed exclusive tool selection,
  - rendered underground networks as carrier-colored centerline networks with source dots and layer opacity rules,
  - removed Rule Events, Reactor Binding, and pending workflow panels from the editor UI,
  - replaced two-click electricity leak authoring with electric-layer leak access cycling,
  - made Shift+left drag pan in all tools and Cursor drag move the robot or props.
- Added editor-helper tests for electricity leak access cycling and cursor drag movement behavior.
- Verified after the editor overhaul:
  - `dotnet test tests\ReactorMaintenance.Simulation.Tests\ReactorMaintenance.Simulation.Tests.csproj` passed with 26 tests,
  - `dotnet build ReactorMaintenance.slnx` passed with 0 warnings.

## Current Work
- Editor overhaul implementation is complete; commit is pending.

## Editor Overhaul Requirements
- Add a layer combobox with Surface, Electricity, Fuel, and Coolant.
- When Surface is active, draw the surface layer at full opacity and all underground layers at 25% opacity.
- When an underground layer is active, draw the surface layer at 50% opacity, other underground layers at 25% opacity, and the active underground layer at full opacity.
- Render coolant blue, fuel red, and electricity yellow.
- Render networks as thick lines connecting adjacent cell centers; render sources as large centered dots.
- Make tools layer-aware:
  - Cursor is always available.
  - Heat, Floor, Walls, Props, Consumers, Hazards, and Doors are only available for Surface.
  - Network painting and Sources are only available on their respective underground layers.
- Selecting a tool must deselect all other tools. The current two-way binding can leave multiple tools selected.
- Shift+LMB should pan the view in all tools, including Cursor mode.
- Cursor LMB drag should move any prop or robot from one cell to another.
- Remove Rule Events UI.
- Remove Reactor Binding UI.
- Remove editor workflow and pending actions.
- Door cells are redesigned as single prop cells.
- Electricity leak neighbour should be toggled by using the electric leak tool on an existing electric leak cell.

## Future Work
- Add authored sample levels once the new schema stabilizes.
- Tune structural integrity balancing after playtesting.
- Extend UI affordances for inspecting per-carrier consumer service state.
