9 void orb_draw(entity this)
11 float dt = time - this.move_time;
12 this.move_time = time;
17 this.alpha = (this.ltime - time) / this.orb_lifetime;
18 this.scale = min((1 - this.alpha) * this.orb_lifetime * 4, 1) * this.orb_radius;
19 this.angles = this.angles + dt * this.avelocity;
22 void orb_setup(entity e)
24 setmodel(e, MDL_NADE_ORB);
27 setorigin(e, e.origin);
29 float model_radius = e.maxs.x;
30 vector size = '1 1 1' * e.orb_radius / 2;
31 setsize(e, -size, size);
32 e.orb_radius = e.orb_radius / model_radius * 0.6;
35 IL_PUSH(g_drawables, e);
37 set_movetype(e, MOVETYPE_NONE);
39 e.drawmask = MASK_NORMAL;
41 e.avelocity = '7 0 11';
42 e.renderflags |= RF_ADDITIVE;
46 REGISTER_NET_LINKED(Nade_Orb)
49 NET_HANDLE(Nade_Orb, bool isNew)
54 this.origin_x = ReadCoord();
55 this.origin_y = ReadCoord();
56 this.origin_z = ReadCoord();
57 setorigin(this, this.origin);
58 this.colormod_x = ReadCoord();
59 this.colormod_y = ReadCoord();
60 this.colormod_z = ReadCoord();
61 this.orb_lifetime = ReadByte();
62 this.orb_radius = ReadShort();
63 this.ltime = time + ReadByte() / 10.0;
64 // this.ltime = time + this.orb_lifetime;
72 bool orb_send(entity this, entity to, int sf)
74 int channel = MSG_ENTITY;
75 WriteHeader(channel, Nade_Orb);
76 WriteByte(channel, sf);
78 WriteCoord(channel, this.origin.x);
79 WriteCoord(channel, this.origin.y);
80 WriteCoord(channel, this.origin.z);
82 WriteCoord(channel, this.colormod.x);
83 WriteCoord(channel, this.colormod.y);
84 WriteCoord(channel, this.colormod.z);
86 WriteByte(channel, this.orb_lifetime);
87 // WriteByte(MSG_ENTITY, this.ltime - time + 1);
88 WriteShort(channel, this.orb_radius);
89 // round time delta to a 1/10th of a second
90 WriteByte(channel, (this.ltime - time) * 10.0 + 0.5);