Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_controlpoint.qc
Go to the documentation of this file.
1#include "sv_controlpoint.qh"
2
4
5bool cpicon_send(entity this, entity to, int sf)
6{
7 WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
8 if(sf & CPSF_SETUP)
9 sf &= ~CPSF_STATUS;
11 if(sf & CPSF_SETUP)
12 {
13 WriteVector(MSG_ENTITY, this.origin);
14
15 WriteByte(MSG_ENTITY, GetResource(this, RES_HEALTH));
19 WriteByte(MSG_ENTITY, this.owner.iscaptured);
20 }
21
22 if(sf & CPSF_STATUS)
23 {
25
26 if(GetResource(this, RES_HEALTH) <= 0)
28 else
29 WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
30 }
31
32 return true;
33}
34
35void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc)
36{
37 Net_LinkEntity(e, true, 0, cpicon_send);
38 setthink(e, spawnproc);
39 e.nextthink = time + sys_frametime;
40}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float max_health
bool iscaptured
const int CPSF_SETUP
const int CPSF_STATUS
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float count
Definition powerups.qc:22
entity owner
Definition main.qh:87
int team
Definition main.qh:188
float time
vector origin
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
float ceil(float f)
void WriteByte(float data, float dest, float desto)
#define setthink(e, f)
float sys_frametime
Definition common.qh:57
bool cpicon_send(entity this, entity to, int sf)
void onslaught_controlpoint_icon_link(entity e, void(entity this) spawnproc)