]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Second part of my latest change. When a body is gibbed, the damage effect will apply...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Apr 2011 16:53:32 +0000 (19:53 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Apr 2011 16:53:32 +0000 (19:53 +0300)
qcsrc/client/gibs.qc

index 76f6aaa5e54f4f2f693ab17842e8a11b6b9cf5ee..65c6468aad5acc422322f4c245a2b930c0bb2294 100644 (file)
@@ -315,5 +315,21 @@ void Ent_DamageEffect()
                effectnum = substring(effectnum, 0, strlen(effectnum) - 1); // remove the _ symbol at the end of the species name
        }
 
-       pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+       entity head;
+       float foundgib;
+
+       // Scan the owner of all gibs in the world. If a gib owner is the same as the player we're applying the
+       // effect to, it means our player is gibbed. Therefore, apply the particles to the gibs instead.
+       for(head = world; (head = find(head, classname, "gib")); )
+       {
+               if(head.team == entnumber)
+               {
+                       pointparticles(particleeffectnum(effectnum), head.origin, '0 0 0', 1);
+                       foundgib = TRUE;
+               }
+       }
+
+       // If our player isn't gibbed, apply the effect to him instead.
+       if(!foundgib)
+               pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
 }