Skip to content

Badge sprite renaming assumes the visible state is first and leaves other references unchanged #418

Description

@sylvesterkaczmarek

build_avatar_badges() renames the first Appearance sprite for each player, but unconditionally writes its new name into StateManager.stateConfigs[0].

On main at 1b4239b54303ed593e2335c219f453300b5885dd, a prefab with states:

[{'state': 'waiting'}, {'state': 'badge', 'sprite': 'Badge'}]

produces:

[{'state': 'waiting', 'sprite': 'Badge1'},
 {'state': 'badge', 'sprite': 'Badge'}]

Appearance now defines Badge1, leaving the visible state's Badge reference unresolved and adding a sprite to a state that originally had none. Additional states using that sprite also retain its old name. An unrelated sprite in the first state is overwritten.

The avatar builder already updates every state referring to the renamed sprite. Applying that matching-reference logic to badges preserves state ordering, states without sprites and other sprite references.

Sixteen regression/control cases use actual prefab dictionaries and the public badge/game-object builders. They cover visible states before/after waiting states, multiple matching states, unrelated sprites, one/three players, unchanged input prefabs and independent generated objects. Original code fails nine and passes seven controls; the correction passes all sixteen. This validates configuration building, without claiming rendered-gameplay verification.

This is separate from palette-count validation (#356) and palette annotations (#416). A focused PR is being prepared.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions