fix(referee): broadcast pvp_win only once per match - #505
Open
ChronoFinale wants to merge 1 commit into
Open
Conversation
The host referee re-ran try_resolve_round on every play_hand it received (both players, including the host's own loopback, plus stray sends like play_hand(chips,0) and play_hand(0,0) near match end). Once a player's lives hit 0, lose_life was blocked from decrementing further but the pvp_win broadcast had no match-over guard, so it re-fired on every subsequent resolution attempt. Each broadcast loops back through action_win_game/action_lose_game and replays the win jingle and screen. Add a match_over flag to MP.REF, set the first time any pvp_win broadcast site fires (round resolution, survival furthest-blind win, fail_round, fail_timer, fail_pvp_timer) and reset on MP.referee_reset. Also make action_win_game/action_lose_game idempotent against MP.GAME.won/lost as a second line of defense against duplicate winGame/loseGame dispatches.
ChronoFinale
marked this pull request as ready for review
July 23, 2026 22:51
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.
The win jingle and win screen could fire multiple times at match end when stray duplicate events re-broadcast
pvp_win. Guard the win broadcast with amatch_overflag so it fires exactly once.Rebased onto current
mqtt— re-expressed onto the new N-player referee's consolidatedcheck_alive_winpath. Test:luajit tests/test_referee_match_over.lua— green.Closes #488
Testing