]> de.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 float cpicon_send(entity to, float sf)
2 {
3         WriteByte(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
4         WriteByte(MSG_ENTITY, sf);
5         if(sf & CPSF_SETUP)
6         {
7                 WriteCoord(MSG_ENTITY, self.origin_x);
8                 WriteCoord(MSG_ENTITY, self.origin_y);
9                 WriteCoord(MSG_ENTITY, self.origin_z);
10
11                 WriteByte(MSG_ENTITY, self.health);
12                 WriteByte(MSG_ENTITY, self.max_health);
13                 WriteByte(MSG_ENTITY, self.count);
14                 WriteByte(MSG_ENTITY, self.team);
15                 WriteByte(MSG_ENTITY, self.owner.iscaptured);
16         }
17
18         if(sf & CPSF_STATUS)
19         {
20                 WriteByte(MSG_ENTITY, self.team);
21
22                 if(self.health <= 0)
23                         WriteByte(MSG_ENTITY, 0);
24                 else
25                         WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
26         }
27
28         return TRUE;
29 }
30
31 void onslaught_controlpoint_icon_link(entity e, void() spawnproc)
32 {
33         Net_LinkEntity(e, TRUE, 0, cpicon_send);
34         e.think         = spawnproc;
35         e.nextthink     = time * sys_frametime;
36 }