2 void Read_Effect(bool is_new)
4 #if EFFECTS_COUNT >= 255
5 int net_name = ReadShort();
7 int net_name = ReadByte();
10 entity eff = effects_ent[net_name];
12 vector v, vel = '0 0 0';
14 bool eff_trail = eff.eent_eff_trail;
19 bool use_vel = ReadByte();
33 WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel);
35 pointparticles(particleeffectnum(eff), v, vel, eff_cnt);
41 bool Net_Write_Effect(entity client, int sf)
43 WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT);
44 #if EFFECTS_COUNT >= 255
45 WriteShort(MSG_ENTITY, self.m_id);
47 WriteByte(MSG_ENTITY, self.m_id);
49 WriteCoord(MSG_ENTITY, self.eent_net_location_x);
50 WriteCoord(MSG_ENTITY, self.eent_net_location_y);
51 WriteCoord(MSG_ENTITY, self.eent_net_location_z);
53 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
54 if(self.eent_net_velocity)
56 WriteByte(MSG_ENTITY, true);
57 WriteCoord(MSG_ENTITY, self.eent_net_velocity_x);
58 WriteCoord(MSG_ENTITY, self.eent_net_velocity_y);
59 WriteCoord(MSG_ENTITY, self.eent_net_velocity_z);
61 else { WriteByte(MSG_ENTITY, false); }
63 if(!self.eent_eff_trail) { WriteByte(MSG_ENTITY, self.eent_net_count); }
67 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
70 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
71 entity net_eff = spawn();
73 net_eff.classname = "net_effect";
74 //net_eff.eent_broadcast = broadcast;
75 net_eff.m_id = eff.m_id;
76 net_eff.eent_net_velocity = eff_vel;
77 net_eff.eent_net_location = eff_loc;
78 net_eff.eent_net_count = eff_cnt;
79 net_eff.eent_eff_trail = eff.eent_eff_trail;
81 net_eff.think = SUB_Remove;
82 net_eff.nextthink = time + 0.2; // don't need to keep this long
84 Net_LinkEntity(net_eff, false, 0, Net_Write_Effect);
87 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
89 // problem with this is, we might not have all the available effects for it
90 FOREACH(effects_ent, it.eent_eff_name == eff_name, LAMBDA(
91 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
94 // revert to engine handling
95 pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);