3 REGISTER_NET_TEMP(net_effect)
5 NET_HANDLE(net_effect, bool isNew)
7 int net_name = (REGISTRY_COUNT(Effects) >= 255) ? ReadShort() : ReadByte();
9 entity eff = REGISTRY_GET(Effects, net_name);
13 bool eff_trail = eff.eent_eff_trail;
14 vector v = ReadVector();
16 bool use_vel = ReadByte();
24 WarpZone_TrailParticles(NULL, particleeffectnum(eff), v, vel);
26 pointparticles(eff, v, vel, eff_cnt);
32 bool Net_Write_Effect(entity this, entity client, int sf)
34 int channel = MSG_ONE;
36 WriteHeader(channel, net_effect);
37 (REGISTRY_COUNT(Effects) >= 255)
38 ? WriteShort(channel, this.m_id)
39 : WriteByte(channel, this.m_id);
40 WriteVector(channel, this.eent_net_location);
42 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
43 if(this.eent_net_velocity)
45 WriteByte(channel, true);
46 WriteVector(channel, this.eent_net_velocity);
48 else { WriteByte(channel, false); }
50 if(!this.eent_eff_trail) { WriteByte(channel, this.eent_net_count); }
54 void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, entity ignore)
57 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
58 entity net_eff = new_pure(net_effect);
60 //net_eff.eent_broadcast = broadcast;
61 net_eff.m_id = eff.m_id;
62 net_eff.eent_net_velocity = eff_vel;
63 net_eff.eent_net_location = eff_loc;
64 net_eff.eent_net_count = eff_cnt;
65 net_eff.eent_eff_trail = eff.eent_eff_trail;
67 FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != ignore && !(IS_SPEC(it) && it.enemy && it.enemy == ignore), Net_Write_Effect(net_eff, it, 0));
71 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
73 Send_Effect_Except(eff, eff_loc, eff_vel, eff_cnt, NULL);
76 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
78 // problem with this is, we might not have all the available effects for it
79 FOREACH(Effects, it.eent_eff_name == eff_name, {
80 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
83 // revert to engine handling TODO: send the effect name and draw it on the client side? not as light on networking, but resolves the use of server side effects
84 __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
89 #include "effectinfo.qc"