Handle positional sounds initating from a player's spot #1257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR splits the sound-playing codes of ranged weapons into two: one for playing to the user and one for playing to the rest of the players.
The code playing sounds from a fixed position is kept but limited to non-users only. This is because the sounds are supposed to be coming from the fixed position where the gunshot starts. Alongside it, another code dedicated to playing sounds to the user is created to fix the sound position to the player's client-side position (because of lag, the server-side and client-side positions may vary, resulting in confusing sound positions).
You may log onto the official CTF server to feel the confusing gunshot sound position. Try to fire a pistol or rifle while running due left or right, and sounds will be played far away. After merging this PR, the issue should be fixed.
Codes in this PR increase the number of sound packets to be sent. Consider this before merging this PR if this would be a notable performance overhead. Otherwise, this PR is ready for review and merging.