Xonotic
sv_controlpoint.qc File Reference
#include "sv_controlpoint.qh"
+ Include dependency graph for sv_controlpoint.qc:

Go to the source code of this file.

Functions

bool cpicon_send (entity this, entity to, int sf)
 
void onslaught_controlpoint_icon_link (entity e, void(entity this) spawnproc)
 

Variables

bool iscaptured
 

Function Documentation

◆ cpicon_send()

bool cpicon_send ( entity  this,
entity  to,
int  sf 
)

Definition at line 5 of file sv_controlpoint.qc.

References ceil(), count, CPSF_SETUP, CPSF_STATUS, GetResource(), max_health, origin, owner, RES_HEALTH, team, and WriteByte().

Referenced by onslaught_controlpoint_icon_link().

6 {
7  WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
8  if(sf & CPSF_SETUP)
9  sf &= ~CPSF_STATUS;
10  WriteByte(MSG_ENTITY, sf);
11  if(sf & CPSF_SETUP)
12  {
13  WriteVector(MSG_ENTITY, this.origin);
14 
15  WriteByte(MSG_ENTITY, GetResource(this, RES_HEALTH));
16  WriteByte(MSG_ENTITY, this.max_health);
17  WriteByte(MSG_ENTITY, this.count);
18  WriteByte(MSG_ENTITY, this.team);
19  WriteByte(MSG_ENTITY, this.owner.iscaptured);
20  }
21 
22  if(sf & CPSF_STATUS)
23  {
24  WriteByte(MSG_ENTITY, this.team);
25 
26  if(GetResource(this, RES_HEALTH) <= 0)
27  WriteByte(MSG_ENTITY, 0);
28  else
29  WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
30  }
31 
32  return true;
33 }
int team
Definition: main.qh:157
const int CPSF_STATUS
origin
Definition: ent_cs.qc:114
entity owner
Definition: main.qh:73
RES_HEALTH
Definition: ent_cs.qc:126
float max_health
const int CPSF_SETUP
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
float count
Definition: powerups.qc:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onslaught_controlpoint_icon_link()

void onslaught_controlpoint_icon_link ( entity  e,
void(entity this spawnproc 
)

Definition at line 35 of file sv_controlpoint.qc.

References cpicon_send(), setthink, sys_frametime, and time.

Referenced by ons_ControlPoint_Icon_BuildThink(), and ons_ControlPoint_Icon_Spawn().

36 {
37  Net_LinkEntity(e, true, 0, cpicon_send);
38  setthink(e, spawnproc);
39  e.nextthink = time + sys_frametime;
40 }
float sys_frametime
Definition: common.qh:57
bool cpicon_send(entity this, entity to, int sf)
#define setthink(e, f)
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ iscaptured

bool iscaptured

Definition at line 3 of file sv_controlpoint.qc.