#include "electro.qh"
+#ifdef GAMEQC
+
+#ifdef CSQC
+
+.float ltime;
+void electro_orb_draw(entity this)
+{
+ float dt = time - this.move_time;
+ this.move_time = time;
+ if(dt <= 0)
+ return;
+
+ this.alpha = bound(0, (this.ltime - time) * 4, 1);
+ this.scale = (WEP_CVAR(WEP_ELECTRO, combo_radius) * 0.05) * this.alpha;
+ this.angles = this.angles + dt * this.avelocity;
+}
+
+void electro_orb_setup(entity e)
+{
+ setmodel(e, MDL_PROJECTILE_ELECTRO);
+ setsize(e, '-4 -4 -4', '4 4 4');
+
+ setorigin(e, e.origin);
+
+ e.draw = electro_orb_draw;
+ IL_PUSH(g_drawables, e);
+ SetResourceExplicit(e, RES_HEALTH, 255);
+ set_movetype(e, MOVETYPE_NONE);
+ e.solid = SOLID_NOT;
+ e.avelocity = '7 0 11';
+ e.drawmask = MASK_NORMAL;
+}
+#endif
+
+REGISTER_NET_LINKED(Electro_Orb)
+
+#ifdef CSQC
+NET_HANDLE(Electro_Orb, bool isNew)
+{
+ Net_Accept(Electro_Orb);
+ int sf = ReadByte();
+ if (sf & 1) {
+ this.origin = ReadVector();
+ setorigin(this, this.origin);
+ this.ltime = time + ReadByte()/10.0;
+ // this.ltime = time + this.orb_lifetime;
+ electro_orb_setup(this);
+ }
+ return true;
+}
+#endif
+
+#ifdef SVQC
+bool electro_orb_send(entity this, entity to, int sf)
+{
+ int channel = MSG_ENTITY;
+ WriteHeader(channel, Electro_Orb);
+ WriteByte(channel, sf);
+ if (sf & 1) {
+ WriteVector(channel, this.origin);
+
+ // round time delta to a 1/10th of a second
+ WriteByte(channel, (this.ltime - time)*10.0+0.5);
+ }
+ return true;
+}
+#endif
+
+#endif
+
#ifdef SVQC
#include <common/effects/qc/_mod.qh>
newproj.ltime = time + WEP_CVAR(WEP_ELECTRO, combo_duration);
set_movetype(newproj, MOVETYPE_NONE);
+ Net_LinkEntity(newproj, true, 0, electro_orb_send);
+ newproj.SendFlags |= 1;
+
// fire the first damage tick immediately
getthink(newproj)(newproj);
}