Skip to content

Conversation

@EnderBoy9217
Copy link
Contributor

@EnderBoy9217 EnderBoy9217 commented Oct 22, 2023

The bug was that the final kill of each round would not show on the scoreboard as a death for the victim.

The regression was introduced in #72 and applied to all round-based gamemodes
Fixes the "Whatever fixed end of round survivors still receiving a death on the scoreboard when round ends, also introduced a bug where the last player killed doesn't receive a death either now." issue made by @GeckoEidechse in #132

Tested in Live Fire and Fastball, also tested in Attrition to make sure it didn't break anything else.
Clearing entities on round end or game end still does not add deaths to scoreboard and everything functions as intended.

@ASpoonPlaysGames
Copy link
Contributor

I think this needs some more testing perhaps.

Looking at the SetWinner code in _gamestate_mp.nut both round based and normal modes enter the WinnerDetermined state, so I'm not sure if this change doesn't have any unintended side-effects

@EnderBoy9217
Copy link
Contributor Author

EnderBoy9217 commented Oct 22, 2023

I played an Attrition round with this change and it seemed unaffected.
In theory it would count some deaths after the round ends and the screen starts fading to black, however, the game either goes straight to epilogue or fades to black and postmatch shortly afterwards.

@ASpoonPlaysGames ASpoonPlaysGames added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Nov 18, 2023
@ASpoonPlaysGames
Copy link
Contributor

ASpoonPlaysGames commented Dec 3, 2025

Did some further investigation into this, it seems that as per the comment here:

bool gamePlayingOrSuddenDeath = GamePlayingOrSuddenDeath() // Storing this off here, the game state can change in the callbacks below which may cause kills to not count

The gamestate is being changed in one of the callbacks there. The kill counts because it is checking against the old gamestate, but later on during PostDeathThread_MP when we handle the death stat, the gamestate has been changed already so we get a mismatch

The check we use should really be if ( GamePlayingOrSuddenDeath() && !file.playerDeathsHidden ) we just have an order of operations issue underlying this.

EDIT:
in _gamestate_mp.nut a player killed callback is registered, which handles checking for final kills, and setting the winning team. The order of operations is as follows:

  • player is killed
  • gamestate is stored for tracking kills
  • winner is determined due to final kill logic (gamestate changes)
  • stored gamestate is checked for tracking kills
  • non-stored gamestate is checked for tracking deaths and death is not registered

@github-actions github-actions bot added the merge conflicts Blocked by merge conflicts, waiting on the author to resolve label Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflicts Blocked by merge conflicts, waiting on the author to resolve needs code review Changes from PR still need to be reviewed in code needs testing Changes from the PR still need to be tested

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants