Xonotic
handicap.qc
Go to the documentation of this file.
1 #include "handicap.qh"
2 
7 
8 #include <common/state.qh>
9 #include <server/client.qh>
10 
11 .float m_handicap;
12 
14 {
15  CS(player).m_handicap = 1;
16 }
17 
19 {
20  return bound(1.0, CS_CVAR(player).cvar_cl_handicap, 10.0);
21 }
22 
24 {
25  return (CS(player)) ? CS(player).m_handicap : 1;
26 }
27 
28 void Handicap_SetForcedHandicap(entity player, float value)
29 {
30  if (value <= 0)
31  {
32  error("Handicap_SetForcedHandicap: Invalid handicap value.");
33  }
34  CS(player).m_handicap = value;
35 }
36 
38 {
40  player);
41 }
Header file that describes the handicap system.
entity() spawn
ClientState CS(Client this)
Definition: state.qh:47
#define CS_CVAR(this)
Definition: state.qh:51
float m_handicap
Holds the handicap value.
Definition: handicap.qc:11
float Handicap_GetTotalHandicap(entity player)
Returns the total handicap of the player.
Definition: handicap.qc:37
float Handicap_GetVoluntaryHandicap(entity player)
Returns the voluntary handicap of the player.
Definition: handicap.qc:18
void Handicap_Initialize(entity player)
Initializes handicap to its default value.
Definition: handicap.qc:13
void Handicap_SetForcedHandicap(entity player, float value)
Sets the forced handicap of the player.
Definition: handicap.qc:28
float Handicap_GetForcedHandicap(entity player)
Returns the forced handicap of the player.
Definition: handicap.qc:23