]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use checkpvs to determine if the client we're sending to can see the player with...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 10 Apr 2011 14:32:28 +0000 (17:32 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 10 Apr 2011 14:32:28 +0000 (17:32 +0300)
qcsrc/server/g_violence.qc

index 818b641f87d53dc12003ac046373b0b2566ce503..308de2af333d20efc0759c7d3f560f3a621018a8 100644 (file)
@@ -53,6 +53,10 @@ void Violence_GibSplash(entity source, float type, float amount, entity attacker
 
 float Violence_DamageEffect_SendEntity(entity to, float sf)
 {
+       // if the client cannot see the damaged player, don't send to him and waste bandwidth
+       if not(checkpvs(to.origin + to.view_ofs, self.owner))
+               return FALSE;
+
        WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEEFFECT);
        WriteByte(MSG_ENTITY, self.cnt); // the damage weapon
        WriteByte(MSG_ENTITY, self.state); // species
@@ -71,6 +75,7 @@ void Violence_DamageEffect(entity pl, float type)
        e.classname = "damageeffect";
        e.cnt = type;
        e.state |= 8 * pl.species; // gib type, ranges from 0 to 15
+       e.owner = pl;
 
        // if this is a copied dead body, send the num of its player instead
        if(pl.classname == "body")