Skip to content

Conversation

@FloPinguin
Copy link
Contributor

Description:

Troop count display for naval invasion message:

Screenshot 2026-01-28 204213

On hover, PlayerInfoOverlay shows the troop count now:

Screenshot 2026-01-28 202916

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

FloPinguin

@FloPinguin FloPinguin added this to the v30 milestone Jan 28, 2026
@FloPinguin FloPinguin requested a review from a team as a code owner January 28, 2026 19:58
@FloPinguin FloPinguin added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jan 28, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Walkthrough

Adds troop display for TransportShip units in the unit information UI overlay. Updates the naval invasion notification message to include the transported troop count alongside the attacker name. Both changes display existing data in new locations.

Changes

Cohort / File(s) Summary
Unit Information UI Display
src/client/graphics/layers/PlayerInfoOverlay.ts
Adds conditional rendering block to display troops for TransportShip units alongside existing health display using renderTroops(unit.troops())
Naval Invasion Message
src/core/execution/TransportShipExecution.ts
Updates incoming naval invasion notification to include troop count in parentheses, e.g., "Naval invasion incoming from <attacker> (<troop_count_render>)"

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related issues

Poem

⛵ Troops now show on the vessel's frame,
Both in the UI and invasion's name,
Transport ships reveal their hidden weight,
A clearer picture of each navy's fate! 🎖️

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: displaying troop count for transport ships in the UI.
Description check ✅ Passed The description is directly related to the changeset, providing screenshots, confirming testing and translations, and documenting the feature additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/core/execution/TransportShipExecution.ts`:
- Around line 116-120: Replace the hardcoded English message passed to
mg.displayIncomingUnit with a call to translateText using a translation key
(e.g. "events_display.naval_invasion_inbound") and pass attacker and troops as
params; specifically, in TransportShipExecution where mg.displayIncomingUnit is
invoked (using this.boat.id(), MessageType.NAVAL_INVASION_INBOUND,
this.target.id()), build the message via
translateText("events_display.naval_invasion_inbound", { attacker:
this.attacker.displayName(), troops: renderTroops(this.boat.troops()) }) and use
that instead of the raw string, and ensure you add the corresponding entry to
en.json.
🧹 Nitpick comments (1)
src/core/execution/TransportShipExecution.ts (1)

1-1: Move rendering utilities to shared folder to avoid core → client dependency.

renderTroops is imported from src/client/Utils.ts into core execution code, creating a layering violation. The core layer should not depend on client layer utilities. This pattern affects multiple core files (PlayerImpl.ts, AttackExecution.ts, GameImpl.ts, and others also import renderNumber and translateText from client).

Since these are pure formatting functions (e.g., renderTroops divides by 10 and formats for display), move them to src/core/Utils.ts or a dedicated src/shared/ folder so both core and client layers can use them without breaking layering rules.

Comment on lines 116 to 120
// TODO TranslateText
`Naval invasion incoming from ${this.attacker.displayName()}`,
`Naval invasion incoming from ${this.attacker.displayName()} (${renderTroops(this.boat.troops())})`,
MessageType.NAVAL_INVASION_INBOUND,
this.target.id(),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Hardcoded message string bypasses translation system.

The TODO on line 116 notes this needs translation. The PR description says all text uses translateText(), but this message is a raw English string. Other calls in this file (like lines 64-70) use translation keys with parameter objects.

Consider using a pattern like:

mg.displayIncomingUnit(
  this.boat.id(),
  translateText("events_display.naval_invasion_inbound", {
    attacker: this.attacker.displayName(),
    troops: renderTroops(this.boat.troops()),
  }),
  MessageType.NAVAL_INVASION_INBOUND,
  this.target.id(),
);

This would need a corresponding entry in en.json.

🤖 Prompt for AI Agents
In `@src/core/execution/TransportShipExecution.ts` around lines 116 - 120, Replace
the hardcoded English message passed to mg.displayIncomingUnit with a call to
translateText using a translation key (e.g.
"events_display.naval_invasion_inbound") and pass attacker and troops as params;
specifically, in TransportShipExecution where mg.displayIncomingUnit is invoked
(using this.boat.id(), MessageType.NAVAL_INVASION_INBOUND, this.target.id()),
build the message via translateText("events_display.naval_invasion_inbound", {
attacker: this.attacker.displayName(), troops: renderTroops(this.boat.troops())
}) and use that instead of the raw string, and ensure you add the corresponding
entry to en.json.

@github-project-automation github-project-automation bot moved this from Triage to Development in OpenFront Release Management Jan 28, 2026
Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

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

thanks!

@evanpelle evanpelle merged commit f20028a into openfrontio:main Jan 28, 2026
10 checks passed
@github-project-automation github-project-automation bot moved this from Development to Complete in OpenFront Release Management Jan 28, 2026
@VariableVince VariableVince linked an issue Jan 28, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Show how many troops in transport ship

2 participants