Skip to content

fix: Reset traits state on chapter change - #1571

Merged
OH296 merged 1 commit into
mainfrom
opencode/issue1567-20260922232622
Sep 22, 2026
Merged

OH296 merged 1 commit into
mainfrom
opencode/issue1567-20260922232622

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Implemented Option 1 (central reset_chapter_traits() helper).

Changes:

  • scripts/scr_ChapterTraits/scr_ChapterTraits.gml: added reset_chapter_traits() next to setup_chapter_traits() - clears obj_creation.chapter_trait_meta and sets all activated = false on all_advantages / all_disadvantages.
  • scripts/scr_chapter_new/scr_chapter_new.gml: call reset_chapter_traits() at top of scr_chapter_new() before points recompute, keeping existing _adv.add() loop for the new chapter.
  • scripts/scr_chapter_random/scr_chapter_random.gml: call reset_chapter_traits() alongside points = 0 reset so blank/random custom starts clean.

This keeps points accounting single-owner (recomputed, not incrementally adjusted) and prevents stale meta from disabling traits on later screens.

Suggested commit (repo pattern fix: ...):
fix: reset chapter traits on chapter select

Closes #1567

github run


Summary by cubic

Fixes stale chapter traits carrying over between selections so picking a new chapter no longer leaves old traits activated or disables traits on later screens.

  • Adds reset_chapter_traits() to clear chapter_trait_meta and set all advantages and disadvantages to activated = false.
  • Calls it when a chapter icon is selected and when a blank/random chapter is created, before points are recomputed.

Written for commit b210bee. Summary will update on new commits.

Review in cubic

Co-authored-by: EttyKitty <EttyKitty@users.noreply.github.com>
@EttyKitty

Copy link
Copy Markdown
Collaborator

/review

@EttyKitty EttyKitty changed the title fix: reset chapter traits on select fix: Reset traits state on chapter change Sep 22, 2026

@lyra-the-bot lyra-the-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Central reset_chapter_traits() correctly clears the two pieces of stale state that caused #1567 (activated flags + chapter_trait_meta, which drives disable()). Both call sites reset before points are recomputed/re-assigned, so no double-counting, and the existing _adv.add() loop re-populates meta/points for the new chapter. Verified scr_initialize_custom and role-ban logic consume only activated, so the reset fully covers downstream state.

@OH296
OH296 merged commit 4120a5d into main Sep 22, 2026
6 checks passed
@EttyKitty
EttyKitty deleted the opencode/issue1567-20260922232622 branch September 22, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Size: Tiny Type: Fix This is a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chapter advantages and disadvantages become unselectable

3 participants