Relay weapon changes so remote players show their equipped weapon#19
Open
constripacity wants to merge 1 commit into
Open
Relay weapon changes so remote players show their equipped weapon#19constripacity wants to merge 1 commit into
constripacity wants to merge 1 commit into
Conversation
The 'change weapon' action (HandleGameActions case 0) was log-only, so other clients never learned which weapon a player equipped and rendered no weapon on remote avatars. Store the weapon on the player's data and relay it (protocol 2 / argument 2), which the client already handles (PlayerChangeWeapon -> EquipWeapon). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
change weaponaction (HandleGameActionscase 0) was log-only it printed the weapon change but never told other clients. So remote players' avatars rendered no weapon.Fix
Store the player's weapon server-side and relay it as
protocol 2 / argument 2. The client already handles this (Client.PlayerChangeWeapon → NetworkPlayer.EquipWeapon), so no client change is needed.Testing
Two clients in a match: switching/equipping a weapon now shows on the other player's avatar. Verified live.
Known limitation (follow-up)
A player who joins after another equipped won't see that weapon until the equipped player switches again the handshake doesn't send current weapons, only changes are relayed. A small follow-up can replay current weapons to new joiners.