Skip to content

Stable generator ordering by unique id (#123) - #156

Merged
tastybento merged 1 commit into
developfrom
123-generator-sort-order
Jul 4, 2026
Merged

Stable generator ordering by unique id (#123)#156
tastybento merged 1 commit into
developfrom
123-generator-sort-order

Conversation

@tastybento

Copy link
Copy Markdown
Member

Closes #123

Context

The request was for a way to explicitly order generators in the player GUI (e.g. numbers 10/20/30/40). That capability already exists: the per-generator priority field (added in 2.0.0) is admin-editable in the generator edit panel, and the player list is sorted by it (getAllGeneratorTiers: default → priority → type → name).

The one part of the report that wasn't addressed: the final tiebreaker was the friendly name, so renaming a generator moved its position — "it starts showing up right next to the default one instead of staying in the spot it was."

Change

Replace the friendlyName final tiebreaker with the stable uniqueId in the two places generators are sorted:

  • StoneGeneratorManager.getAllGeneratorTiers (drives the player list and most panels)
  • BundleEditPanel

Now, within an equal priority + type, order is stable and independent of renaming. Admins control ordering via priority as before.

Tests

Added to StoneGeneratorManagerTest:

  • ...EqualPrioritySortsByUniqueIdNotName — two tiers, same priority, names in reverse of id order → sorted by id, proving names no longer affect order.
  • ...SortsByPriority — lower priority number comes first regardless of id/name.

All 53 tests in StoneGeneratorManagerTest pass.

Note: priority already provided the display-number ordering the issue asked for; this PR just makes ties stable. If preferred, the issue could instead be closed as already-supported — happy to do that.

🤖 Generated with Claude Code

Generator lists were sorted by default-flag, priority, type and finally
by friendly name. The friendly-name tiebreaker meant renaming a generator
moved it in the player GUI, which was confusing.

Use the stable unique id as the final tiebreaker instead, in both
getAllGeneratorTiers (drives the player list) and the bundle edit panel.
The existing per-generator priority field already lets admins order
generators explicitly (e.g. 10/20/30/40); this makes ordering within an
equal priority stable and rename-independent.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01D7NWPeGXmsUJnnX42X24Rd
@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

@tastybento
tastybento merged commit 63e0d67 into develop Jul 4, 2026
4 checks passed
@tastybento
tastybento deleted the 123-generator-sort-order branch July 4, 2026 18:20
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.

[generator] Ability to sort generators to players

1 participant