]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc
Merge branch 'master' into Mario/bulldozer
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / onslaught / sv_controlpoint.qc
1 #include "sv_controlpoint.qh"
2
3 .bool iscaptured;
4
5 bool cpicon_send(entity this, entity to, int sf)
6 {
7         WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
8         WriteByte(MSG_ENTITY, sf);
9         if(sf & CPSF_SETUP)
10         {
11                 WriteCoord(MSG_ENTITY, self.origin_x);
12                 WriteCoord(MSG_ENTITY, self.origin_y);
13                 WriteCoord(MSG_ENTITY, self.origin_z);
14
15                 WriteByte(MSG_ENTITY, self.health);
16                 WriteByte(MSG_ENTITY, self.max_health);
17                 WriteByte(MSG_ENTITY, self.count);
18                 WriteByte(MSG_ENTITY, self.team);
19                 WriteByte(MSG_ENTITY, self.owner.iscaptured);
20         }
21
22         if(sf & CPSF_STATUS)
23         {
24                 WriteByte(MSG_ENTITY, self.team);
25
26                 if(self.health <= 0)
27                         WriteByte(MSG_ENTITY, 0);
28                 else
29                         WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
30         }
31
32         return true;
33 }
34
35 void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
36 {
37         Net_LinkEntity(e, true, 0, cpicon_send);
38         e.think         = spawnproc;
39         e.nextthink     = time * sys_frametime;
40 }