3 REGISTER_NET_TEMP(net_effect)
5 NET_HANDLE(net_effect, bool isNew)
7 int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte();
9 entity eff = Effects_from(net_name);
13 bool eff_trail = eff.eent_eff_trail;
19 bool use_vel = ReadByte();
31 WarpZone_TrailParticles(NULL, particleeffectnum(eff), v, vel);
33 pointparticles(eff, v, vel, eff_cnt);
39 bool Net_Write_Effect(entity this, entity client, int sf)
41 int channel = MSG_ONE;
43 WriteHeader(channel, net_effect);
44 (Effects_COUNT >= 255)
45 ? WriteShort(channel, this.m_id)
46 : WriteByte(channel, this.m_id);
47 WriteCoord(channel, this.eent_net_location_x);
48 WriteCoord(channel, this.eent_net_location_y);
49 WriteCoord(channel, this.eent_net_location_z);
51 // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set
52 if(this.eent_net_velocity)
54 WriteByte(channel, true);
55 WriteCoord(channel, this.eent_net_velocity_x);
56 WriteCoord(channel, this.eent_net_velocity_y);
57 WriteCoord(channel, this.eent_net_velocity_z);
59 else { WriteByte(channel, false); }
61 if(!this.eent_eff_trail) { WriteByte(channel, this.eent_net_count); }
65 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
68 if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
69 entity net_eff = new_pure(net_effect);
71 //net_eff.eent_broadcast = broadcast;
72 net_eff.m_id = eff.m_id;
73 net_eff.eent_net_velocity = eff_vel;
74 net_eff.eent_net_location = eff_loc;
75 net_eff.eent_net_count = eff_cnt;
76 net_eff.eent_eff_trail = eff.eent_eff_trail;
78 FOREACH_CLIENT(IS_REAL_CLIENT(it), Net_Write_Effect(net_eff, it, 0));
82 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
84 // problem with this is, we might not have all the available effects for it
85 FOREACH(Effects, it.eent_eff_name == eff_name, {
86 Send_Effect(it, eff_loc, eff_vel, eff_cnt);
89 // revert to engine handling
90 __pointparticles(_particleeffectnum(eff_name), eff_loc, eff_vel, eff_cnt);
94 #include "effectinfo.qc"