-
Notifications
You must be signed in to change notification settings - Fork 765
Feat: Transport boats now show arrival ETA #2850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA new helper method estimateBoatEtaSeconds() computes boat ETAs in seconds using distance to target and server turn interval. Boat labels in renderBoats and outgoingBoats now include ETA text when available; no public signatures changed. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
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. Comment |
There was a problem hiding this 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/client/graphics/layers/EventsDisplay.ts:
- Around line 937-939: The hardcoded "s" suffix in EventsDisplay.ts should be
replaced with a translation lookup so time unit formatting is localizable:
update the template that currently inserts (${etaSeconds}s) to call
translateText with a new key (e.g. "events_display.eta_seconds") and substitute
the seconds value (use the existing translateText usage pattern in this file),
and add "events_display.eta_seconds": "{seconds}s" to en.json; locate the string
around renderTroops(boat.troops()) and the conditional using etaSeconds to make
this change.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/client/graphics/layers/EventsDisplay.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 784
File: src/core/game/StatsImpl.ts:125-134
Timestamp: 2025-05-19T06:00:38.007Z
Learning: In StatsImpl.ts, unused parameters in boat/stats-related methods are intentionally kept for future use and shouldn't be removed.
📚 Learning: 2025-05-19T06:00:38.007Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 784
File: src/core/game/StatsImpl.ts:125-134
Timestamp: 2025-05-19T06:00:38.007Z
Learning: In StatsImpl.ts, unused parameters in boat/stats-related methods are intentionally kept for future use and shouldn't be removed.
Applied to files:
src/client/graphics/layers/EventsDisplay.ts
🧬 Code graph analysis (1)
src/client/graphics/layers/EventsDisplay.ts (3)
src/core/game/GameView.ts (2)
UnitView(48-183)targetTile(134-136)src/core/game/UnitImpl.ts (1)
targetTile(381-383)src/client/Utils.ts (2)
translateText(147-202)renderTroops(15-17)
🔇 Additional comments (2)
src/client/graphics/layers/EventsDisplay.ts (2)
931-958: Clean integration of ETA display.The map-based iteration with inline ETA calculation is a clean approach. The conditional rendering when
etaSecondsis null handles edge cases well, and the existing retreat/cancel behavior remains intact.
910-924: The ETA calculation is correct as-is.The formula
distance * secondsPerTickaccurately estimates boat travel time because boats move exactly 1 tile per tick (seeticksPerMove = 1in TransportShipExecution). The calculation is:
- Distance in tiles (10) × seconds per tick (0.1) = total seconds (1)
Boats do not have individual speed properties. Movement speed is hardcoded at the class level (
ticksPerMove = 1), not per unit. Manhattan distance is the appropriate metric throughout the codebase for distance calculations on the grid.While the TODO comment in TransportShipExecution suggests
ticksPerMovemay become configurable in the future, the current implementation is sound. If boat speed were to become configurable, the formula would need updating at that time, but no change is needed now.Likely an incorrect or invalid review comment.
|
Probably like #2061. Which, FYI, got closed 'in PR review' between @iiamlewis and evan, but not sure if they decided not to go with the feature or for other reasons |
|
Linked to issue #1793, which wasn't closed by evan when he removed a label so probably still a chance it'll be accepted as a feature |
Description:
Introduces a light distance estimation function for troop transports that displays their ETA to target destination in the event display in seconds. Works for both outbound and retreating transports. Based on this suggestion in the official Discord.
Screen.Recording.2026-01-10.033708.mp4
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
bijx