9 void orb_draw(entity this)
11 float dt = time - this.move_time;
12 this.move_time = time;
16 this.alpha = (this.ltime - time) / this.orb_lifetime;
17 this.scale = min((1 - this.alpha)*this.orb_lifetime*4,1)*this.orb_radius;
18 this.angles = this.angles + dt * this.avelocity;
21 void orb_setup(entity e)
23 setmodel(e, MDL_NADE_ORB);
26 setorigin(e, e.origin);
28 float model_radius = e.maxs.x;
29 vector size = '1 1 1' * e.orb_radius / 2;
30 setsize(e,-size,size);
31 e.orb_radius = e.orb_radius/model_radius*0.6;
34 IL_PUSH(g_drawables, e);
36 set_movetype(e, MOVETYPE_NONE);
38 e.drawmask = MASK_NORMAL;
40 e.avelocity = '7 0 11';
41 e.renderflags |= RF_ADDITIVE;
45 REGISTER_NET_LINKED(Nade_Orb)
48 NET_HANDLE(Nade_Orb, bool isNew)
53 this.origin_x = ReadCoord();
54 this.origin_y = ReadCoord();
55 this.origin_z = ReadCoord();
56 setorigin(this, this.origin);
57 this.colormod_x = ReadCoord();
58 this.colormod_y = ReadCoord();
59 this.colormod_z = ReadCoord();
60 this.orb_lifetime = ReadByte();
61 this.orb_radius = ReadShort();
62 this.ltime = time + ReadByte()/10.0;
63 // this.ltime = time + this.orb_lifetime;
71 bool orb_send(entity this, entity to, int sf)
73 int channel = MSG_ENTITY;
74 WriteHeader(channel, Nade_Orb);
75 WriteByte(channel, sf);
77 WriteCoord(channel, this.origin.x);
78 WriteCoord(channel, this.origin.y);
79 WriteCoord(channel, this.origin.z);
81 WriteCoord(channel, this.colormod.x);
82 WriteCoord(channel, this.colormod.y);
83 WriteCoord(channel, this.colormod.z);
85 WriteByte(channel, this.orb_lifetime);
86 //WriteByte(MSG_ENTITY, this.ltime - time + 1);
87 WriteShort(channel, this.orb_radius);
88 // round time delta to a 1/10th of a second
89 WriteByte(channel, (this.ltime - time)*10.0+0.5);