- 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);
- WriteCoord(MSG_ALL, org.x);
- WriteCoord(MSG_ALL, org.y);
- WriteCoord(MSG_ALL, org.z);
- 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);
+ vector org = casingowner.(weaponentity).spawnorigin;
+ org = casingowner.origin + casingowner.view_ofs + org.x * v_forward - org.y * v_right + org.z * v_up;
+
+ FOREACH_CLIENT(true, {
+ if (!(CS_CVAR(it).cvar_cl_casings))
+ continue;
+ if (it == casingowner && !(CS_CVAR(it).cvar_r_drawviewmodel))
+ 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);
+ });