if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
{
// time is up or the player got gibbed / disconnected
- self.owner.total_damages -= 1;
+ self.owner.total_damages = max(0, self.owner.total_damages - 1);
remove(self);
return;
}
{
// 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 back
- self.owner.total_damages -= 1;
+ self.owner.total_damages = max(0, self.owner.total_damages - 1);
remove(self);
return;
}
self.state = self.owner.csqcmodel_isdead;
+#ifdef COMPAT_XON050_ENGINE
if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum || self.owner.entnum == spectatee_status) && !autocvar_chase_active)
+#else
+ if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+#endif
return; // if we aren't using a third person camera, hide our own effects
// now generate the particles
gettaginfo(self, nearestbone); // set gettaginfo_name
// return if we reached our damage effect limit or damages are disabled
+ // TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
if(nearestbone)
{
if(self.total_damages >= autocvar_cl_damageeffect_bones)
void Ent_DamageInfo(float isNew)
{
- float dmg, rad, edge, thisdmg, forcemul, species;
+ float dmg, rad, edge, thisdmg, forcemul, species, hitplayer;
vector force, thisforce;
entity oldself;
for(self = findradius(w_org, rad + MAX_DAMAGEEXTRARADIUS); self; self = self.chain)
{
+ // attached ents suck
+ if(self.tag_entity)
+ continue;
+
vector nearest = NearestPointOnBox(self, w_org);
if(rad)
{
self.event_damage(thisdmg, w_deathtype, w_org, thisforce);
DamageEffect(w_org, thisdmg, w_deathtype, species);
+
+ if(self.isplayermodel)
+ hitplayer = TRUE; // this impact damaged a player
}
self = oldself;
// TODO spawn particle effects and sounds based on w_deathtype
if(!DEATH_ISSPECIAL(w_deathtype))
+ if not(hitplayer && !rad) // don't show ground impacts for hitscan weapons if a player was hit
{
float hitwep;