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