]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Exclude time before the match starts (countdown) in the alive time sent to Xonstat
authorterencehill <piuntn@gmail.com>
Sun, 18 May 2025 18:17:03 +0000 (20:17 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 18 May 2025 18:17:03 +0000 (20:17 +0200)
qcsrc/common/playerstats.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/vote.qc
qcsrc/server/player.qc

index c90d4577cfc138e64528fd6f87a1739d813f16e5..925c860227c6f124f20f3e964b12b73c92588487 100644 (file)
@@ -184,10 +184,10 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
        if((p.playerstats_id == "") || PS_GR_OUT_DB < 0) { return; }
 
        // add global info!
-       if(p.alivetime)
+       if(p.alivetime_start)
        {
-               PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
-               p.alivetime = 0;
+               PlayerStats_GameReport_Event_Player(p, PLAYERSTATS_ALIVETIME, max(0, time - p.alivetime_start));
+               p.alivetime_start = 0;
        }
 
        db_put(PS_GR_OUT_DB, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid));
index fe4b3e0810015f12a92f805e1ea6506f057d58ec..e89b4de32f6b2ef047710c4ebf5e5b213e0c3a7e 100644 (file)
@@ -313,11 +313,11 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
        Portal_ClearAll(this);
        SetSpectatee(this, NULL);
 
-       if (this.alivetime)
+       if (this.alivetime_start)
        {
                if (!warmup_stage)
-                       PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
-               this.alivetime = 0;
+                       PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, max(0, time - this.alivetime_start));
+               this.alivetime_start = 0;
        }
 
        if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -835,8 +835,8 @@ void PutPlayerInServer(entity this)
                W_WeaponFrame(this, weaponentity);
        }
 
-       if (!warmup_stage && !this.alivetime)
-               this.alivetime = time;
+       if (!warmup_stage && !this.alivetime_start)
+               this.alivetime_start = max(time, game_starttime);
 
        antilag_clear(this, CS(this));
 
index 6cbda43e5e128b9813597995c219d77834789f15..8e0bbf2642f06999f13e5198ba2b1d5315610c15 100644 (file)
@@ -65,7 +65,7 @@ float autocvar_sv_player_scale;
 
 .float jointime; // time of connecting
 .float startplaytime; // time of switching from spectator to player
-.float alivetime; // time of being alive
+.float alivetime_start; // start time of being alive
 .float death_time;
 .bool wasplayer;
 
index e9153e5479bc3012dd945669b9a64a9ffb7b0f07..6efa4141bd5eb7895056aeeb15dd160d2cfea972 100644 (file)
@@ -461,7 +461,7 @@ void ReadyRestart_force(bool is_fake_round_start)
 
        // clear player attributes
        FOREACH_CLIENT(IS_PLAYER(it), {
-               it.alivetime = 0;
+               it.alivetime_start = 0;
                CS(it).killcount = 0;
        });
 
index e2793e92a12597eb96011c21e16d056a3f5ee79e..a838259ce18dbadd4ddd4a6a2a3b17621826c138 100644 (file)
@@ -447,10 +447,10 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        {
                bool defer_ClientKill_Now_TeamChange = false;
 
-               if(this.alivetime)
+               if(this.alivetime_start)
                {
-                       PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
-                       this.alivetime = 0;
+                       PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, max(0, time - this.alivetime_start));
+                       this.alivetime_start = 0;
                }
 
                if(valid_damage_for_weaponstats)