Skip to content

feat: prefer tech-applied ship in pinned ship level ties - #335

Open
GingerNinja-STFC wants to merge 5 commits into
STFC-Mod:devfrom
GingerNinja-STFC:feat/pinned-ship-tech-tiebreak
Open

GingerNinja-STFC wants to merge 5 commits into
STFC-Mod:devfrom
GingerNinja-STFC:feat/pinned-ship-tech-tiebreak

Conversation

@GingerNinja-STFC

Copy link
Copy Markdown
Contributor

Summary

When several same-hull ships tied on level matched one pinned_ships entry, the winner was previously whichever ship the active sort happened to list first. This change lets the ship with forbidden/chaos tech applied win the tie.

How it works

  • Queries ForbiddenTechManager — the same path the ship tech indicators use — for the ship's forbidden/chaos tech slots, and treats either slot holding an item as "tech applied".
  • The check is memoized per sort (ShipEntry::TechApplied(), resolved lazily to -1/0/1) and only runs on actual level ties between same-hull ships, so there's no cost on normal sorts.
  • All IL2CPP bindings (ForbiddenTechManager singleton, TryGetActiveForbiddenTechSlot, EntitySlot.get_SlotSpecId/get_SlotItemId, BaseShip.get_Id) are resolved and validated once; if anything is missing, the feature degrades to the previous behaviour with a single warning.
  • Adds HullId and Ship accessors to the prime FleetPlayerData header.

Testing

  • xmake f -p macosx -a arm64 -m debug --target_minver=14.6 -y && xmake -y mods — builds clean.
  • git diff --check — clean.
  • Not tested on Windows

Note for reviewers: runtime behavior (a tie between same-hull, same-level ships resolving to the tech-applied one) is not covered by automated tests; worth a quick in-game sanity check with two same-hull ships at equal level, one with forbidden/chaos tech equipped. It seems to work reliably for me, but sanity checks are welcome.

When several same-hull ships tied on level matched one pinned_ships entry,
the winner was whichever ship the active sort listed first. Query
ForbiddenTechManager (the same path the ship tech indicators use) for the
ship's forbidden/chaos tech slots and let the ship with tech applied win the
tie. The check is memoized per sort and only runs on actual level ties;
bindings are lazily resolved and validated once, degrading to the previous
behaviour with a single warning if unavailable.

Adds HullId and Ship accessors to the prime FleetPlayerData header.
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