2 void Read_Effect(bool is_new)
4 int net_name = (EFFECT_COUNT >= 255) ? ReadShort() : ReadByte();
6 entity eff = effects_ent[net_name];
8 vector v, vel = '0 0 0';
10 bool eff_trail = eff.eent_eff_trail;
15 bool use_vel = ReadByte();
29 WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel);
31 pointparticles(particleeffectnum(eff), v, vel, eff_cnt);
37 bool Net_Write_Effect(entity client, int sf)
39 WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT);
41 ? WriteShort(MSG_ENTITY, self.m_id)
42 : WriteByte(MSG_ENTITY, self.m_id);
43 WriteCoord(MSG_ENTITY, self.eent_net_location_x);
44 WriteCoord(MSG_ENTITY, self.eent_net_location_y);
45 WriteCoord(MSG_ENTITY, self.eent_net_location_z);
47 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
48 if(self.eent_net_velocity)
50 WriteByte(MSG_ENTITY, true);
51 WriteCoord(MSG_ENTITY, self.eent_net_velocity_x);
52 WriteCoord(MSG_ENTITY, self.eent_net_velocity_y);
53 WriteCoord(MSG_ENTITY, self.eent_net_velocity_z);
55 else { WriteByte(MSG_ENTITY, false); }
57 if(!self.eent_eff_trail) { WriteByte(MSG_ENTITY, self.eent_net_count); }
61 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
64 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
65 entity net_eff = spawn();
67 net_eff.classname = "net_effect";
68 //net_eff.eent_broadcast = broadcast;
69 net_eff.m_id = eff.m_id;
70 net_eff.eent_net_velocity = eff_vel;
71 net_eff.eent_net_location = eff_loc;
72 net_eff.eent_net_count = eff_cnt;
73 net_eff.eent_eff_trail = eff.eent_eff_trail;
75 net_eff.think = SUB_Remove;
76 net_eff.nextthink = time + 0.2; // don't need to keep this long
78 Net_LinkEntity(net_eff, false, 0, Net_Write_Effect);
81 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
83 // problem with this is, we might not have all the available effects for it
84 FOREACH(effects_ent, it.eent_eff_name == eff_name, LAMBDA(
85 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
88 // revert to engine handling
89 pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);