Skip to content

fix: equipment crash on old saves and music lifecycle#27

Merged
JesseRWeigel merged 1 commit intomainfrom
fix/music-lifecycle-and-equipment
Mar 16, 2026
Merged

fix: equipment crash on old saves and music lifecycle#27
JesseRWeigel merged 1 commit intomainfrom
fix/music-lifecycle-and-equipment

Conversation

@JesseRWeigel
Copy link
Owner

Summary

  • Bug fix: p.equipment.weapon crashes when old save data lacks equipment field. Added || {} guard.
  • Music lifecycle:
    • Ambient music now starts on game load
    • Combat music plays when entering a gate
    • Ambient music resumes when dismissing combat results

Test plan

  • 215 tests pass
  • Manual: load with old save data (no equipment field) — should not crash
  • Manual: music transitions ambient → combat → victory → ambient

🤖 Generated with Claude Code

- Guard p.equipment access with fallback to empty object, fixing
  "Cannot read properties of undefined (reading 'weapon')" crash
  when loading saves from before equipment system was added
- Play combat music when entering a gate
- Resume ambient music when dismissing combat results
- Start ambient music 2s after game loads

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant