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