Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_generator.qc File Reference
#include "sv_generator.qh"
Include dependency graph for sv_generator.qc:
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)

Function Documentation

◆ generator_send()

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

Definition at line 3 of file sv_generator.qc.

4{
5 WriteHeader(MSG_ENTITY, ENT_CLIENT_GENERATOR);
7 if(sf & GSF_SETUP)
8 {
9 WriteVector(MSG_ENTITY, this.origin);
10
11 WriteByte(MSG_ENTITY, GetResource(this, RES_HEALTH));
15 }
16
17 if(sf & GSF_STATUS)
18 {
20
21 if(GetResource(this, RES_HEALTH) <= 0)
23 else
24 WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
25 }
26
27 return true;
28}
float max_health
const int GSF_SETUP
const int GSF_STATUS
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float count
Definition powerups.qc:22
int team
Definition main.qh:188
vector origin
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
float ceil(float f)
void WriteByte(float data, float dest, float desto)

References ceil(), count, entity(), GetResource(), GSF_SETUP, GSF_STATUS, max_health, MSG_ENTITY, origin, team, WriteByte(), and WriteHeader.

Referenced by ons_DelayedGeneratorSetup(), and ons_GeneratorReset().