]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/nades.qc
Merge branch 'master' into mirceakitsune/player_cubemaps
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / nades.qc
1 .float healer_lifetime;
2 .float healer_radius;
3
4 #ifdef SVQC
5 float healer_send(entity to, float sf)
6 {
7         WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB);
8         WriteByte(MSG_ENTITY, sf);
9
10         if(sf & 1)
11         {
12                 WriteCoord(MSG_ENTITY, self.origin_x);
13                 WriteCoord(MSG_ENTITY, self.origin_y);
14                 WriteCoord(MSG_ENTITY, self.origin_z);
15
16                 WriteByte(MSG_ENTITY, self.healer_lifetime);
17                 //WriteByte(MSG_ENTITY, self.ltime - time + 1);
18                 WriteShort(MSG_ENTITY, self.healer_radius);
19                 // round time delta to a 1/10th of a second
20                 WriteByte(MSG_ENTITY, (self.ltime - time)*10.0+0.5);
21         }
22
23         return TRUE;
24 }
25 #endif // SVQC
26
27 #ifdef CSQC
28 .float ltime;
29 void healer_draw()
30 {
31         float dt = time - self.move_time;
32         self.move_time = time;
33         if(dt <= 0)
34                 return;
35
36         self.alpha = (self.ltime - time) / self.healer_lifetime;
37         self.scale = min((1 - self.alpha)*self.healer_lifetime*4,1)*self.healer_radius;
38
39 }
40
41 void healer_setup()
42 {
43         setmodel(self, "models/ctf/shield.md3");
44
45         setorigin(self, self.origin);
46         
47         float model_radius = self.maxs_x;
48         vector size = '1 1 1' * self.healer_radius / 2;
49         setsize(self,-size,size);
50         self.healer_radius = self.healer_radius/model_radius*0.6;
51
52         self.draw = healer_draw;
53         self.health = 255;
54         self.movetype = MOVETYPE_NONE;
55         self.solid = SOLID_NOT;
56         self.drawmask = MASK_NORMAL;
57         self.scale = 0.01;
58         self.avelocity = self.move_avelocity = '7 0 11';
59         self.colormod = '1 0 0';
60         self.renderflags |= RF_ADDITIVE;
61 }
62
63 void ent_healer()
64 {
65         float sf = ReadByte();
66
67         if(sf & TNSF_SETUP)
68         {
69                 self.origin_x = ReadCoord();
70                 self.origin_y = ReadCoord();
71                 self.origin_z = ReadCoord();
72                 setorigin(self, self.origin);
73
74                 self.healer_lifetime = ReadByte();
75                 self.healer_radius = ReadShort();
76                 self.ltime = time + ReadByte()/10.0;
77                 //self.ltime = time + self.healer_lifetime;
78
79                 healer_setup();
80         }
81 }
82 #endif // CSQC