]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Properly reset weapon accuracy on player respawn if sv_ready_restart_after_countdown...
authorterencehill <piuntn@gmail.com>
Sat, 11 Dec 2021 15:56:46 +0000 (16:56 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 11 Dec 2021 15:56:46 +0000 (16:56 +0100)
z411: "I think it seems to work as you expect because you are resetting the accuracies before the match starts, but once the players respawn accuracy_resend() which actually sends the stats is called in PutPlayerInServer() when they respawn. So the server is actually resetting the stats before it should, but sends them when they respawn."

qcsrc/server/command/vote.qc

index e064b717cdf657265fe57aa8d3f3c95fbf88504a..09e277116a9efcc8c180355a9ee836a0eac9a039 100644 (file)
@@ -352,8 +352,11 @@ void reset_map(bool dorespawn)
                shuffleteams_on_reset_map = false;
        }
 
                shuffleteams_on_reset_map = false;
        }
 
-       FOREACH_CLIENT(IS_PLAYER(it),
-       {
+       FOREACH_CLIENT(true, {
+               if (time <= game_starttime)
+                       accuracy_reset(it); // for spectators too because weapon accuracy is persistent
+               if (!IS_PLAYER(it))
+                       continue;
                if (STAT(FROZEN, it))
                        Unfreeze(it, false);
                player_powerups_remove_all(it);
                if (STAT(FROZEN, it))
                        Unfreeze(it, false);
                player_powerups_remove_all(it);
@@ -442,10 +445,7 @@ void ReadyRestart_force()
        game_starttime = time + RESTART_COUNTDOWN;
 
        // clear player attributes
        game_starttime = time + RESTART_COUNTDOWN;
 
        // clear player attributes
-       FOREACH_CLIENT(true, {
-               accuracy_reset(it);
-               if (!IS_PLAYER(it))
-                       continue;
+       FOREACH_CLIENT(IS_PLAYER(it), {
                it.alivetime = 0;
                CS(it).killcount = 0;
                float val = PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_ALIVETIME, 0);
                it.alivetime = 0;
                CS(it).killcount = 0;
                float val = PlayerStats_GameReport_Event_Player(it, PLAYERSTATS_ALIVETIME, 0);