From: terencehill Date: Sat, 12 Oct 2019 21:16:03 +0000 (+0200) Subject: Make so that cl_casings enables/disables casings for all players rather than only... X-Git-Tag: xonotic-v0.8.5~1167^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2228c2a0b6b9c5b4978e91885c6b2eb768c3d009;p=xonotic%2Fxonotic-data.pk3dir.git Make so that cl_casings enables/disables casings for all players rather than only for the player himself (but visible to other players) --- diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 589e343c8..515d90323 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -19,22 +19,25 @@ REPLICATE(cvar_cl_casings, bool, "cl_casings"); #ifdef SVQC void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner, .entity weaponentity) { - if (!(CS(casingowner).cvar_cl_casings)) - return; - - entity wep = casingowner.(weaponentity); - vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up; - - if (!sound_allowed(MSG_BROADCAST, casingowner)) - casingtype |= 0x80; - - WriteHeader(MSG_ALL, casings); - WriteByte(MSG_ALL, casingtype); - WriteVector(MSG_ALL, org); - WriteShort(MSG_ALL, compressShortVector(vel)); // actually compressed velocity - WriteByte(MSG_ALL, ang.x * 256 / 360); - WriteByte(MSG_ALL, ang.y * 256 / 360); - WriteByte(MSG_ALL, ang.z * 256 / 360); + entity wep = casingowner.(weaponentity); + vector org = casingowner.origin + casingowner.view_ofs + wep.spawnorigin.x * v_forward - wep.spawnorigin.y * v_right + wep.spawnorigin.z * v_up; + + FOREACH_CLIENT(true, { + if (!(CS(it).cvar_cl_casings)) + continue; + + msg_entity = it; + if (!sound_allowed(MSG_ONE, it)) + casingtype |= 0x80; // silent + + WriteHeader(MSG_ONE, casings); + WriteByte(MSG_ONE, casingtype); + WriteVector(MSG_ONE, org); + WriteShort(MSG_ONE, compressShortVector(vel)); // actually compressed velocity + WriteByte(MSG_ONE, ang.x * 256 / 360); + WriteByte(MSG_ONE, ang.y * 256 / 360); + WriteByte(MSG_ONE, ang.z * 256 / 360); + }); } #endif