]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/damage.qc
Full support for 3 and 4 teams in CA and Freezetag
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / damage.qc
index e1c5c888acd889b6bf3b997e1b5f59863ab3ee80..ae83d45eea011d890b8b3fd0430866d2b17312ca 100644 (file)
@@ -22,7 +22,11 @@ void DamageEffect_Think()
                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
@@ -63,6 +67,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
        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)
@@ -108,7 +113,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
 
 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;
 
@@ -141,6 +146,10 @@ void Ent_DamageInfo(float isNew)
        
        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)
                {
@@ -183,6 +192,9 @@ void Ent_DamageInfo(float isNew)
                        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;
@@ -217,7 +229,7 @@ void Ent_DamageInfo(float isNew)
                                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);
@@ -255,6 +267,10 @@ void Ent_DamageInfo(float isNew)
                                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;
                }
        }
        
@@ -320,6 +336,7 @@ void Ent_DamageInfo(float isNew)
        
        // 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;