WebGL: bring back sounds #3991
Conversation
…d. Now all is done from ClientGameRunner. Added the missing Silo built sound. Which was officially waiting for approval but i'm thinking it was probably overlooked (#3394).
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a typed SoundEffect enum and URL registry, emits SoundUpdateEvent from ClientGameRunner, adds SoundController to translate game updates into PlaySoundEffectEvent emissions, wires the controller into the renderer, and updates HUD layers and tests to use the enum identifiers. ChangesGame Sound Effects
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ 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. Comment |
| this.eventBus.emit(new SendHashEvent(hu.tick, hu.hash)); | ||
| }); | ||
|
|
||
| // Sound FX |
There was a problem hiding this comment.
I think we should create a controller for this? Like SoundController in the controller/ directory
There was a problem hiding this comment.
Agreed, done and also made it a bit more type-safe (hence the other files that emit PlaySoundEffectEvent that were also changed)
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/ClientGameRunner.ts`:
- Around line 522-524: ClientGameRunner currently defines SoundUpdateEvent which
creates a circular import between ClientGameRunner, GameRenderer, and
SoundController; to fix this, extract the SoundUpdateEvent type (the
class/interface/union used to signal sound updates) into a tiny shared module
named e.g. SoundEvents and update imports so ClientGameRunner, GameRenderer, and
SoundController all import SoundUpdateEvent from that new module instead of from
ClientGameRunner; ensure you remove the original SoundUpdateEvent export from
ClientGameRunner and update any import sites to reference the new module so the
three-way init-order cycle is broken.
🪄 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: b333d2e9-0af2-4f4b-9c62-2550ac70c74c
📒 Files selected for processing (8)
src/client/ClientGameRunner.tssrc/client/controllers/SoundController.tssrc/client/hud/GameRenderer.tssrc/client/hud/layers/ActionableEvents.tssrc/client/hud/layers/EventsDisplay.tssrc/client/hud/layers/RadialMenu.tssrc/client/sound/Sounds.tstests/client/sound/SoundManager.test.ts
…n a replay (and possibly others in the future that are not local-player bound)
Description:
Play sound effects again after move to WebGL for which FxLayer.ts was removed. Now all is done from SoundController, triggered from ClientGameRunner.
Also:
We still need to get a decision on adding the other 4 sounds though, for a later PR possibly. Warship shot, Warship lost, SAM shoot, SAM hit. The sound files are present but PR3394 showed status Waiting for approval:
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
tryout33