263 entity player,
bool use_score);
283 int destination_team_index,
bool is_bot);
287void LogTeamChange(
float player_id,
float team_number,
int type);
351 entity player,
bool use_score);
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool QueuedPlayersReady(entity this, bool checkspecificteam)
Returns true when enough players are queued that the next will join directly to the only available te...
bool TeamBalanceTeam_IsAllowed(entity team_ent)
Returns whether the team is allowed.
int autocvar_g_balance_teams_remove_wait
int Entity_GetTeamIndex(entity this)
Returns the team index of the given entity.
bool TeamBalance_QueuedPlayersTagIn(entity ignore)
Joins queued player(s) to team(s) with a shortage, this should be more robust than only replacing the...
int Team_GetNumberOfAlivePlayers(entity team_ent)
Returns the number of alive players in a team.
entity Team_GetTeam(int team_num)
Returns the global team entity that corresponds to the given TEAM_NUM value.
void TeamBalance_AutoBalanceBots()
Switches a bot from one team to another if teams are not balanced.
string autocvar_g_forced_team_otherwise
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
void TeamBalance_BanTeamsExcept(entity balance, int index)
Bans team change to all teams except the given one.
void TeamBalance_RemoveExcessPlayers(entity ignore)
bool autocvar_g_balance_teams_queue
entity Entity_GetTeam(entity this)
Returns the team entity of the given entity.
void Player_DetermineForcedTeam(entity player)
Determines the forced team of the player using current global config.
void TeamBalance_JoinBestTeam(entity player)
Assigns the given player to a team that will make the game most balanced.
bool Player_HasRealForcedTeam(entity player)
Returns whether player has real forced team.
void LogTeamChange(float player_id, float team_number, int type)
@ TEAM_FORCE_DEFAULT
Don't force any team.
@ TEAM_FORCE_SPECTATOR
Force the player to spectator team.
int TeamBalanceTeam_GetNumberOfPlayers(entity team_ent)
Returns the number of players (both humans and bots) in a team.
void Team_SetTeamScore(entity team_ent, float score)
Sets the score of the team.
bool QueueNeeded(entity ignore)
int TeamBalance_GetNumberOfPlayers(entity balance, int index)
Returns the number of players (both humans and bots) in a team.
bool SetPlayerTeam(entity player, int team_index, int type)
Sets the team of the player.
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.
bool Player_SetTeamIndex(entity player, int index)
Sets the team of the player using its index.
bool autocvar_g_balance_teams_remove
int TeamBalanceTeam_GetNumberOfBots(entity team_ent)
Returns the number of bots in a team.
int Team_GetNumberOfTeamsWithOwnedItems()
Returns the number of teams that own items.
int Team_GetWinnerAliveTeam()
Returns the winner team.
void Team_SetNumberOfOwnedItems(entity team_ent, int number)
Sets the number of items owned by a team.
void SetPlayerColors(entity player, float _color)
void TeamBalance_GetTeamCounts(entity balance, entity ignore)
Counts the number of players and various other information about each team.
int Team_GetNumberOfOwnedItems(entity team_ent)
Returns the number of items owned by a team.
int Player_GetForcedTeamIndex(entity player)
Returns the index of the forced team of the given player.
int Team_GetWinnerTeam_WithOwnedItems(int min_owned_items)
Returns the winner team.
int autocvar_teamplay_mode
@ TEAM_CHANGE_AUTO
The team was selected by autobalance.
@ TEAM_CHANGE_MANUAL
Player has manually selected their team.
@ TEAM_CHANGE_SPECTATOR
Player is joining spectators. //TODO: Remove?
bool TeamBalance_IsTeamAllowedInternal(entity balance, int index)
Returns whether the team change to the specified team is allowed.
float Team_GetTeamScore(entity team_ent)
Returns the score of the team.
bool Entity_HasValidTeam(entity this)
Returns whether the given entity belongs to a valid team.
bool autocvar_g_balance_teams_prevent_imbalance
int TeamBalance_GetAllowedTeams(entity balance)
Returns the bitmask of allowed teams.
bool autocvar_teamplay_lockonrestart
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
bool TeamBalance_IsTeamAllowed(entity balance, int index)
Returns whether the team change to the specified team is allowed.
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 the...
bool TeamBalance_AreEqual(entity ignore, bool would_leave)
int Team_GetNumberOfAliveTeams()
Returns the number of alive teams.
void KillPlayerForTeamChange(entity player)
Kills player as a result of team change.
void Team_SetNumberOfAlivePlayers(entity team_ent, int number)
Sets the number of alive players in a team.
entity Team_GetTeamFromIndex(int index)
Returns the global team entity at the given index.
int TeamBalance_CompareTeamsInternal(entity team_a, entity team_index_b, entity player, bool use_score)
Compares two teams for the purposes of game balance.
int TeamBalance_SizeDifference(entity ignore)
Returns the size difference between the largest and smallest team (bots included).
@ TEAMS_COMPARE_INVALID
One or both teams are invalid.
@ TEAMS_COMPARE_GREATER
First team the greater than the second one.
@ TEAMS_COMPARE_LESS
First team is less than the second one.
@ TEAMS_COMPARE_EQUAL
Both teams are equal.
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.
void Player_SetForcedTeamIndex(entity player, int team_index)
Sets the index of the forced team of the given player.
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.
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.
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.
entity TeamBalance_GetTeamFromIndex(entity balance, int index)
Returns the team entity of the team balance entity at the given index.
bool autocvar_g_balance_teams
bool MoveToTeam(entity client, int team_index, int type)
Moves player to the specified team.