From: Mircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Mon, 9 Jan 2012 15:59:36 +0000 (+0200)
Subject: Detect if the player respawned and clear damage effects if so. Otherwise, if his... 
X-Git-Tag: xonotic-v0.6.0~110^2^2~39
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0e57ff15091479cc9b7b83bade2d1f0bcbb36c81;p=xonotic%2Fxonotic-data.pk3dir.git

Detect if the player respawned and clear damage effects if so. Otherwise, if his dead body isn't gibbed, effects would be copied back once he respawns.
---

diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc
index eb49470d77..a5b99979bc 100644
--- a/qcsrc/client/damage.qc
+++ b/qcsrc/client/damage.qc
@@ -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