Xonotic
|
#include "teamplay.qh"
#include <common/deathtypes/all.qh>
#include <common/gamemodes/_mod.qh>
#include <common/teams.qh>
#include <server/bot/api.qh>
#include <server/bot/default/cvars.qh>
#include <server/campaign.qh>
#include <server/client.qh>
#include <server/command/vote.qh>
#include <server/damage.qh>
#include <server/gamelog.qh>
#include <server/mutators/_mod.qh>
#include <server/race.qh>
#include <server/scores.qh>
#include <server/scores_rules.qh>
Go to the source code of this file.
Enumerations | |
enum | { TEAM_BALANCE_UNINITIALIZED, TEAM_BALANCE_TEAMS_CHECKED, TEAM_BALANCE_TEAM_COUNTS_FILLED } |
Describes a state of team balance entity. More... | |
Functions | |
entity | Entity_GetTeam (entity this) |
Returns the team entity of the given entity. More... | |
int | Entity_GetTeamIndex (entity this) |
Returns the team index of the given entity. More... | |
bool | Entity_HasValidTeam (entity this) |
Returns whether the given entity belongs to a valid team. More... | |
void | KillPlayerForTeamChange (entity player) |
Kills player as a result of team change. More... | |
void | LogTeamChange (float player_id, float team_number, int type) |
bool | MoveToTeam (entity client, int team_index, int type) |
Moves player to the specified team. More... | |
void | Player_DetermineForcedTeam (entity player) |
Determines the forced team of the player using current global config. More... | |
int | Player_GetForcedTeamIndex (entity player) |
Returns the index of the forced team of the given player. More... | |
bool | Player_HasRealForcedTeam (entity player) |
Returns whether player has real forced team. More... | |
void | Player_SetForcedTeamIndex (entity player, int team_index) |
Sets the index of the forced team of the given player. More... | |
bool | Player_SetTeamIndex (entity player, int index) |
Sets the team of the player using its index. More... | |
void | Player_SetTeamIndexChecked (entity player, int team_index) |
Sets the team of the player with all sanity checks. More... | |
void | setcolor (entity this, int clr) |
void | SetPlayerColors (entity player, float _color) |
bool | SetPlayerTeam (entity player, int team_index, int type) |
Sets the team of the player. More... | |
void | SV_ChangeTeam (entity player, int new_color) |
Called when the player changes color with the "color" command. More... | |
int | Team_GetNumberOfAlivePlayers (entity team_ent) |
Returns the number of alive players in a team. More... | |
int | Team_GetNumberOfAliveTeams () |
Returns the number of alive teams. More... | |
int | Team_GetNumberOfOwnedItems (entity team_ent) |
Returns the number of items owned by a team. More... | |
int | Team_GetNumberOfTeamsWithOwnedItems () |
Returns the number of teams that own items. More... | |
entity | Team_GetTeam (int team_num) |
Returns the global team entity that corresponds to the given TEAM_NUM value. More... | |
entity | Team_GetTeamFromIndex (int index) |
Returns the global team entity at the given index. More... | |
float | Team_GetTeamScore (entity team_ent) |
Returns the score of the team. More... | |
int | Team_GetWinnerAliveTeam () |
Returns the winner team. More... | |
int | Team_GetWinnerTeam_WithOwnedItems (int min_control_points) |
Returns the winner team. More... | |
void | Team_InitTeams () |
void | Team_SetNumberOfAlivePlayers (entity team_ent, int number) |
Sets the number of alive players in a team. More... | |
void | Team_SetNumberOfOwnedItems (entity team_ent, int number) |
Sets the number of items owned by a team. More... | |
void | Team_SetTeamScore (entity team_ent, float score) |
Sets the score of the team. More... | |
void | TeamBalance_AutoBalanceBots () |
Switches a bot from one team to another if teams are not balanced. More... | |
void | TeamBalance_BanTeamsExcept (entity balance, int index) |
Bans team change to all teams except the given one. More... | |
entity | TeamBalance_CheckAllowedTeams (entity for_whom) |
Checks whether the player can join teams according to global configuration and mutator settings. More... | |
int | TeamBalance_CompareTeams (entity balance, int team_index_a, int team_index_b, entity player, bool use_score) |
Compares two teams for the purposes of game balance. More... | |
int | TeamBalance_CompareTeamsInternal (entity team_a, entity team_b, entity player, bool use_score) |
Compares two teams for the purposes of game balance. More... | |
void | TeamBalance_Destroy (entity balance) |
Destroy the team balance entity. More... | |
int | TeamBalance_FindBestTeam (entity balance, entity player, bool ignore_player) |
Finds the team that will make the game most balanced if the player joins it. More... | |
int | TeamBalance_FindBestTeams (entity balance, entity player, bool use_score) |
Returns the bitmask of the teams that will make the game most balanced if the player joins any of them. More... | |
int | TeamBalance_GetAllowedTeams (entity balance) |
Returns the bitmask of allowed teams. More... | |
int | TeamBalance_GetLargestTeamIndex (entity balance, int teams) |
Returns the index of the team with most players that is contained in the given bitmask of teams. More... | |
int | TeamBalance_GetNumberOfPlayers (entity balance, int index) |
Returns the number of players (both humans and bots) in a team. More... | |
entity | TeamBalance_GetPlayerForTeamSwitch (int source_team_index, int destination_team_index, bool is_bot) |
Returns the player who is the most suitable for switching between the given teams. More... | |
entity | TeamBalance_GetTeam (entity balance, int team_num) |
Returns the team entity of the team balance entity that corresponds to the given TEAM_NUM value. More... | |
void | TeamBalance_GetTeamCounts (entity balance, entity ignore) |
Counts the number of players and various other information about each team. More... | |
entity | TeamBalance_GetTeamFromIndex (entity balance, int index) |
Returns the team entity of the team balance entity at the given index. More... | |
bool | TeamBalance_IsTeamAllowed (entity balance, int index) |
Returns whether the team change to the specified team is allowed. More... | |
bool | TeamBalance_IsTeamAllowedInternal (entity balance, int index) |
Returns whether the team change to the specified team is allowed. More... | |
void | TeamBalance_JoinBestTeam (entity player) |
Assigns the given player to a team that will make the game most balanced. More... | |
int | TeamBalanceTeam_GetNumberOfBots (entity team_ent) |
Returns the number of bots in a team. More... | |
int | TeamBalanceTeam_GetNumberOfPlayers (entity team_ent) |
Returns the number of players (both humans and bots) in a team. More... | |
bool | TeamBalanceTeam_IsAllowed (entity team_ent) |
Returns whether the team is allowed. More... | |
Variables | |
string | autocvar_g_forced_team_blue |
string | autocvar_g_forced_team_pink |
string | autocvar_g_forced_team_red |
string | autocvar_g_forced_team_yellow |
entity | g_team_entities [NUM_TEAMS] |
Holds global team entities. More... | |
int | m_num_bots |
Number of bots in a team. More... | |
int | m_num_owned_items |
Number of items owned by a team. More... | |
int | m_num_players |
Number of players (both humans and bots) in a team. More... | |
int | m_num_players_alive |
Number of alive players in a team. More... | |
int | m_team_balance_state |
Holds the state of the team balance entity. More... | |
entity | m_team_balance_team [NUM_TEAMS] |
??? More... | |
float | m_team_score |
The score of the team. More... | |
const int | TEAM_NOT_ALLOWED = -1 |
Indicates that the player is not allowed to join a team. More... | |
anonymous enum |
Describes a state of team balance entity.
Definition at line 19 of file teamplay.qc.
Returns the team entity of the given entity.
[in] | this | Entity to check. |
Definition at line 181 of file teamplay.qc.
References Entity_GetTeamIndex(), NULL, Team_GetTeamFromIndex(), and Team_IsValidIndex().
Referenced by CA_count_alive_players(), Domination_count_controlpoints(), freezetag_count_alive_players(), MUTATOR_HOOKFUNCTION(), and Onslaught_count_generators().
Returns the team index of the given entity.
[in] | this | Entity to check. |
Definition at line 176 of file teamplay.qc.
References team, and Team_TeamToIndex().
Referenced by Entity_GetTeam(), SetPlayerTeam(), shuffleteams(), and TeamBalance_GetPlayerForTeamSwitch().
Returns whether the given entity belongs to a valid team.
[in] | this | Entity to check. |
Definition at line 171 of file teamplay.qc.
References team, and Team_IsValidTeam().
Referenced by CA_count_alive_players(), Domination_count_controlpoints(), and freezetag_count_alive_players().
Kills player as a result of team change.
[in,out] | player | Player to kill. |
Definition at line 1049 of file teamplay.qc.
References Damage(), DMG_NOWEP, IS_DEAD, and MUTATOR_CALLHOOK.
Referenced by SetPlayerTeam().
Definition at line 1036 of file teamplay.qc.
References autocvar_sv_eventlog, and GameLogEcho().
Referenced by SetPlayerTeam().
Moves player to the specified team.
[in,out] | client | Client to move. |
[in] | team_index | Index of the team. |
[in] | type | ??? |
Definition at line 327 of file teamplay.qc.
References lockteams, and SetPlayerTeam().
Referenced by GameCommand_moveplayer(), and shuffleteams().
Determines the forced team of the player using current global config.
[in,out] | player | Player to adjust. |
Definition at line 376 of file teamplay.qc.
References autocvar_g_campaign, autocvar_g_campaign_forceteam, autocvar_g_forced_team_blue, autocvar_g_forced_team_otherwise, autocvar_g_forced_team_pink, autocvar_g_forced_team_red, autocvar_g_forced_team_yellow, IS_REAL_CLIENT, Player_HasRealForcedTeam(), PlayerInList(), TEAM_FORCE_DEFAULT, TEAM_FORCE_SPECTATOR, Team_IsValidIndex(), and teamplay.
Referenced by ClientConnect().
Returns the index of the forced team of the given player.
[in] | player | Player to check. |
Definition at line 346 of file teamplay.qc.
Referenced by ClientCommand_clientversion(), ClientCommand_selectteam(), GameCommand_moveplayer(), nJoinAllowed(), and PlayerPreThink().
Returns whether player has real forced team.
Spectator team is ignored.
[in] | player | Player to check. |
Definition at line 341 of file teamplay.qc.
References TEAM_FORCE_DEFAULT.
Referenced by Player_DetermineForcedTeam(), ShowTeamSelection(), shuffleteams(), TeamBalance_GetTeamCounts(), and TeamBalance_JoinBestTeam().
Sets the index of the forced team of the given player.
[in,out] | player | Player to adjust. |
[in] | team_index | Index of the team to set. |
Definition at line 351 of file teamplay.qc.
References LOG_FATAL, TEAM_FORCE_DEFAULT, TEAM_FORCE_SPECTATOR, and Team_IsValidIndex().
Referenced by GameCommand_moveplayer(), minigame_addplayer(), and player_clear_minigame().
Sets the team of the player using its index.
[in,out] | player | Player to adjust. |
[in] | index | Index of the team to set. |
Definition at line 205 of file teamplay.qc.
References MUTATOR_CALLHOOK, SetPlayerColors(), Team_IndexToTeam(), and Team_TeamToIndex().
Referenced by SetPlayerTeam().
Sets the team of the player with all sanity checks.
[in,out] | player | Player to adjust. |
[in] | team_index | Index of the team to set. |
Definition at line 276 of file teamplay.qc.
References autocvar_g_balance_teams, autocvar_g_balance_teams_prevent_imbalance, autocvar_g_campaign, autocvar_g_changeteam_banned, CS(), entity(), SetPlayerTeam(), TEAM_CHANGE_MANUAL, Team_IndexToBit(), Team_IsValidIndex(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_FindBestTeams(), TeamBalance_GetTeamCounts(), TeamBalance_IsTeamAllowedInternal(), teamplay, and wasplayer.
Referenced by ClientKill_Now_TeamChange(), and SV_ChangeTeam().
Definition at line 161 of file teamplay.qc.
References clientcolors, and team.
Referenced by SetPlayerColors().
Definition at line 191 of file teamplay.qc.
References setcolor(), and teamplay.
Referenced by Player_SetTeamIndex(), and SV_ChangeTeam().
Sets the team of the player.
[in,out] | player | Player to adjust. |
[in] | team_index | Index of the team to set. |
[in] | type | Type of the team change. See TEAM_CHANGE constants. |
Definition at line 237 of file teamplay.qc.
References APP_TEAM_NUM, autocvar_sv_maxidle_playertospectator, CPID_IDLING, CS(), Entity_GetTeamIndex(), FRAGS_SPECTATOR, IS_BOT_CLIENT, just_joined, KillPlayerForTeamChange(), LogTeamChange(), NULL, Player_SetTeamIndex(), PlayerScore_Clear(), TeamBalance_AutoBalanceBots(), and time.
Referenced by bot_clientconnect(), MoveToTeam(), Player_SetTeamIndexChecked(), PutObserverInServer(), TeamBalance_AutoBalanceBots(), and TeamBalance_JoinBestTeam().
Called when the player changes color with the "color" command.
Note that the "color" command is always called early on player connection
[in,out] | player | Player that requested a new color. |
[in] | new_color | Requested color. |
Definition at line 1151 of file teamplay.qc.
References IS_CLIENT, Player_SetTeamIndexChecked(), SetPlayerColors(), Team_TeamToIndex(), and teamplay.
Returns the number of alive players in a team.
[in] | team_ent | Team entity. |
Definition at line 85 of file teamplay.qc.
Referenced by CA_CheckTeams(), CA_count_alive_players(), freezetag_CheckTeams(), freezetag_count_alive_players(), and MUTATOR_HOOKFUNCTION().
int Team_GetNumberOfAliveTeams | ( | ) |
Returns the number of alive teams.
Definition at line 110 of file teamplay.qc.
References g_team_entities, m_num_players_alive, NUM_TEAMS, and result.
Referenced by CA_CheckTeams(), and freezetag_CheckTeams().
Returns the number of items owned by a team.
[in] | team_ent | Team entity. |
Definition at line 138 of file teamplay.qc.
Referenced by Domination_count_controlpoints(), and Onslaught_count_generators().
int Team_GetNumberOfTeamsWithOwnedItems | ( | ) |
Returns the number of teams that own items.
Definition at line 148 of file teamplay.qc.
References g_team_entities, m_num_owned_items, NUM_TEAMS, and result.
Returns the global team entity that corresponds to the given TEAM_NUM value.
[in] | team_num | Team value. See TEAM_NUM constants. |
Definition at line 66 of file teamplay.qc.
References g_team_entities, LOG_FATALF, Team_IsValidTeam(), and Team_TeamToIndex().
Returns the global team entity at the given index.
[in] | index | Index of the team. |
Definition at line 57 of file teamplay.qc.
References g_team_entities, LOG_FATALF, and Team_IsValidIndex().
Referenced by CA_CheckTeams(), CA_count_alive_players(), Domination_count_controlpoints(), Entity_GetTeam(), freezetag_CheckTeams(), freezetag_count_alive_players(), Onslaught_count_generators(), WinningCondition_RanOutOfSpawns(), and WinningCondition_Scores().
Returns the score of the team.
[in] | team_ent | Team entity. |
Definition at line 75 of file teamplay.qc.
Referenced by WinningCondition_RanOutOfSpawns().
int Team_GetWinnerAliveTeam | ( | ) |
Returns the winner team.
Definition at line 95 of file teamplay.qc.
References g_team_entities, m_num_players_alive, NUM_TEAMS, and Team_IndexToTeam().
Referenced by CA_CheckWinner(), and freezetag_CheckWinner().
Returns the winner team.
[in] | min_owned_items | Minimum number of items the winner team must have. |
Definition at line 123 of file teamplay.qc.
References g_team_entities, m_num_owned_items, NUM_TEAMS, and Team_IndexToTeam().
Referenced by Domination_CheckWinner(), and Onslaught_CheckWinner().
void Team_InitTeams | ( | ) |
Definition at line 47 of file teamplay.qc.
References g_team_entities, new_pure, and NUM_TEAMS.
Referenced by GameRules_teams().
Sets the number of alive players in a team.
[in,out] | team_ent | Team entity. |
[in] | number | Number of players to set. |
Definition at line 90 of file teamplay.qc.
References number.
Referenced by CA_count_alive_players(), and freezetag_count_alive_players().
Sets the number of items owned by a team.
[in,out] | team_ent | Team entity. |
[in] | number | Number of items to set. |
Definition at line 143 of file teamplay.qc.
References number.
Referenced by Domination_count_controlpoints(), and Onslaught_count_generators().
Sets the score of the team.
[in,out] | team_ent | Team entity. |
[in] | score | Score to set. |
Definition at line 80 of file teamplay.qc.
Referenced by WinningCondition_RanOutOfSpawns(), and WinningCondition_Scores().
void TeamBalance_AutoBalanceBots | ( | ) |
Switches a bot from one team to another if teams are not balanced.
Definition at line 897 of file teamplay.qc.
References BITS, entity(), NULL, NUM_TEAMS, SetPlayerTeam(), TEAM_CHANGE_AUTO, Team_IndexToBit(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetLargestTeamIndex(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), TeamBalanceTeam_GetNumberOfPlayers(), TeamBalanceTeam_IsAllowed(), and teams.
Referenced by SetPlayerTeam().
Bans team change to all teams except the given one.
[in,out] | balance | Team balance entity. |
[in] | index | Index of the team. |
Definition at line 1069 of file teamplay.qc.
References NUM_TEAMS, and TEAM_NOT_ALLOWED.
Referenced by TeamBalance_CheckAllowedTeams().
Checks whether the player can join teams according to global configuration and mutator settings.
[in] | for_whom | Player to check for. Pass NULL for global rules. |
Definition at line 487 of file teamplay.qc.
References autocvar_bot_vs_human, AvailableTeams(), BIT, classname, entity(), find(), g_team_entities, IS_BOT_CLIENT, M_ARGV, MUTATOR_CALLHOOK, NULL, NUM_TEAMS, setthink, spawn(), string_null, TEAM_BALANCE_TEAMS_CHECKED, Team_IsValidTeam(), TEAM_NOT_ALLOWED, TeamBalance_BanTeamsExcept(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeam(), TeamBalance_IsTeamAllowedInternal(), and time.
Referenced by adjust_respawntime(), bot_removefromlargestteam(), bot_setnameandstuff(), ClientCommand_selectteam(), ClientConnect(), dom_DelayedInit(), GameCommand_moveplayer(), ons_ScoreRules(), Player_SetTeamIndexChecked(), ScoreRules_generic(), shuffleteams(), TeamBalance_AutoBalanceBots(), TeamBalance_CheckAllowedTeams(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_JoinBestTeam(), and WinningCondition_RanOutOfSpawns().
int TeamBalance_CompareTeams | ( | entity | balance, |
int | team_index_a, | ||
int | team_index_b, | ||
entity | player, | ||
bool | use_score | ||
) |
Compares two teams for the purposes of game balance.
[in] | balance | Team balance entity. |
[in] | team_index_a | Index of the first team. |
[in] | team_index_b | Index of the second team. |
[in] | player | Player to check. |
[in] | use_score | Whether to take into account team scores. |
Definition at line 866 of file teamplay.qc.
References entity(), LOG_FATAL, LOG_FATALF, NULL, TEAM_BALANCE_TEAM_COUNTS_FILLED, Team_IsValidIndex(), TeamBalance_CompareTeamsInternal(), TeamBalance_GetTeamFromIndex(), and TEAMS_COMPARE_EQUAL.
Referenced by TeamBalance_FindBestTeams().
int TeamBalance_CompareTeamsInternal | ( | entity | team_a, |
entity | team_index_b, | ||
entity | player, | ||
bool | use_score | ||
) |
Compares two teams for the purposes of game balance.
[in] | team_a | First team. |
[in] | team_b | Second team. |
[in] | player | Player to check. |
[in] | use_score | Whether to take into account team scores. |
Definition at line 1109 of file teamplay.qc.
References bots_would_leave, IS_REAL_CLIENT, TeamBalanceTeam_IsAllowed(), TEAMS_COMPARE_EQUAL, TEAMS_COMPARE_GREATER, TEAMS_COMPARE_INVALID, and TEAMS_COMPARE_LESS.
Referenced by TeamBalance_CompareTeams().
Destroy the team balance entity.
[in,out] | balance | Team balance entity to destroy. |
Definition at line 627 of file teamplay.qc.
References NULL, and NUM_TEAMS.
Referenced by adjust_respawntime(), bot_setnameandstuff(), ClientCommand_selectteam(), ClientConnect(), dom_DelayedInit(), GameCommand_moveplayer(), ons_ScoreRules(), Player_SetTeamIndexChecked(), ScoreRules_generic(), shuffleteams(), TeamBalance_AutoBalanceBots(), TeamBalance_CheckAllowedTeams(), TeamBalance_GetPlayerForTeamSwitch(), and TeamBalance_JoinBestTeam().
Finds the team that will make the game most balanced if the player joins it.
[in] | balance | Team balance entity. |
[in] | player | Player to check. |
[in] | ignore_player | ??? |
Definition at line 783 of file teamplay.qc.
References LOG_FATAL, LOG_FATALF, MapInfo_CurrentGametype(), MapInfo_Type_ToString(), NULL, NUM_TEAMS, RandomSelection_AddFloat, RandomSelection_chosen_float, RandomSelection_Init(), TEAM_BALANCE_UNINITIALIZED, Team_IndexToBit(), TeamBalance_FindBestTeams(), and TeamBalance_GetTeamCounts().
Referenced by GameCommand_moveplayer(), and TeamBalance_JoinBestTeam().
Returns the bitmask of the teams that will make the game most balanced if the player joins any of them.
[in] | balance | Team balance entity. |
[in] | player | Player to check. |
[in] | use_score | Whether to take into account team scores. |
Definition at line 820 of file teamplay.qc.
References LOG_FATAL, M_ARGV, MUTATOR_CALLHOOK, NULL, NUM_TEAMS, TEAM_BALANCE_TEAM_COUNTS_FILLED, Team_IndexToBit(), TeamBalance_CompareTeams(), TeamBalance_FindBestTeams(), TeamBalance_IsTeamAllowedInternal(), TEAMS_COMPARE_EQUAL, and TEAMS_COMPARE_LESS.
Referenced by ClientCommand_selectteam(), Player_SetTeamIndexChecked(), TeamBalance_FindBestTeam(), and TeamBalance_FindBestTeams().
Returns the bitmask of allowed teams.
[in] | balance | Team balance entity. |
Definition at line 640 of file teamplay.qc.
References LOG_FATAL, NULL, NUM_TEAMS, result, TEAM_BALANCE_UNINITIALIZED, Team_IndexToBit(), and TeamBalance_IsTeamAllowedInternal().
Referenced by ClientConnect(), dom_DelayedInit(), ons_ScoreRules(), and ScoreRules_generic().
Returns the index of the team with most players that is contained in the given bitmask of teams.
[in] | balance | Team balance entity. |
[in] | teams | Bitmask of teams to search in. |
Definition at line 967 of file teamplay.qc.
References entity(), NUM_TEAMS, Team_IndexToBit(), TeamBalance_GetTeamFromIndex(), TeamBalanceTeam_GetNumberOfPlayers(), and TeamBalanceTeam_IsAllowed().
Referenced by TeamBalance_AutoBalanceBots().
Returns the number of players (both humans and bots) in a team.
[in] | balance | Team balance entity. |
[in] | index | Index of the team. |
Definition at line 763 of file teamplay.qc.
References LOG_FATAL, LOG_FATALF, NULL, TEAM_BALANCE_TEAM_COUNTS_FILLED, and Team_IsValidIndex().
Referenced by adjust_respawntime(), and bot_setnameandstuff().
entity TeamBalance_GetPlayerForTeamSwitch | ( | int | source_team_index, |
int | destination_team_index, | ||
bool | is_bot | ||
) |
Returns the player who is the most suitable for switching between the given teams.
[in] | source_team_index | Index of the team to search in. |
[in] | destination_team_index | Index of the team to switch to. |
[in] | is_bot | True to search for bot, false for human. |
Definition at line 997 of file teamplay.qc.
References entity(), Entity_GetTeamIndex(), FLOAT_MAX, FOREACH_CLIENT, IS_BOT_CLIENT, M_ARGV, MUTATOR_CALLHOOK, NULL, PlayerScore_Get, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetPlayerForTeamSwitch(), and TeamBalance_IsTeamAllowed().
Referenced by TeamBalance_AutoBalanceBots(), and TeamBalance_GetPlayerForTeamSwitch().
Returns the team entity of the team balance entity that corresponds to the given TEAM_NUM value.
[in] | balance | Team balance entity. |
[in] | team_num | Team value. See TEAM_NUM constants. |
Definition at line 1089 of file teamplay.qc.
References Team_TeamToIndex(), and TeamBalance_GetTeamFromIndex().
Referenced by TeamBalance_CheckAllowedTeams(), and TeamBalance_GetTeamCounts().
Counts the number of players and various other information about each team.
[in,out] | balance | Team balance entity. |
[in] | ignore | Player to ignore. This is useful if you plan to switch the player's team. Pass NULL for global information. |
Definition at line 681 of file teamplay.qc.
References autocvar_g_campaign, autocvar_g_campaign_forceteam, entity(), FOREACH_CLIENT, INGAME, IS_BOT_CLIENT, IS_CLIENT, LOG_FATAL, M_ARGV, MUTATOR_CALLHOOK, NULL, NUM_TEAMS, Player_HasRealForcedTeam(), TEAM_BALANCE_TEAM_COUNTS_FILLED, TEAM_BALANCE_UNINITIALIZED, Team_IndexToTeam(), Team_IsValidIndex(), Team_IsValidTeam(), TeamBalance_GetTeam(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), and TeamBalanceTeam_IsAllowed().
Referenced by adjust_respawntime(), bot_removefromlargestteam(), bot_setnameandstuff(), ClientCommand_selectteam(), Player_SetTeamIndexChecked(), TeamBalance_AutoBalanceBots(), TeamBalance_FindBestTeam(), and TeamBalance_GetTeamCounts().
Returns the team entity of the team balance entity at the given index.
[in] | balance | Team balance entity. |
[in] | index | Index of the team. |
Definition at line 1080 of file teamplay.qc.
References LOG_FATALF, and Team_IsValidIndex().
Referenced by TeamBalance_AutoBalanceBots(), TeamBalance_CompareTeams(), TeamBalance_GetLargestTeamIndex(), TeamBalance_GetTeam(), and TeamBalance_GetTeamCounts().
Returns whether the team change to the specified team is allowed.
[in] | balance | Team balance entity. |
[in] | index | Index of the team. |
Definition at line 662 of file teamplay.qc.
References LOG_FATAL, LOG_FATALF, NULL, TEAM_BALANCE_UNINITIALIZED, Team_IsValidIndex(), and TeamBalance_IsTeamAllowedInternal().
Referenced by adjust_respawntime(), GameCommand_moveplayer(), shuffleteams(), TeamBalance_GetPlayerForTeamSwitch(), and WinningCondition_RanOutOfSpawns().
Returns whether the team change to the specified team is allowed.
[in] | balance | Team balance entity. |
[in] | index | Index of the team. |
Definition at line 1063 of file teamplay.qc.
References TEAM_NOT_ALLOWED.
Referenced by Player_SetTeamIndexChecked(), TeamBalance_CheckAllowedTeams(), TeamBalance_FindBestTeams(), TeamBalance_GetAllowedTeams(), TeamBalance_IsTeamAllowed(), and TeamBalance_JoinBestTeam().
Assigns the given player to a team that will make the game most balanced.
[in,out] | player | Player to assign. |
Definition at line 451 of file teamplay.qc.
References entity(), Player_HasRealForcedTeam(), SetPlayerTeam(), TEAM_CHANGE_AUTO, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_FindBestTeam(), TeamBalance_IsTeamAllowedInternal(), and teamplay.
Referenced by bot_clientconnect(), ClientKill_Now_TeamChange(), Join(), and PutPlayerInServer().
Returns the number of bots in a team.
[in] | team_ent | Team entity. |
Definition at line 1104 of file teamplay.qc.
Returns the number of players (both humans and bots) in a team.
[in] | team_ent | Team entity. |
Definition at line 1099 of file teamplay.qc.
Referenced by TeamBalance_AutoBalanceBots(), and TeamBalance_GetLargestTeamIndex().
Returns whether the team is allowed.
[in] | team_ent | Team entity. |
Definition at line 1094 of file teamplay.qc.
References TEAM_NOT_ALLOWED.
Referenced by TeamBalance_AutoBalanceBots(), TeamBalance_CompareTeamsInternal(), TeamBalance_GetLargestTeamIndex(), and TeamBalance_GetTeamCounts().
string autocvar_g_forced_team_blue |
Definition at line 41 of file teamplay.qc.
Referenced by Player_DetermineForcedTeam().
string autocvar_g_forced_team_pink |
Definition at line 43 of file teamplay.qc.
Referenced by Player_DetermineForcedTeam().
string autocvar_g_forced_team_red |
Definition at line 40 of file teamplay.qc.
Referenced by Player_DetermineForcedTeam().
string autocvar_g_forced_team_yellow |
Definition at line 42 of file teamplay.qc.
Referenced by Player_DetermineForcedTeam().
Holds global team entities.
Definition at line 45 of file teamplay.qc.
Referenced by Team_GetNumberOfAliveTeams(), Team_GetNumberOfTeamsWithOwnedItems(), Team_GetTeam(), Team_GetTeamFromIndex(), Team_GetWinnerAliveTeam(), Team_GetWinnerTeam_WithOwnedItems(), Team_InitTeams(), and TeamBalance_CheckAllowedTeams().
int m_num_bots |
Number of bots in a team.
Definition at line 36 of file teamplay.qc.
int m_num_owned_items |
Number of items owned by a team.
Definition at line 38 of file teamplay.qc.
Referenced by Team_GetNumberOfTeamsWithOwnedItems(), and Team_GetWinnerTeam_WithOwnedItems().
int m_num_players |
Number of players (both humans and bots) in a team.
Definition at line 35 of file teamplay.qc.
int m_num_players_alive |
Number of alive players in a team.
Definition at line 37 of file teamplay.qc.
Referenced by Team_GetNumberOfAliveTeams(), and Team_GetWinnerAliveTeam().
int m_team_balance_state |
Holds the state of the team balance entity.
Definition at line 31 of file teamplay.qc.
???
Definition at line 32 of file teamplay.qc.
float m_team_score |
The score of the team.
Definition at line 34 of file teamplay.qc.
const int TEAM_NOT_ALLOWED = -1 |
Indicates that the player is not allowed to join a team.
Definition at line 29 of file teamplay.qc.
Referenced by TeamBalance_BanTeamsExcept(), TeamBalance_CheckAllowedTeams(), TeamBalance_IsTeamAllowedInternal(), and TeamBalanceTeam_IsAllowed().