]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Detect if the player respawned and clear damage effects if so. Otherwise, if his...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 9 Jan 2012 15:59:36 +0000 (17:59 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 9 Jan 2012 15:59:36 +0000 (17:59 +0200)
qcsrc/client/damage.qc

index eb49470d7743135b5b638e9df7243121567842c2..a5b99979bc8705509fb241491912036efb47ef75 100644 (file)
@@ -238,7 +238,7 @@ void DamageInfo_Precache()
                (get_weaponinfo(i)).weapon_func(WR_PRECACHE);
 }
 
-.float total_damages;
+.float total_damages, owner_isdead;
 void DamageEffect_Think()
 {
        // if particle distribution is enabled, decrease ticrate by total number of damages
@@ -254,6 +254,15 @@ void DamageEffect_Think()
                remove(self);
                return;
        }
+       if(self.owner_isdead && !self.owner.csqcmodel_isdead)
+       {
+               // if the player was dead but is now alive, it means he respawned
+               // if so, clear his damage effects, or damages from his dead body will be copied over
+               self.owner.total_damages -= 1;
+               remove(self);
+               return;
+       }
+       self.owner_isdead = self.owner.csqcmodel_isdead;
        if((self.owner.entnum == player_localentnum || self.owner.entnum == spectatee_status) && !autocvar_chase_active)
                return; // if we aren't using a third person camera, hide our own effects