Conversation
Rate Limit Exceeded@TTENSHII has exceeded the limit for the number of files or commits that can be reviewed per hour. Please wait 16 minutes and 20 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, convert this PR to a draft and then mark it as ready for review again to re-trigger the review. Alternatively, you can push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per repository. WalkthroughThe changes introduce audio functionality to the game by adding a new constant Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Review Status
Actionable comments generated: 2
Files selected for processing (2)
- src/Client/Systems/Events/EventsSystems.cpp (3 hunks)
- src/Client/Systems/Graphic/AudioSystems.cpp (1 hunks)
Files skipped from review due to trivial changes (1)
- src/Client/Systems/Graphic/AudioSystems.cpp
| const std::size_t waitTimeBullet = 500; | ||
| const std::string soundPathShoot = "assets/Audio/Sounds/laser.ogg"; |
There was a problem hiding this comment.
The soundPathShoot constant is defined within the playerShootBullet function. If this sound path is used elsewhere in the code, consider moving it to a more global scope to avoid duplication.
There was a problem hiding this comment.
Review Status
Actionable comments generated: 1
Files selected for processing (1)
- src/Client/Systems/Events/EventsSystems.cpp (3 hunks)
Additional comments (Suppressed): 2
src/Client/Systems/Events/EventsSystems.cpp (2)
67-68: The
soundPathShootconstant is defined but not used in the old hunk. Ensure that it is used appropriately in the new hunk.74-80: The retrieval of
arrSoundsandidsseems to be a new addition to the function. Ensure that these are used appropriately in the function and that the necessary error handling is in place in case the retrieval fails.
…Bus into fix/RB-137-Fix-bullets-sounds
There was a problem hiding this comment.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- src/Client/Systems/Events/EventsSystems.cpp (2 hunks)
Additional comments (Suppressed): 2
src/Client/Systems/Events/EventsSystems.cpp (2)
67-70: The
waitTimeBulletandsoundPathShootvariables have been moved inside theplayerShootBulletfunction and made static. This change is good for encapsulation and makes the function more self-contained. However, ensure that thewaitTimeBulletvariable is not used elsewhere in the codebase, as this change would break those references.85-89: The new code introduces audio functionality to the
playerShootBulletfunction. It retrieves theRaylib::Soundcomponents from the registry and iterates over them to find the sound with the matching path. If found, it sets theneedToPlayflag of the sound to true. This is a good addition for enhancing the game's user experience. However, consider extracting this logic into a separate function for better modularity and reusability.void playSound(const std::string& soundPath) { Registry ®istry = Registry::getInstance(); Registry::components<Raylib::Sound> arrSounds = registry.getComponents<Raylib::Sound>(); for (auto &sound : arrSounds) { if (sound.getPath() == soundPath) { sound.setNeedToPlay(true); } } }Then, you can simply call this function in
playerShootBullet:void playerShootBullet(std::size_t /*unused*/, std::size_t /*unused*/) { // ... playSound(soundPathShoot); // ... }
PATCH
What is the current behavior? (link an issue based on the kind of change this pr introduce)
What is the new behavior (if this is a feature change)?
Other information:
Summary by CodeRabbit