From fb331c55abb48a47d7de04e02cfdd0af29c2653f Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sun, 10 Apr 2011 17:32:28 +0300 Subject: [PATCH] Use checkpvs to determine if the client we're sending to can see the player with the damage effects. If not, abort sending to it. Should save a lot of bandwidth compared to before. --- qcsrc/server/g_violence.qc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qcsrc/server/g_violence.qc b/qcsrc/server/g_violence.qc index 818b641f8..308de2af3 100644 --- a/qcsrc/server/g_violence.qc +++ b/qcsrc/server/g_violence.qc @@ -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") -- 2.39.2