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