]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Track hit time so that constant damage makes a noise
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index f97a4254dff37f194d242f65119cfe6f55e624b8..4b14ef3a1609e7280a1e6ee1b052494f430406d7 100644 (file)
@@ -755,6 +755,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_WEAPON_CLIPLOAD, AS_INT, clip_load);
        addstat(STAT_WEAPON_CLIPSIZE, AS_INT, clip_size);
        addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
+       addstat(STAT_HIT_TIME, AS_FLOAT, hit_time);
        addstat(STAT_DAMAGE_DEALT_TOTAL, AS_INT, damage_dealt_total);
        addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time);
        addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines);
@@ -2210,14 +2211,20 @@ void EndFrame()
                        if(self.enemy.typehitsound)
                                self.typehit_time = time;
                        else if(self.enemy.damage_dealt)
+                       {
+                               self.hit_time = time;
                                self.damage_dealt_total = ceil(self.enemy.damage_dealt);
+                       }
                }
                else
                {
                        if(self.typehitsound)
                                self.typehit_time = time;
                        else if(self.damage_dealt)
+                       {
+                               self.hit_time = time;
                                self.damage_dealt_total = ceil(self.damage_dealt);
+                       }
                }
        }
        altime = time + frametime * (1 + autocvar_g_antilag_nudge);