7 void orb_draw(entity this)
9 float dt = time - this.move_time;
10 this.move_time = time;
14 this.alpha = (this.ltime - time) / this.orb_lifetime;
15 this.scale = min((1 - this.alpha)*this.orb_lifetime*4,1)*this.orb_radius;
16 this.angles = this.angles + dt * this.avelocity;
19 void orb_setup(entity e)
21 setmodel(e, MDL_NADE_ORB);
24 setorigin(e, e.origin);
26 float model_radius = e.maxs.x;
27 vector size = '1 1 1' * e.orb_radius / 2;
28 setsize(e,-size,size);
29 e.orb_radius = e.orb_radius/model_radius*0.6;
33 e.movetype = MOVETYPE_NONE;
35 e.drawmask = MASK_NORMAL;
37 e.avelocity = e.move_avelocity = '7 0 11';
38 e.renderflags |= RF_ADDITIVE;
42 REGISTER_NET_LINKED(Nade_Orb)
45 NET_HANDLE(Nade_Orb, bool isNew)
50 this.origin_x = ReadCoord();
51 this.origin_y = ReadCoord();
52 this.origin_z = ReadCoord();
53 setorigin(this, this.origin);
54 this.colormod_x = ReadCoord();
55 this.colormod_y = ReadCoord();
56 this.colormod_z = ReadCoord();
57 this.orb_lifetime = ReadByte();
58 this.orb_radius = ReadShort();
59 this.ltime = time + ReadByte()/10.0;
60 // this.ltime = time + this.orb_lifetime;
68 bool orb_send(entity this, entity to, int sf)
70 int channel = MSG_ENTITY;
71 WriteHeader(channel, Nade_Orb);
72 WriteByte(channel, sf);
74 WriteCoord(channel, this.origin.x);
75 WriteCoord(channel, this.origin.y);
76 WriteCoord(channel, this.origin.z);
78 WriteCoord(channel, this.colormod.x);
79 WriteCoord(channel, this.colormod.y);
80 WriteCoord(channel, this.colormod.z);
82 WriteByte(channel, this.orb_lifetime);
83 //WriteByte(MSG_ENTITY, this.ltime - time + 1);
84 WriteShort(channel, this.orb_radius);
85 // round time delta to a 1/10th of a second
86 WriteByte(channel, (this.ltime - time)*10.0+0.5);