Add a combat restart action to the SpireLens options menu #314
No reviewers
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens!314
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/combat-reset-feasibility-731162"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a Restart this combat action under a new "Practice" section in the SpireLens options menu. It replays the fight in progress from the state it began with.
Why this needs no snapshot logic
STS2's run save is a room-boundary snapshot.
SerializableRuncarries no combat state at all — no hand, no piles, no enemies, no powers, no turn number. The write points are what make that coherent:RunManager.EnterMapPointInternalcallsSaveRun(null)on map-node entry, before the room type is rolled.CombatManagersaves again at victory, withroom.MarkPreFinished().So for the whole duration of a combat,
current_run.saveon disk is that combat's opening state, RNG included. Restarting is a replay of the save the game already wrote.How
CombatResettermirrors the main menu's Continue sequence (FromSerializable->SetUpSavedSingleplayer->LoadRun) withRunManager.CleanUp()inserted first, sinceSetUpSavedSingleplayerthrows whileRunManager.Stateis non-null.CleanUpis the Save-and-Quit/Abandon teardown: it setsShouldSave = false(so the half-played fight can never overwrite the save), callsCombatManager.Reset(graceful), and nullsState— but does not callRunManager.OnEnded, so no run outcome is stamped and noRunEndedfires.The save is read and deserialized before any teardown, so a missing or corrupt save aborts with the live run untouched.
Tracking correctness
The result is the Continue path, so
RunStartedre-fires with the same_startTimeandRunTracker's existing run adoption handles it — including the_pendingCombatdiscard. The abandoned attempt is not promoted and the replayed fight is counted once. No new persisted fields, so no schema fixture.UI
The row is guarded (in combat, singleplayer, run save present) and names its own reason when unavailable rather than silently doing nothing. Because it discards a fight in progress it uses a two-step confirm that disarms when focus moves off the row. Action rows now dispatch through a table instead of a hardcoded index.
Timing
Transitions run at 0.12s/0.18s rather than
NTransition's 0.8s default, which is tuned for a deliberate main-menu Continue. Not zero: the run scene is rebuilt in between and an uncovered swap shows a half-destroyed frame. Per-phase stopwatch logging is included so the remaining cost — the disk write inIncrementNumReloads, and the preload/scene-rebuild/room-entry insideLoadRun— is measurable before anything further is cut.Notes
HotReloadInputNode._Inputpostfix.SetUpSavedSingleplayerawaitsIncrementNumReloads, so each restart increments the save'snum_reloads.LoadRunLobbythat cannot be rebuilt here.docs/sts2-runtime-primer.mdgains a section on the room-boundary save model.Verification
Built, deployed, and hot-reloaded (
Patch install: 428 classes patched, 0 failed/skipped,Core.Initialize complete). Per the repo's user-owned verification rule, unit tests and live behavioral verification were not run.