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;
}
{
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
- float life, nearestbone;
+ float life, nearestbone = 0;
string specstr, effectname;
entity e;
continue; // player model bone blacklist
// now choose the bone closest to impact origin
- if(vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone)))
+ if(nearestbone == 0 || vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone)))
nearestbone = tagnum;
}
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 = FALSE;
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;
sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTN_MIN);
pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
break;
-
+
case DEATH_WAKIGUN:
sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM);
pointparticles(particleeffectnum("wakizashi_gun_impact"), self.origin, w_backoff * 1000, 1);
sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_MIN);
pointparticles(particleeffectnum("explosion_big"), self.origin, w_backoff * 1000, 1);
break;
+ case DEATH_BUMB_GUN:
+ sound(self, CH_SHOTS, "weapons/fireball_impact2.wav", VOL_BASE, ATTN_NORM);
+ pointparticles(particleeffectnum("bigplasma_impact"), self.origin, w_backoff * 1000, 1);
+ break;
}
}
// 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;