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