Buying stacks instead of spam clicking#4640
Conversation
WalkthroughAdds stacked structure upgrades with selectable amounts of 1, 5, 10, 25, or 50. The client previews multiplied costs, menus confirm affordable quantities, intents carry the amount, and execution applies upgrades repeatedly until completion or insufficient funds. ChangesStacked structure upgrades
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Player
participant BuildMenu
participant Transport
participant ExecutionManager
participant UpgradeStructureExecution
Player->>BuildMenu: select upgrade amount
BuildMenu->>Transport: emit upgrade_structure with amount
Transport->>ExecutionManager: send intent payload
ExecutionManager->>UpgradeStructureExecution: create amount-bounded execution
UpgradeStructureExecution->>UpgradeStructureExecution: apply affordable upgrades
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/client/hud/layers/BuildMenu.ts`:
- Around line 388-391: Update handleBuildClick and the _selectedUpgradeUnit flow
to store only the selected buildable unit’s stable type or ID, not the full
BuildableUnit snapshot. Before rendering the upgrade panel and confirming the
action, resolve that identifier against the current playerBuildables collection
so cost, target ID, and upgrade state reflect refresh() results.
- Around line 451-453: Route all visible multiplier labels through localization
using translateText() and add the required entry to resources/lang/en.json:
update src/client/hud/layers/BuildMenu.ts lines 451-453 to use the translated
upgrade-amount message; update src/client/hud/layers/RadialMenuElements.ts lines
468-470 to translate both name and text; and in
src/client/render/gl/passes/WorldTextPass.ts lines 355-358, format the
translated label upstream and pass it into the pure rendering pass.
In `@tests/core/executions/UpgradeStructureExecution.test.ts`:
- Around line 9-14: Replace the manual GameImpl and player initialization with
the tests/util/Setup.ts setup() helper at
tests/core/executions/UpgradeStructureExecution.test.ts lines 9-14 and lines
35-40. Update both test cases to obtain their game and player through setup(),
preserving each test’s existing configuration and behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5c54526a-bd3a-4e2c-9ca0-0adefd18c8e0
📒 Files selected for processing (17)
resources/lang/en.jsonsrc/client/InputHandler.tssrc/client/Transport.tssrc/client/UIState.tssrc/client/controllers/BuildPreviewController.tssrc/client/hud/GameRenderer.tssrc/client/hud/layers/BuildMenu.tssrc/client/hud/layers/RadialMenuElements.tssrc/client/render/gl/Renderer.tssrc/client/render/gl/passes/WorldTextPass.tssrc/client/render/types/Renderer.tssrc/client/view/PlayerView.tssrc/core/Schemas.tssrc/core/execution/ExecutionManager.tssrc/core/execution/UpgradeStructureExecution.tstests/client/graphics/RadialMenuElements.test.tstests/core/executions/UpgradeStructureExecution.test.ts
|
@evanpelle Can you kindly review this |
mind signing |
evanpelle
left a comment
There was a problem hiding this comment.
a few thoughts:
I'm not sure about the radial menu, as that adds another click/press to upgrade buildings. I wonder if there's a way to avoid like, like instead long press to increase the upgrade amount.
could we also use the same system for atom bombs, since that has been a pain point for a while?
Damn I missed it 😅, signed now! |
I originally wanted to avoid the radial menu myself but then I added it as without it the experience that the feature aims to provide might not be same and consistent for everyone as different users have different play styles and preferences. Long presses can be frustrating to deal with especially in situations where you wanna upgrade quickly. Yes we should be able to use the same system for atom bombs, at most would just require a few adjustments to the nearest launch site finding algo to support multi launches at the same time. Would you like me to look into this and implement it? |
Add approved & assigned issue number here: Resolves #3541
Description:
This PR introduces the ability for players to upgrade their structures in bulk stacks (x5, x10, x25, x50), significantly improving late-game UX by minimizing repetitive interactions. This feature integrates seamlessly across both the HTML Build Menu and the Radial Dial interface, supported by a 3D preview system to prevent unintentional expenditures.
Key Changes
Reviewer Testing Steps
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
DISCORD_USERNAME: ulf (Underscore on both sides)