Xonotic
sv_generator.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Variables

const vector GENERATOR_MAX = '52 52 75'
 
const vector GENERATOR_MIN = '-52 -52 -14'
 
const int GSF_SETUP = 8
 
const int GSF_STATUS = 4
 

Function Documentation

◆ generator_send()

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

Definition at line 3 of file sv_generator.qc.

References ceil(), count, GetResource(), GSF_SETUP, GSF_STATUS, max_health, origin, RES_HEALTH, team, and WriteByte().

Referenced by ons_DelayedGeneratorSetup(), and ons_GeneratorReset().

4 {
5  WriteHeader(MSG_ENTITY, ENT_CLIENT_GENERATOR);
6  WriteByte(MSG_ENTITY, sf);
7  if(sf & GSF_SETUP)
8  {
9  WriteVector(MSG_ENTITY, this.origin);
10 
11  WriteByte(MSG_ENTITY, GetResource(this, RES_HEALTH));
12  WriteByte(MSG_ENTITY, this.max_health);
13  WriteByte(MSG_ENTITY, this.count);
14  WriteByte(MSG_ENTITY, this.team);
15  }
16 
17  if(sf & GSF_STATUS)
18  {
19  WriteByte(MSG_ENTITY, this.team);
20 
21  if(GetResource(this, RES_HEALTH) <= 0)
22  WriteByte(MSG_ENTITY, 0);
23  else
24  WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
25  }
26 
27  return true;
28 }
int team
Definition: main.qh:157
origin
Definition: ent_cs.qc:114
RES_HEALTH
Definition: ent_cs.qc:126
const int GSF_SETUP
Definition: cl_generator.qh:7
float max_health
const int GSF_STATUS
Definition: cl_generator.qh:6
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:

Variable Documentation

◆ GENERATOR_MAX

const vector GENERATOR_MAX = '52 52 75'

Definition at line 4 of file sv_generator.qh.

◆ GENERATOR_MIN

const vector GENERATOR_MIN = '-52 -52 -14'

Definition at line 3 of file sv_generator.qh.

◆ GSF_SETUP

const int GSF_SETUP = 8

Definition at line 7 of file sv_generator.qh.

◆ GSF_STATUS

const int GSF_STATUS = 4

Definition at line 6 of file sv_generator.qh.