Xonotic
sv_freezetag.qc File Reference
+ Include dependency graph for sv_freezetag.qc:

Go to the source code of this file.

Macros

#define IN_REVIVING_RANGE(player, it, revive_extra_size)
 

Functions

void freezetag_Add_Score (entity targ, entity attacker)
 
bool freezetag_CheckTeams ()
 
bool freezetag_CheckWinner ()
 
void freezetag_count_alive_players ()
 
void freezetag_Freeze (entity targ, entity attacker)
 
void freezetag_Initialize ()
 
bool freezetag_isEliminated (entity e)
 
entity freezetag_LastPlayerForTeam (entity this)
 
void freezetag_LastPlayerForTeam_Notify (entity this)
 
void ft_RemovePlayer (entity this)
 
void havocbot_goalrating_ft_freeplayers (entity this, float ratingscale, vector org, float sradius)
 
void havocbot_role_ft_freeing (entity this)
 
void havocbot_role_ft_offense (entity this)
 
 MUTATOR_HOOKFUNCTION (ft, ClientDisconnect)
 
 MUTATOR_HOOKFUNCTION (ft, MakePlayerObserver)
 
 MUTATOR_HOOKFUNCTION (ft, PlayerDies)
 
 MUTATOR_HOOKFUNCTION (ft, PlayerSpawn)
 
 MUTATOR_HOOKFUNCTION (ft, reset_map_players)
 
 MUTATOR_HOOKFUNCTION (ft, GiveFragsForKill, CBC_ORDER_FIRST)
 
 MUTATOR_HOOKFUNCTION (ft, Unfreeze)
 
 MUTATOR_HOOKFUNCTION (ft, Damage_Calculate)
 
 MUTATOR_HOOKFUNCTION (ft, PlayerPreThink, CBC_ORDER_FIRST)
 
 MUTATOR_HOOKFUNCTION (ft, SetStartItems)
 
 MUTATOR_HOOKFUNCTION (ft, HavocBot_ChooseRole)
 
 MUTATOR_HOOKFUNCTION (ft, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
 
 MUTATOR_HOOKFUNCTION (ft, SetWeaponArena)
 
 MUTATOR_HOOKFUNCTION (ft, FragCenterMessage)
 
 MUTATOR_HOOKFUNCTION (ft, SV_ParseServerCommand)
 
 MUTATOR_HOOKFUNCTION (ft, Scores_CountFragsRemaining)
 
void nades_Clear (entity)
 
void nades_GiveBonus (entity player, float score)
 
 void (entity this) havocbot_role_ft_freeing
 

Variables

float autocvar_g_freezetag_frozen_maxtime
 
float autocvar_g_freezetag_revive_clearspeed
 
float autocvar_g_freezetag_round_timelimit
 
int autocvar_g_freezetag_teams_override
 
float autocvar_g_freezetag_warmup
 
float autocvar_g_ft_start_ammo_cells = 180
 
float autocvar_g_ft_start_ammo_fuel = 0
 
float autocvar_g_ft_start_ammo_nails = 320
 
float autocvar_g_ft_start_ammo_plasma = 180
 
float autocvar_g_ft_start_ammo_rockets = 160
 
float autocvar_g_ft_start_ammo_shells = 60
 
float autocvar_g_ft_start_armor = 100
 
float autocvar_g_ft_start_health = 100
 

Macro Definition Documentation

◆ IN_REVIVING_RANGE

#define IN_REVIVING_RANGE (   player,
  it,
  revive_extra_size 
)
Value:
(it != player && !IS_DEAD(it) && SAME_TEAM(it, player) \
&& boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
Definition: vector.qh:73
#define SAME_TEAM(a, b)
Definition: teams.qh:239
#define IS_DEAD(s)
Definition: utils.qh:26

Definition at line 499 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

Function Documentation

◆ freezetag_Add_Score()

void freezetag_Add_Score ( entity  targ,
entity  attacker 
)

Definition at line 158 of file sv_freezetag.qc.

References GameRules_scoring_add, and IS_PLAYER.

Referenced by freezetag_Freeze(), and MUTATOR_HOOKFUNCTION().

159 {
160  if(attacker == targ)
161  {
162  // you froze your own dumb self
163  // counted as "suicide" already
164  GameRules_scoring_add(targ, SCORE, -1);
165  }
166  else if(IS_PLAYER(attacker))
167  {
168  // got frozen by an enemy
169  // counted as "kill" and "death" already
170  GameRules_scoring_add(targ, SCORE, -1);
171  GameRules_scoring_add(attacker, SCORE, +1);
172  }
173  // else nothing - got frozen by the game type rules themselves
174 }
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the caller graph for this function:

◆ freezetag_CheckTeams()

bool freezetag_CheckTeams ( )

Definition at line 52 of file sv_freezetag.qc.

References entity(), freezetag_teams, nades_Clear(), nades_GiveBonus(), NULL, NUM_TEAMS, NumTeams(), Team_GetNumberOfAlivePlayers(), Team_GetNumberOfAliveTeams(), Team_GetTeamFromIndex(), Team_IndexToBit(), and total_players.

Referenced by freezetag_Initialize().

53 {
54  static float prev_missing_teams_mask;
56  {
57  if(prev_missing_teams_mask > 0)
58  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
59  prev_missing_teams_mask = -1;
60  return true;
61  }
62  if(total_players == 0)
63  {
64  if(prev_missing_teams_mask > 0)
65  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
66  prev_missing_teams_mask = -1;
67  return false;
68  }
69  int missing_teams_mask = 0;
70  for (int i = 1; i <= NUM_TEAMS; ++i)
71  {
72  if ((freezetag_teams & Team_IndexToBit(i)) &&
74  {
75  missing_teams_mask |= Team_IndexToBit(i);
76  }
77  }
78  if(prev_missing_teams_mask != missing_teams_mask)
79  {
80  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask);
81  prev_missing_teams_mask = missing_teams_mask;
82  }
83  return false;
84 }
const int NUM_TEAMS
Number of teams in the game.
Definition: teams.qh:3
int Team_IndexToBit(int index)
Converts team index into bit value that is used in team bitmasks.
Definition: teams.qh:211
int NumTeams(int teams)
Definition: scores_rules.qc:17
int Team_GetNumberOfAlivePlayers(entity team_ent)
Returns the number of alive players in a team.
Definition: teamplay.qc:85
#define NULL
Definition: post.qh:17
int Team_GetNumberOfAliveTeams()
Returns the number of alive teams.
Definition: teamplay.qc:110
entity Team_GetTeamFromIndex(int index)
Returns the global team entity at the given index.
Definition: teamplay.qc:57
int total_players
Definition: sv_rules.qh:8
float freezetag_teams
Definition: sv_freezetag.qh:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_CheckWinner()

bool freezetag_CheckWinner ( )

Definition at line 89 of file sv_freezetag.qc.

References APP_TEAM_NUM, autocvar_g_freezetag_round_timelimit, autocvar_g_freezetag_warmup, FOREACH_CLIENT, IS_PLAYER, nades_Clear(), NULL, round_handler_GetEndTime, round_handler_Init(), ST_FT_ROUNDS, Team_GetWinnerAliveTeam(), TeamScore_AddToTeam(), and time.

Referenced by freezetag_Initialize().

90 {
92  {
93  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_OVER);
94  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_OVER);
96  it.freezetag_frozen_timeout = 0;
97  it.freezetag_revive_time = 0;
98  nades_Clear(it);
99  });
100  game_stopped = true;
102  return true;
103  }
104 
105  int winner_team = Team_GetWinnerAliveTeam();
106  if (!winner_team)
107  return false;
108 
109  if(winner_team > 0)
110  {
111  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
112  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_ROUND_TEAM_WIN));
113  TeamScore_AddToTeam(winner_team, ST_FT_ROUNDS, +1);
114  }
115  else if(winner_team == -1)
116  {
117  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ROUND_TIED);
118  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ROUND_TIED);
119  }
120 
122  it.freezetag_frozen_timeout = 0;
123  it.freezetag_revive_time = 0;
124  nades_Clear(it);
125  });
126 
127  game_stopped = true;
129  return true;
130 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
float TeamScore_AddToTeam(int t, float scorefield, float score)
Adds a score to the given team.
Definition: scores.qc:108
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
float autocvar_g_freezetag_warmup
Definition: sv_freezetag.qc:11
float autocvar_g_freezetag_round_timelimit
Definition: sv_freezetag.qc:8
#define NULL
Definition: post.qh:17
#define round_handler_GetEndTime()
int Team_GetWinnerAliveTeam()
Returns the winner team.
Definition: teamplay.qc:95
float time
Definition: csprogsdefs.qc:16
const int ST_FT_ROUNDS
Definition: sv_freezetag.qh:11
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
void nades_Clear(entity)
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_count_alive_players()

void freezetag_count_alive_players ( )

Definition at line 22 of file sv_freezetag.qc.

References eliminatedPlayers, entity(), Entity_GetTeam(), Entity_HasValidTeam(), FOREACH_CLIENT, FROZEN_NORMAL, GetResource(), IS_PLAYER, IS_REAL_CLIENT, NUM_TEAMS, RES_HEALTH, Team_GetNumberOfAlivePlayers(), Team_GetTeamFromIndex(), Team_SetNumberOfAlivePlayers(), and total_players.

Referenced by freezetag_Freeze(), ft_RemovePlayer(), and MUTATOR_HOOKFUNCTION().

23 {
24  total_players = 0;
25  for (int i = 1; i <= NUM_TEAMS; ++i)
26  {
28  }
30  {
31  ++total_players;
32  if (GetResource(it, RES_HEALTH) < 1 || STAT(FROZEN, it) == FROZEN_NORMAL)
33  {
34  continue;
35  }
36  entity team_ = Entity_GetTeam(it);
37  int num_alive = Team_GetNumberOfAlivePlayers(team_);
38  ++num_alive;
39  Team_SetNumberOfAlivePlayers(team_, num_alive);
40  });
42  {
43  STAT(REDALIVE, it) = Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(1));
44  STAT(BLUEALIVE, it) = Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(2));
45  STAT(YELLOWALIVE, it) = Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(3));
46  STAT(PINKALIVE, it) = Team_GetNumberOfAlivePlayers(Team_GetTeamFromIndex(4));
47  });
48 
49  eliminatedPlayers.SendFlags |= 1;
50 }
const int NUM_TEAMS
Number of teams in the game.
Definition: teams.qh:3
entity() spawn
int Team_GetNumberOfAlivePlayers(entity team_ent)
Returns the number of alive players in a team.
Definition: teamplay.qc:85
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
entity Entity_GetTeam(entity this)
Returns the team entity of the given entity.
Definition: teamplay.qc:181
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
RES_HEALTH
Definition: ent_cs.qc:126
bool Entity_HasValidTeam(entity this)
Returns whether the given entity belongs to a valid team.
Definition: teamplay.qc:171
const int FROZEN_NORMAL
Definition: damage.qh:109
void Team_SetNumberOfAlivePlayers(entity team_ent, int number)
Sets the number of alive players in a team.
Definition: teamplay.qc:90
entity Team_GetTeamFromIndex(int index)
Returns the global team entity at the given index.
Definition: teamplay.qc:57
int total_players
Definition: sv_rules.qh:8
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
entity eliminatedPlayers
Definition: elimination.qh:3
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_Freeze()

void freezetag_Freeze ( entity  targ,
entity  attacker 
)

Definition at line 177 of file sv_freezetag.qc.

References autocvar_g_freezetag_frozen_maxtime, autocvar_g_freezetag_revive_auto, Freeze(), freezetag_Add_Score(), freezetag_count_alive_players(), FROZEN_NORMAL, and time.

Referenced by MUTATOR_HOOKFUNCTION().

178 {
179  if(STAT(FROZEN, targ))
180  return;
181 
182  targ.freezetag_frozen_time = time;
184  targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
185 
186  Freeze(targ, 0, FROZEN_NORMAL, true);
187 
189 
190  freezetag_Add_Score(targ, attacker);
191 }
void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
Definition: damage.qc:494
void freezetag_Add_Score(entity targ, entity attacker)
float autocvar_g_freezetag_frozen_maxtime
Definition: sv_freezetag.qc:6
const int FROZEN_NORMAL
Definition: damage.qh:109
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
bool autocvar_g_freezetag_revive_auto
Definition: sv_freezetag.qh:38
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_Initialize()

void freezetag_Initialize ( )

Definition at line 752 of file sv_freezetag.qc.

References autocvar_g_freezetag_round_timelimit, autocvar_g_freezetag_teams_override, autocvar_g_freezetag_warmup, BITS, bound(), cvar(), EliminatedPlayers_Init(), freezetag_CheckTeams(), freezetag_CheckWinner(), freezetag_isEliminated(), freezetag_teams, func_null(), GameRules_scoring, round_handler_Init(), round_handler_Spawn(), SFL_SORT_PRIO_PRIMARY, and ST_FT_ROUNDS.

Referenced by REGISTER_MUTATOR().

753 {
755  if(freezetag_teams < 2)
756  freezetag_teams = cvar("g_freezetag_teams"); // read the cvar directly as it gets written earlier in the same frame
757 
760  field_team(ST_FT_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
761  field(SP_FREEZETAG_REVIVALS, "revivals", 0);
762  });
763 
766 
768 }
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition: sv_rules.qh:53
bool freezetag_CheckTeams()
Definition: sv_freezetag.qc:52
void round_handler_Spawn(bool() canRoundStart_func, bool() canRoundEnd_func, void() roundStart_func)
bool freezetag_isEliminated(entity e)
void EliminatedPlayers_Init(float(entity) isEliminated_func)
Definition: elimination.qc:27
const int SFL_SORT_PRIO_PRIMARY
Definition: scores.qh:127
float autocvar_g_freezetag_warmup
Definition: sv_freezetag.qc:11
int autocvar_g_freezetag_teams_override
Definition: sv_freezetag.qc:10
float autocvar_g_freezetag_round_timelimit
Definition: sv_freezetag.qc:8
const int ST_FT_ROUNDS
Definition: sv_freezetag.qh:11
void round_handler_Init(float the_delay, float the_count, float the_round_timelimit)
bool freezetag_CheckWinner()
Definition: sv_freezetag.qc:89
#define BITS(n)
Definition: bits.qh:9
var void func_null()
float freezetag_teams
Definition: sv_freezetag.qh:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_isEliminated()

bool freezetag_isEliminated ( entity  e)

Definition at line 193 of file sv_freezetag.qc.

References entity(), FROZEN_NORMAL, havocbot_role_ft_freeing(), havocbot_role_ft_offense(), IS_DEAD, IS_PLAYER, and void().

Referenced by freezetag_Initialize().

194 {
195  if(IS_PLAYER(e) && (STAT(FROZEN, e) == FROZEN_NORMAL || IS_DEAD(e)))
196  return true;
197  return false;
198 }
const int FROZEN_NORMAL
Definition: damage.qh:109
#define IS_DEAD(s)
Definition: utils.qh:26
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_LastPlayerForTeam()

entity freezetag_LastPlayerForTeam ( entity  this)

Definition at line 132 of file sv_freezetag.qc.

References entity(), FOREACH_CLIENT, FROZEN_NORMAL, GetResource(), IS_PLAYER, NULL, RES_HEALTH, and SAME_TEAM.

Referenced by freezetag_LastPlayerForTeam_Notify().

133 {
134  entity last_pl = NULL;
135  FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
136  if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResource(it, RES_HEALTH) >= 1)
137  {
138  if (!last_pl)
139  last_pl = it;
140  else
141  return NULL;
142  }
143  });
144  return last_pl;
145 }
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
RES_HEALTH
Definition: ent_cs.qc:126
const int FROZEN_NORMAL
Definition: damage.qh:109
#define NULL
Definition: post.qh:17
#define SAME_TEAM(a, b)
Definition: teams.qh:239
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ freezetag_LastPlayerForTeam_Notify()

void freezetag_LastPlayerForTeam_Notify ( entity  this)

Definition at line 147 of file sv_freezetag.qc.

References entity(), freezetag_LastPlayerForTeam(), round_handler_IsActive, and round_handler_IsRoundStarted.

Referenced by ft_RemovePlayer(), and MUTATOR_HOOKFUNCTION().

148 {
151  {
153  if(pl)
154  Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE);
155  }
156 }
#define round_handler_IsActive()
entity freezetag_LastPlayerForTeam(entity this)
entity() spawn
#define round_handler_IsRoundStarted()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ft_RemovePlayer()

void ft_RemovePlayer ( entity  this)

Definition at line 309 of file sv_freezetag.qc.

References freezetag_count_alive_players(), freezetag_LastPlayerForTeam_Notify(), FROZEN_NORMAL, RES_HEALTH, SetResourceExplicit(), and Unfreeze().

Referenced by MUTATOR_HOOKFUNCTION().

310 {
311  if (STAT(FROZEN, this) != FROZEN_NORMAL)
313  Unfreeze(this, false);
314 
315  SetResourceExplicit(this, RES_HEALTH, 0); // neccessary to correctly count alive players
317 }
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Definition: cl_resources.qc:15
RES_HEALTH
Definition: ent_cs.qc:126
void Unfreeze(entity targ, bool reset_health)
Definition: damage.qc:546
const int FROZEN_NORMAL
Definition: damage.qh:109
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
void freezetag_LastPlayerForTeam_Notify(entity this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_goalrating_ft_freeplayers()

void havocbot_goalrating_ft_freeplayers ( entity  this,
float  ratingscale,
vector  org,
float  sradius 
)

Definition at line 208 of file sv_freezetag.qc.

References entity(), FLOAT_MAX, FOREACH_CLIENT, FROZEN_NORMAL, GetResource(), IS_PLAYER, navigation_routerating(), NULL, RES_HEALTH, SAME_TEAM, vdist, and vlen2.

Referenced by havocbot_role_ft_freeing(), and havocbot_role_ft_offense().

209 {
210  entity best_pl = NULL;
211  float best_dist2 = FLOAT_MAX;
212  FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
213  if (STAT(FROZEN, it) == FROZEN_NORMAL)
214  {
215  if(vdist(it.origin - org, >, sradius))
216  continue;
217  navigation_routerating(this, it, ratingscale, 2000);
218  }
219  else if (best_dist2
220  && GetResource(it, RES_HEALTH) < GetResource(this, RES_HEALTH) + 30
221  && vlen2(it.origin - org) < best_dist2)
222  {
223  // If teamate is not frozen still seek them out as fight better
224  // in a group.
225  best_dist2 = vlen2(it.origin - org);
226  if (best_dist2 < 700 ** 2)
227  {
228  best_pl = NULL;
229  best_dist2 = 0; // already close to a teammate
230  }
231  else
232  best_pl = it;
233  }
234  });
235  if (best_pl)
236  navigation_routerating(this, best_pl, ratingscale / 2, 2000);
237 }
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
void navigation_routerating(entity this, entity e, float f, float rangebias)
Definition: navigation.qc:1220
RES_HEALTH
Definition: ent_cs.qc:126
#define vlen2(v)
Definition: vector.qh:4
const int FROZEN_NORMAL
Definition: damage.qh:109
#define NULL
Definition: post.qh:17
#define SAME_TEAM(a, b)
Definition: teams.qh:239
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
#define IS_PLAYER(v)
Definition: utils.qh:9
const float FLOAT_MAX
Definition: float.qh:3
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_ft_freeing()

void havocbot_role_ft_freeing ( entity  this)

Definition at line 275 of file sv_freezetag.qc.

References havocbot_goalrating_enemyplayers(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_items(), havocbot_goalrating_waypoints(), havocbot_role_ft_offense(), havocbot_role_timeout, IS_DEAD, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), origin, random(), and time.

Referenced by freezetag_isEliminated(), havocbot_role_ft_offense(), and MUTATOR_HOOKFUNCTION().

276 {
277  if(IS_DEAD(this))
278  return;
279 
280  if (!this.havocbot_role_timeout)
281  this.havocbot_role_timeout = time + random() * 10 + 20;
282 
283  if (time > this.havocbot_role_timeout)
284  {
285  LOG_TRACE("changing role to offense");
286  this.havocbot_role = havocbot_role_ft_offense;
287  this.havocbot_role_timeout = 0;
288  return;
289  }
290 
292  {
294  havocbot_goalrating_items(this, 10000, this.origin, 10000);
295  havocbot_goalrating_enemyplayers(this, 5000, this.origin, 10000);
296  havocbot_goalrating_ft_freeplayers(this, 20000, this.origin, 10000);
297  havocbot_goalrating_waypoints(this, 1, this.origin, 3000);
299 
301  }
302 }
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:106
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
origin
Definition: ent_cs.qc:114
void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:176
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
void havocbot_goalrating_ft_freeplayers(entity this, float ratingscale, vector org, float sradius)
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
#define LOG_TRACE(...)
Definition: log.qh:81
void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:16
void havocbot_role_ft_offense(entity this)
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_ft_offense()

void havocbot_role_ft_offense ( entity  this)

Definition at line 239 of file sv_freezetag.qc.

References FOREACH_CLIENT, FROZEN_NORMAL, havocbot_goalrating_enemyplayers(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_items(), havocbot_goalrating_waypoints(), havocbot_role_ft_freeing(), havocbot_role_timeout, IS_DEAD, IS_PLAYER, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), origin, random(), SAME_TEAM, and time.

Referenced by freezetag_isEliminated(), havocbot_role_ft_freeing(), and MUTATOR_HOOKFUNCTION().

240 {
241  if(IS_DEAD(this))
242  return;
243 
244  if (!this.havocbot_role_timeout)
245  this.havocbot_role_timeout = time + random() * 10 + 20;
246 
247  // Count how many players on team are unfrozen.
248  int unfrozen = 0;
249  FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && STAT(FROZEN, it) != FROZEN_NORMAL, {
250  unfrozen++;
251  });
252 
253  // If only one left on team or if role has timed out then start trying to free players.
254  if ((!unfrozen && STAT(FROZEN, this) != FROZEN_NORMAL) || time > this.havocbot_role_timeout)
255  {
256  LOG_TRACE("changing role to freeing");
257  this.havocbot_role = havocbot_role_ft_freeing;
258  this.havocbot_role_timeout = 0;
259  return;
260  }
261 
263  {
265  havocbot_goalrating_items(this, 12000, this.origin, 10000);
266  havocbot_goalrating_enemyplayers(this, 10000, this.origin, 10000);
267  havocbot_goalrating_ft_freeplayers(this, 9000, this.origin, 10000);
268  havocbot_goalrating_waypoints(this, 1, this.origin, 3000);
270 
272  }
273 }
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:106
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
origin
Definition: ent_cs.qc:114
void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:176
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
void havocbot_goalrating_ft_freeplayers(entity this, float ratingscale, vector org, float sradius)
const int FROZEN_NORMAL
Definition: damage.qh:109
#define SAME_TEAM(a, b)
Definition: teams.qh:239
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
#define LOG_TRACE(...)
Definition: log.qh:81
void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:16
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
void havocbot_role_ft_freeing(entity this)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MUTATOR_HOOKFUNCTION() [1/16]

MUTATOR_HOOKFUNCTION ( ft  ,
ClientDisconnect   
)

Definition at line 319 of file sv_freezetag.qc.

References entity(), ft_RemovePlayer(), and M_ARGV.

320 {
321  entity player = M_ARGV(0, entity);
322 
323  ft_RemovePlayer(player);
324  return true;
325 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void ft_RemovePlayer(entity this)
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/16]

MUTATOR_HOOKFUNCTION ( ft  ,
MakePlayerObserver   
)

Definition at line 327 of file sv_freezetag.qc.

References entity(), ft_RemovePlayer(), and M_ARGV.

328 {
329  entity player = M_ARGV(0, entity);
330 
331  ft_RemovePlayer(player);
332 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void ft_RemovePlayer(entity this)
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/16]

MUTATOR_HOOKFUNCTION ( ft  ,
PlayerDies   
)

Definition at line 334 of file sv_freezetag.qc.

References entity(), freezetag_Add_Score(), freezetag_count_alive_players(), freezetag_Freeze(), freezetag_LastPlayerForTeam_Notify(), FROZEN_NORMAL, IS_PLAYER, ITEM_DAMAGE_NEEDKILL, M_ARGV, NULL, RESPAWN_FORCE, round_handler_CountdownRunning, round_handler_IsActive, time, and Unfreeze().

335 {
336  entity frag_attacker = M_ARGV(1, entity);
337  entity frag_target = M_ARGV(2, entity);
338  float frag_deathtype = M_ARGV(3, float);
339 
342  {
343  if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
344  Unfreeze(frag_target, true);
346  frag_target.respawn_time = time;
347  frag_target.respawn_flags |= RESPAWN_FORCE;
348  return true;
349  }
350 
351  frag_target.respawn_time = time + 1;
352  frag_target.respawn_flags |= RESPAWN_FORCE;
353 
354  // Cases DEATH_TEAMCHANGE and DEATH_AUTOTEAMCHANGE are needed to fix a bug whe
355  // you succeed changing team through the menu: you both really die (gibbing) and get frozen
356  if(ITEM_DAMAGE_NEEDKILL(frag_deathtype)
357  || frag_deathtype == DEATH_TEAMCHANGE.m_id || frag_deathtype == DEATH_AUTOTEAMCHANGE.m_id)
358  {
359  // let the player die, he will be automatically frozen when he respawns
360  if (STAT(FROZEN, frag_target) != FROZEN_NORMAL)
361  {
362  freezetag_Add_Score(frag_target, frag_attacker);
365  frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
366  }
367  else
368  {
369  float t = frag_target.freezetag_frozen_timeout;
370  float t2 = frag_target.freezetag_frozen_time;
371  Unfreeze(frag_target, false); // remove ice
372  // keep timeout value so it can be restored when player will be refrozen on respawn
373  // NOTE this can't be exactly -2 since game starts from time 2
374  frag_target.freezetag_frozen_timeout = -t;
375  frag_target.freezetag_frozen_time = t2;
376  }
377  return true;
378  }
379 
380  if (STAT(FROZEN, frag_target) == FROZEN_NORMAL)
381  return true;
382 
383  freezetag_Freeze(frag_target, frag_attacker);
385 
386  if(frag_attacker == frag_target || frag_attacker == NULL)
387  {
388  if(IS_PLAYER(frag_target))
389  Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_SELF);
390  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_SELF, frag_target.netname);
391  }
392  else
393  {
394  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_FREEZE, frag_target.netname, frag_attacker.netname);
395  }
396 
397  return true;
398 }
const int RESPAWN_FORCE
Definition: client.qh:330
#define round_handler_IsActive()
entity() spawn
void freezetag_Freeze(entity targ, entity attacker)
void freezetag_Add_Score(entity targ, entity attacker)
void Unfreeze(entity targ, bool reset_health)
Definition: damage.qc:546
const int FROZEN_NORMAL
Definition: damage.qh:109
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
#define NULL
Definition: post.qh:17
#define M_ARGV(x, type)
Definition: events.qh:17
#define ITEM_DAMAGE_NEEDKILL(dt)
Definition: items.qh:130
void freezetag_LastPlayerForTeam_Notify(entity this)
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
#define round_handler_CountdownRunning()
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [4/16]

MUTATOR_HOOKFUNCTION ( ft  ,
PlayerSpawn   
)

Definition at line 400 of file sv_freezetag.qc.

References entity(), freezetag_count_alive_players(), freezetag_Freeze(), M_ARGV, NULL, round_handler_IsActive, and round_handler_IsRoundStarted.

401 {
402  entity player = M_ARGV(0, entity);
403 
404  if(player.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
405  return true; // do nothing, round is starting right now
406 
407  if(player.freezetag_frozen_timeout <= -2) // player was dead
408  {
409  float t = player.freezetag_frozen_timeout;
410  float t2 = player.freezetag_frozen_time;
411  freezetag_Freeze(player, NULL);
412  if (t < -2)
413  {
414  player.freezetag_frozen_timeout = -t;
415  player.freezetag_frozen_time = t2;
416  }
417  return true;
418  }
419 
421 
424  {
425  Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
426  freezetag_Freeze(player, NULL);
427  }
428 
429  return true;
430 }
#define round_handler_IsActive()
entity() spawn
#define round_handler_IsRoundStarted()
void freezetag_Freeze(entity targ, entity attacker)
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
#define NULL
Definition: post.qh:17
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [5/16]

MUTATOR_HOOKFUNCTION ( ft  ,
reset_map_players   
)

Definition at line 432 of file sv_freezetag.qc.

References CS(), FOREACH_CLIENT, freezetag_count_alive_players(), IS_PLAYER, and PutClientInServer().

433 {
435  CS(it).killcount = 0;
436  it.freezetag_revive_time = 0;
437  it.freezetag_frozen_timeout = -1;
438  PutClientInServer(it);
439  it.freezetag_frozen_timeout = 0;
440  });
442  return true;
443 }
ClientState CS(Client this)
Definition: state.qh:47
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
PutClientInServer(this)
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [6/16]

MUTATOR_HOOKFUNCTION ( ft  ,
GiveFragsForKill  ,
CBC_ORDER_FIRST   
)

Definition at line 445 of file sv_freezetag.qc.

References M_ARGV.

446 {
447  M_ARGV(2, float) = 0; // no frags counted in Freeze Tag
448  return true;
449 }
#define M_ARGV(x, type)
Definition: events.qh:17

◆ MUTATOR_HOOKFUNCTION() [7/16]

MUTATOR_HOOKFUNCTION ( ft  ,
Unfreeze   
)

Definition at line 451 of file sv_freezetag.qc.

References entity(), and M_ARGV.

452 {
453  entity targ = M_ARGV(0, entity);
454  targ.freezetag_frozen_time = 0;
455  targ.freezetag_frozen_timeout = 0;
456 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [8/16]

MUTATOR_HOOKFUNCTION ( ft  ,
Damage_Calculate   
)

Definition at line 458 of file sv_freezetag.qc.

References autocvar_g_freezetag_frozen_maxtime, autocvar_g_freezetag_revive_auto, autocvar_g_freezetag_revive_auto_reducible, autocvar_g_freezetag_revive_auto_reducible_forcefactor, autocvar_g_freezetag_revive_auto_reducible_maxforce, DIFF_TEAM, entity(), fabs(), FROZEN_NORMAL, M_ARGV, max(), time, vector(), and vlen().

459 {
460  entity frag_attacker = M_ARGV(1, entity);
461  entity frag_target = M_ARGV(2, entity);
462  //float frag_deathtype = M_ARGV(3, float);
463  //float frag_damage = M_ARGV(4, float);
464  vector frag_force = M_ARGV(6, vector);
465 
466  if (STAT(FROZEN, frag_target) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto_reducible
468  {
469  float t = 0;
470  if ((autocvar_g_freezetag_revive_auto_reducible < 0 || DIFF_TEAM(frag_attacker, frag_target))
471  && frag_target.freezetag_frozen_timeout > time)
472  {
474  {
476  t = vlen(frag_force);
477  // limit hit force considered at once, e.g when you have the Strength
478  // powerup but also with weapons that fire multiple projectiles at once (crylink)
479  if (frag_target.freezetag_frozen_force + t > maxforce)
480  {
481  t = max(0, maxforce - frag_target.freezetag_frozen_force);
482  frag_target.freezetag_frozen_force = maxforce;
483  }
484  else
485  frag_target.freezetag_frozen_force += t;
487  }
488  frag_target.freezetag_frozen_timeout -= t;
489  if (frag_target.freezetag_frozen_timeout < time)
490  frag_target.freezetag_frozen_timeout = time;
491  }
492  }
493 }
int autocvar_g_freezetag_revive_auto_reducible
Definition: sv_freezetag.qh:40
entity() spawn
#define DIFF_TEAM(a, b)
Definition: teams.qh:240
float autocvar_g_freezetag_revive_auto_reducible_maxforce
Definition: sv_freezetag.qh:42
float autocvar_g_freezetag_frozen_maxtime
Definition: sv_freezetag.qc:6
const int FROZEN_NORMAL
Definition: damage.qh:109
#define M_ARGV(x, type)
Definition: events.qh:17
vector(float skel, float bonenum) _skel_get_boneabs_hidden
bool autocvar_g_freezetag_revive_auto
Definition: sv_freezetag.qh:38
float autocvar_g_freezetag_revive_auto_reducible_forcefactor
Definition: sv_freezetag.qh:41
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [9/16]

MUTATOR_HOOKFUNCTION ( ft  ,
PlayerPreThink  ,
CBC_ORDER_FIRST   
)

Definition at line 503 of file sv_freezetag.qc.

References autocvar_g_freezetag_frozen_maxtime, autocvar_g_freezetag_revive_auto, autocvar_g_freezetag_revive_auto_progress, autocvar_g_freezetag_revive_clearspeed, autocvar_g_freezetag_revive_extra_size, autocvar_g_freezetag_revive_spawnshield, autocvar_g_freezetag_revive_speed, autocvar_g_freezetag_revive_speed_t2s, autocvar_g_freezetag_revive_time_to_score, autocvar_sv_eventlog, bound(), entity(), FOREACH_CLIENT, frametime, freezetag_count_alive_players(), FROZEN_NORMAL, ftos(), GameLogEcho(), GameRules_scoring_add, if(), IN_REVIVING_RANGE, IS_PLAYER, M_ARGV, max(), nades_GiveBonus(), NULL, RES_HEALTH, round_handler_IsActive, round_handler_IsRoundStarted, SetResourceExplicit(), start_health, strcat(), strlen(), substring(), time, Unfreeze(), vector(), warmup_stage, warmup_start_health, WP_FROZEN_COLOR, and WP_REVIVING_COLOR.

504 {
505  if(game_stopped)
506  return true;
507 
510  return true;
511 
512  entity player = M_ARGV(0, entity);
513  //if (STAT(FROZEN, player) == FROZEN_NORMAL)
514  //if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout)
515  //player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time);
516 
517  player.freezetag_frozen_force = 0;
518 
519  if (!(frametime && IS_PLAYER(player)))
520  return true;
521 
522  entity revivers_last = NULL;
523  entity revivers_first = NULL;
524 
525  bool player_is_reviving = false;
526  int n = 0;
527  vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
529  // check if player is reviving anyone
530  if (STAT(FROZEN, it) == FROZEN_NORMAL)
531  {
532  if ((STAT(FROZEN, player) == FROZEN_NORMAL))
533  continue;
534  if (!IN_REVIVING_RANGE(player, it, revive_extra_size))
535  continue;
536  player_is_reviving = true;
537  break;
538  }
539 
540  if (!(STAT(FROZEN, player) == FROZEN_NORMAL))
541  continue; // both player and it are NOT frozen
542  if (!IN_REVIVING_RANGE(player, it, revive_extra_size))
543  continue;
544 
545  // found a teammate that is reviving player
546  if (autocvar_g_freezetag_revive_time_to_score > 0 && STAT(FROZEN, player) == FROZEN_NORMAL)
547  {
548  it.freezetag_revive_time += frametime / autocvar_g_freezetag_revive_time_to_score;
549  while (it.freezetag_revive_time > 1)
550  {
551  GameRules_scoring_add(it, SCORE, +1);
552  it.freezetag_revive_time -= 1;
553  }
554  }
555  if (revivers_last)
556  revivers_last.chain = it;
557  revivers_last = it;
558  if (!revivers_first)
559  revivers_first = it;
560  ++n;
561  });
562  if (revivers_last)
563  revivers_last.chain = NULL;
564 
565  // allow normal revival during automatic revival
566  // (if we wouldn't allow it then freezetag_frozen_timeout should be checked too in the previous loop)
567  //if (STAT(FROZEN, player) == FROZEN_NORMAL) // redundant check
568  if (!n && player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
569  n = -1;
570 
571  float base_progress = 0;
572  if (STAT(FROZEN, player) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto
574  {
575  // NOTE if auto-revival is in progress, manual revive speed is reduced so that it always takes the same amount of time
576  base_progress = bound(0, (1 - (player.freezetag_frozen_timeout - time) / autocvar_g_freezetag_frozen_maxtime), 1);
577  }
578 
579  if (!n) // no teammate nearby
580  {
581  float clearspeed = autocvar_g_freezetag_revive_clearspeed;
582  if (STAT(FROZEN, player) == FROZEN_NORMAL)
583  {
585  {
586  if (STAT(REVIVE_PROGRESS, player) > base_progress)
587  {
588  // reduce auto-revival time based on manual revival progress
589  base_progress = STAT(REVIVE_PROGRESS, player);
590  player.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime * (1 - STAT(REVIVE_PROGRESS, player));
591  }
592  // don't clear revive progress, it would allow stacking points
593  // by entering and exiting the revival zone many times
594  STAT(REVIVE_PROGRESS, player) = base_progress;
595  }
596  else
597  STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) - frametime * clearspeed * (1 - base_progress), 1);
598  }
599  else if (!STAT(FROZEN, player) && !player_is_reviving)
600  STAT(REVIVE_PROGRESS, player) = base_progress; // thawing nobody
601  }
602  else if (STAT(FROZEN, player) == FROZEN_NORMAL) // OK, there is at least one teammate reviving us
603  {
606  spd = autocvar_g_freezetag_revive_speed * (1 - base_progress);
607  STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, spd), 1);
608 
609  if(STAT(REVIVE_PROGRESS, player) >= 1)
610  {
611  float frozen_time = time - player.freezetag_frozen_time;
612  Unfreeze(player, false);
614  player.spawnshieldtime = time + autocvar_g_freezetag_revive_spawnshield;
616 
617  if(n == -1)
618  {
620  GameLogEcho(strcat(":ft:autorevival:", ftos(player.playerid)));
621  Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_AUTO_REVIVED, frozen_time);
622  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_AUTO_REVIVED, player.netname, frozen_time);
623  return true;
624  }
625 
626  // EVERY team mate nearby gets a point (even if multiple!)
627  for(entity it = revivers_first; it; it = it.chain)
628  {
629  GameRules_scoring_add(it, FREEZETAG_REVIVALS, +1);
631  GameRules_scoring_add(it, SCORE, +1);
632  nades_GiveBonus(it, autocvar_g_nades_bonus_score_low);
633  }
634 
635  Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, revivers_first.netname);
636  Send_Notification(NOTIF_ONE, revivers_first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
637  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED, player.netname, revivers_first.netname);
639  {
640  string revivers = "";
641  for(entity it = revivers_first; it; it = it.chain)
642  revivers = strcat(revivers, ftos(it.playerid), ",");
643  revivers = substring(revivers, 0, strlen(revivers) - 1);
644  GameLogEcho(strcat(":ft:revival:", ftos(player.playerid), ":", revivers));
645  }
646  }
647 
648  for(entity it = revivers_first; it; it = it.chain)
649  STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
650  }
651 
652  if (STAT(FROZEN, player) == FROZEN_NORMAL)
653  {
654  entity player_wp = player.waypointsprite_attached;
655  if (n > 0 || (n == 0 && STAT(REVIVE_PROGRESS, player) > 0.95))
656  {
657  WaypointSprite_UpdateSprites(player_wp, WP_Reviving, WP_Null, WP_Null);
658  WaypointSprite_UpdateTeamRadar(player_wp, RADARICON_WAYPOINT, WP_REVIVING_COLOR);
659  }
660  else
661  {
662  WaypointSprite_UpdateSprites(player_wp, WP_Frozen, WP_Null, WP_Null);
663  WaypointSprite_UpdateTeamRadar(player_wp, RADARICON_WAYPOINT, WP_FROZEN_COLOR);
664  }
665 
666  WaypointSprite_UpdateMaxHealth(player_wp, 1);
667  WaypointSprite_UpdateHealth(player_wp, STAT(REVIVE_PROGRESS, player));
668  }
669 
670  return true;
671 }
#define round_handler_IsActive()
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Definition: cl_resources.qc:15
float autocvar_g_freezetag_revive_speed_t2s
Definition: sv_freezetag.qh:45
float autocvar_g_freezetag_revive_clearspeed
Definition: sv_freezetag.qc:7
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
float autocvar_g_freezetag_revive_time_to_score
Definition: sv_freezetag.qh:46
bool warmup_stage
Definition: main.qh:103
#define round_handler_IsRoundStarted()
float autocvar_g_freezetag_revive_extra_size
Definition: sv_freezetag.qh:43
const vector WP_REVIVING_COLOR
Definition: all.inc:9
RES_HEALTH
Definition: ent_cs.qc:126
void Unfreeze(entity targ, bool reset_health)
Definition: damage.qc:546
float autocvar_g_freezetag_frozen_maxtime
Definition: sv_freezetag.qc:6
void nades_GiveBonus(entity player, float score)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
const int FROZEN_NORMAL
Definition: damage.qh:109
void freezetag_count_alive_players()
Definition: sv_freezetag.qc:22
float autocvar_g_freezetag_revive_speed
Definition: sv_freezetag.qh:44
#define NULL
Definition: post.qh:17
float frametime
Definition: csprogsdefs.qc:17
void GameLogEcho(string s)
Definition: gamelog.qc:12
#define M_ARGV(x, type)
Definition: events.qh:17
int autocvar_g_freezetag_revive_auto_progress
Definition: sv_freezetag.qh:39
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define IN_REVIVING_RANGE(player, it, revive_extra_size)
float start_health
Definition: world.qh:98
bool autocvar_g_freezetag_revive_auto
Definition: sv_freezetag.qh:38
const vector WP_FROZEN_COLOR
Definition: all.inc:8
float warmup_start_health
Definition: world.qh:110
bool autocvar_sv_eventlog
Definition: gamelog.qh:3
if(IS_DEAD(this))
Definition: impulse.qc:92
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
float autocvar_g_freezetag_revive_spawnshield
Definition: sv_freezetag.qh:49
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [10/16]

MUTATOR_HOOKFUNCTION ( ft  ,
SetStartItems   
)

Definition at line 673 of file sv_freezetag.qc.

References autocvar_g_ft_start_ammo_cells, autocvar_g_ft_start_ammo_fuel, autocvar_g_ft_start_ammo_nails, autocvar_g_ft_start_ammo_plasma, autocvar_g_ft_start_ammo_rockets, autocvar_g_ft_start_ammo_shells, autocvar_g_ft_start_armor, autocvar_g_ft_start_health, cvar(), start_ammo_cells, start_ammo_fuel, start_ammo_nails, start_ammo_plasma, start_ammo_rockets, start_ammo_shells, start_armorvalue, start_health, start_items, warmup_start_ammo_cells, warmup_start_ammo_fuel, warmup_start_ammo_nails, warmup_start_ammo_plasma, warmup_start_ammo_rockets, warmup_start_ammo_shells, warmup_start_armorvalue, and warmup_start_health.

674 {
675  start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS);
676  if(!cvar("g_use_ammunition"))
677  start_items |= IT_UNLIMITED_AMMO;
678 
687 }
float autocvar_g_ft_start_ammo_fuel
Definition: sv_freezetag.qc:20
float autocvar_g_ft_start_ammo_cells
Definition: sv_freezetag.qc:18
float start_ammo_rockets
Definition: world.qh:87
float start_ammo_fuel
Definition: world.qh:90
float warmup_start_ammo_shells
Definition: world.qh:104
float autocvar_g_ft_start_health
Definition: sv_freezetag.qc:13
float autocvar_g_ft_start_ammo_rockets
Definition: sv_freezetag.qc:17
float autocvar_g_ft_start_ammo_plasma
Definition: sv_freezetag.qc:19
int start_items
Definition: world.qh:84
float start_ammo_shells
Definition: world.qh:85
float autocvar_g_ft_start_armor
Definition: sv_freezetag.qc:14
float warmup_start_ammo_plasma
Definition: world.qh:108
float warmup_start_ammo_cells
Definition: world.qh:107
float warmup_start_ammo_fuel
Definition: world.qh:109
float start_ammo_cells
Definition: world.qh:88
float warmup_start_armorvalue
Definition: world.qh:111
float start_health
Definition: world.qh:98
float warmup_start_ammo_rockets
Definition: world.qh:106
float autocvar_g_ft_start_ammo_shells
Definition: sv_freezetag.qc:15
float autocvar_g_ft_start_ammo_nails
Definition: sv_freezetag.qc:16
float start_ammo_nails
Definition: world.qh:86
float warmup_start_health
Definition: world.qh:110
float start_armorvalue
Definition: world.qh:99
float start_ammo_plasma
Definition: world.qh:89
float warmup_start_ammo_nails
Definition: world.qh:105
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [11/16]

MUTATOR_HOOKFUNCTION ( ft  ,
HavocBot_ChooseRole   
)

Definition at line 689 of file sv_freezetag.qc.

References CS(), entity(), havocbot_role_ft_freeing(), havocbot_role_ft_offense(), IS_DEAD, jointime, M_ARGV, random(), and time.

690 {
691  entity bot = M_ARGV(0, entity);
692 
693  if (!IS_DEAD(bot))
694  {
695  if (random() < 0.5)
696  bot.havocbot_role = havocbot_role_ft_freeing;
697  else
698  bot.havocbot_role = havocbot_role_ft_offense;
699  }
700 
701  // if bots spawn all at once assign them a more appropriated role after a while
702  if (time < CS(bot).jointime + 1)
703  bot.havocbot_role_timeout = time + 10 + random() * 10;
704 
705  return true;
706 }
entity() spawn
ClientState CS(Client this)
Definition: state.qh:47
float jointime
Definition: client.qh:64
#define M_ARGV(x, type)
Definition: events.qh:17
#define IS_DEAD(s)
Definition: utils.qh:26
void havocbot_role_ft_offense(entity this)
float time
Definition: csprogsdefs.qc:16
void havocbot_role_ft_freeing(entity this)
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [12/16]

MUTATOR_HOOKFUNCTION ( ft  ,
TeamBalance_CheckAllowedTeams  ,
CBC_ORDER_EXCLUSIVE   
)

Definition at line 708 of file sv_freezetag.qc.

References freezetag_teams, and M_ARGV.

709 {
710  M_ARGV(0, float) = freezetag_teams;
711  return true;
712 }
#define M_ARGV(x, type)
Definition: events.qh:17
float freezetag_teams
Definition: sv_freezetag.qh:36

◆ MUTATOR_HOOKFUNCTION() [13/16]

MUTATOR_HOOKFUNCTION ( ft  ,
SetWeaponArena   
)

Definition at line 714 of file sv_freezetag.qc.

References autocvar_g_freezetag_weaponarena, and M_ARGV.

715 {
716  if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "")
718 }
string autocvar_g_freezetag_weaponarena
Definition: sv_freezetag.qh:9
#define M_ARGV(x, type)
Definition: events.qh:17

◆ MUTATOR_HOOKFUNCTION() [14/16]

MUTATOR_HOOKFUNCTION ( ft  ,
FragCenterMessage   
)

Definition at line 720 of file sv_freezetag.qc.

References CS(), entity(), FROZEN_NORMAL, GetResource(), IS_BOT_CLIENT, M_ARGV, ping, and RES_HEALTH.

721 {
722  entity frag_attacker = M_ARGV(0, entity);
723  entity frag_target = M_ARGV(1, entity);
724  //float frag_deathtype = M_ARGV(2, float);
725  int kill_count_to_attacker = M_ARGV(3, int);
726  int kill_count_to_target = M_ARGV(4, int);
727 
728  if(STAT(FROZEN, frag_target) == FROZEN_NORMAL)
729  return; // target was already frozen, so this is just pushing them off the cliff
730 
731  Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : CS(frag_target).ping));
732  Send_Notification(NOTIF_ONE, frag_target, MSG_CHOICE, CHOICE_FRAGGED_FREEZE, frag_attacker.netname, kill_count_to_target,
733  GetResource(frag_attacker, RES_HEALTH), GetResource(frag_attacker, RES_ARMOR), (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
734 
735  return true;
736 }
entity() spawn
ClientState CS(Client this)
Definition: state.qh:47
float ping
Definition: main.qh:138
RES_HEALTH
Definition: ent_cs.qc:126
const int FROZEN_NORMAL
Definition: damage.qh:109
#define M_ARGV(x, type)
Definition: events.qh:17
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition: utils.qh:15
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [15/16]

MUTATOR_HOOKFUNCTION ( ft  ,
SV_ParseServerCommand   
)

Definition at line 738 of file sv_freezetag.qc.

References cmd_name, M_ARGV, round_handler_IsActive, round_handler_IsRoundStarted, and shuffleteams_on_reset_map.

739 {
740  string cmd_name = M_ARGV(0, string);
741  if (cmd_name == "shuffleteams")
743  return false;
744 }
#define round_handler_IsActive()
#define round_handler_IsRoundStarted()
#define M_ARGV(x, type)
Definition: events.qh:17
bool shuffleteams_on_reset_map
Definition: sv_cmd.qh:7

◆ MUTATOR_HOOKFUNCTION() [16/16]

MUTATOR_HOOKFUNCTION ( ft  ,
Scores_CountFragsRemaining   
)

Definition at line 746 of file sv_freezetag.qc.

747 {
748  // announce remaining frags
749  return true;
750 }

◆ nades_Clear()

void nades_Clear ( entity  )

Referenced by freezetag_CheckTeams(), and freezetag_CheckWinner().

+ Here is the caller graph for this function:

◆ nades_GiveBonus()

void nades_GiveBonus ( entity  player,
float  score 
)

Referenced by freezetag_CheckTeams(), and MUTATOR_HOOKFUNCTION().

+ Here is the caller graph for this function:

◆ void()

void ( entity  this)

Referenced by freezetag_isEliminated().

+ Here is the caller graph for this function:

Variable Documentation

◆ autocvar_g_freezetag_frozen_maxtime

float autocvar_g_freezetag_frozen_maxtime

Definition at line 6 of file sv_freezetag.qc.

Referenced by freezetag_Freeze(), and MUTATOR_HOOKFUNCTION().

◆ autocvar_g_freezetag_revive_clearspeed

float autocvar_g_freezetag_revive_clearspeed

Definition at line 7 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_freezetag_round_timelimit

float autocvar_g_freezetag_round_timelimit

Definition at line 8 of file sv_freezetag.qc.

Referenced by freezetag_CheckWinner(), and freezetag_Initialize().

◆ autocvar_g_freezetag_teams_override

int autocvar_g_freezetag_teams_override

Definition at line 10 of file sv_freezetag.qc.

Referenced by freezetag_Initialize().

◆ autocvar_g_freezetag_warmup

float autocvar_g_freezetag_warmup

Definition at line 11 of file sv_freezetag.qc.

Referenced by freezetag_CheckWinner(), and freezetag_Initialize().

◆ autocvar_g_ft_start_ammo_cells

float autocvar_g_ft_start_ammo_cells = 180

Definition at line 18 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_ammo_fuel

float autocvar_g_ft_start_ammo_fuel = 0

Definition at line 20 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_ammo_nails

float autocvar_g_ft_start_ammo_nails = 320

Definition at line 16 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_ammo_plasma

float autocvar_g_ft_start_ammo_plasma = 180

Definition at line 19 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_ammo_rockets

float autocvar_g_ft_start_ammo_rockets = 160

Definition at line 17 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_ammo_shells

float autocvar_g_ft_start_ammo_shells = 60

Definition at line 15 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_armor

float autocvar_g_ft_start_armor = 100

Definition at line 14 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_ft_start_health

float autocvar_g_ft_start_health = 100

Definition at line 13 of file sv_freezetag.qc.

Referenced by MUTATOR_HOOKFUNCTION().