|
Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
|
|
Go to the source code of this file.
Enumerations | |
| enum | { TEAM_CHANGE_AUTO = 2 , TEAM_CHANGE_MANUAL = 3 , TEAM_CHANGE_SPECTATOR = 4 } |
| enum | { TEAMS_COMPARE_INVALID , TEAMS_COMPARE_LESS , TEAMS_COMPARE_EQUAL , TEAMS_COMPARE_GREATER } |
| Describes the result of comparing teams. More... | |
| enum | { TEAM_FORCE_SPECTATOR = -1 , TEAM_FORCE_DEFAULT = 0 } |
Functions | |
| entity | Entity_GetTeam (entity this) |
| Returns the team entity of the given entity. | |
| int | Entity_GetTeamIndex (entity this) |
| Returns the team index of the given entity. | |
| bool | Entity_HasValidTeam (entity this) |
| Returns whether the given entity belongs to a valid team. | |
| void | KillPlayerForTeamChange (entity player) |
| Kills player as a result of team change. | |
| 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. | |
| void | Player_DetermineForcedTeam (entity player) |
| Determines the forced team of the player using current global config. | |
| int | Player_GetForcedTeamIndex (entity player) |
| Returns the index of the forced team of the given player. | |
| bool | Player_HasRealForcedTeam (entity player) |
| Returns whether player has real forced team. | |
| void | Player_SetForcedTeamIndex (entity player, int team_index) |
| Sets the index of the forced team of the given player. | |
| bool | Player_SetTeamIndex (entity player, int index) |
| Sets the team of the player using its index. | |
| bool | QueuedPlayersReady (entity this, bool checkspecificteam) |
| Returns true when enough players are queued that the next will join directly to the only available team (also triggering the joins of the queued players). | |
| bool | QueueNeeded (entity ignore) |
| 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. | |
| void | SV_ChangeTeam (entity player, int new_color) |
| Called when the player changes color with the "color" command. | |
| int | Team_GetNumberOfAlivePlayers (entity team_ent) |
| Returns the number of alive players in a team. | |
| int | Team_GetNumberOfAliveTeams () |
| Returns the number of alive teams. | |
| int | Team_GetNumberOfOwnedItems (entity team_ent) |
| Returns the number of items owned by a team. | |
| int | Team_GetNumberOfTeamsWithOwnedItems () |
| Returns the number of teams that own items. | |
| entity | Team_GetTeam (int team_num) |
| Returns the global team entity that corresponds to the given TEAM_NUM value. | |
| entity | Team_GetTeamFromIndex (int index) |
| Returns the global team entity at the given index. | |
| float | Team_GetTeamScore (entity team_ent) |
| Returns the score of the team. | |
| int | Team_GetWinnerAliveTeam () |
| Returns the winner team. | |
| int | Team_GetWinnerTeam_WithOwnedItems (int min_owned_items) |
| Returns the winner team. | |
| void | Team_InitTeams () |
| void | Team_SetNumberOfAlivePlayers (entity team_ent, int number) |
| Sets the number of alive players in a team. | |
| void | Team_SetNumberOfOwnedItems (entity team_ent, int number) |
| Sets the number of items owned by a team. | |
| void | Team_SetTeamScore (entity team_ent, float score) |
| Sets the score of the team. | |
| bool | TeamBalance_AreEqual (entity ignore, bool would_leave) |
| void | TeamBalance_AutoBalanceBots () |
| Switches a bot from one team to another if teams are not balanced. | |
| void | TeamBalance_BanTeamsExcept (entity balance, int index) |
| Bans team change to all teams except the given one. | |
| entity | TeamBalance_CheckAllowedTeams (entity for_whom) |
| Checks whether the player can join teams according to global configuration and mutator settings. | |
| 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. | |
| int | TeamBalance_CompareTeamsInternal (entity team_a, entity team_index_b, entity player, bool use_score) |
| Compares two teams for the purposes of game balance. | |
| void | TeamBalance_Destroy (entity balance) |
| Destroy the team balance entity. | |
| 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_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. | |
| int | TeamBalance_GetAllowedTeams (entity balance) |
| Returns the bitmask of allowed teams. | |
| 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. | |
| int | TeamBalance_GetNumberOfPlayers (entity balance, int index) |
| Returns the number of players (both humans and bots) in a team. | |
| 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. | |
| 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. | |
| void | TeamBalance_GetTeamCounts (entity balance, entity ignore) |
| Counts the number of players and various other information about each team. | |
| entity | TeamBalance_GetTeamFromIndex (entity balance, int index) |
| Returns the team entity of the team balance entity at the given index. | |
| bool | TeamBalance_IsTeamAllowed (entity balance, int index) |
| Returns whether the team change to the specified team is allowed. | |
| bool | TeamBalance_IsTeamAllowedInternal (entity balance, int index) |
| Returns whether the team change to the specified team is allowed. | |
| void | TeamBalance_JoinBestTeam (entity player) |
| Assigns the given player to a team that will make the game most balanced. | |
| bool | TeamBalance_QueuedPlayersTagIn (entity ignore) |
| Joins queued player(s) to team(s) with a shortage, this should be more robust than only replacing the player that left. | |
| void | TeamBalance_RemoveExcessPlayers (entity ignore) |
| int | TeamBalance_SizeDifference (entity ignore) |
| Returns the size difference between the largest and smallest team (bots included). | |
| int | TeamBalanceTeam_GetNumberOfBots (entity team_ent) |
| Returns the number of bots in a team. | |
| int | TeamBalanceTeam_GetNumberOfPlayers (entity team_ent) |
| Returns the number of players (both humans and bots) in a team. | |
| bool | TeamBalanceTeam_IsAllowed (entity team_ent) |
| Returns whether the team is allowed. | |
| anonymous enum |
| Enumerator | |
|---|---|
| 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? |
Definition at line 112 of file teamplay.qh.
| anonymous enum |
Describes the result of comparing teams.
Definition at line 245 of file teamplay.qh.
| anonymous enum |
| Enumerator | |
|---|---|
| TEAM_FORCE_SPECTATOR | Force the player to spectator team. |
| TEAM_FORCE_DEFAULT | Don't force any team. |
Definition at line 135 of file teamplay.qh.
Returns the team entity of the given entity.
| [in] | this | Entity to check. |
Definition at line 186 of file teamplay.qc.
References entity(), Entity_GetTeamIndex(), NULL, Team_GetTeamFromIndex(), and Team_IsValidIndex().
Referenced by CA_count_alive_players(), Domination_count_controlpoints(), freezetag_count_alive_players(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), and Onslaught_count_generators().
Returns the team index of the given entity.
| [in] | this | Entity to check. |
Definition at line 181 of file teamplay.qc.
References entity(), 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 176 of file teamplay.qc.
References entity(), team, and Team_IsValidTeam().
Referenced by CA_count_alive_players(), CA_PreventStalemate(), 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 1213 of file teamplay.qc.
References Damage(), DMG_NOWEP, entity(), IS_DEAD, and MUTATOR_CALLHOOK.
Referenced by SetPlayerTeam().
Definition at line 1200 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 299 of file teamplay.qc.
References entity(), lockteams, and SetPlayerTeam().
Referenced by GameCommand_moveplayer(), MatchEnd_RestoreSpectatorAndTeamStatus(), and shuffleteams().
Determines the forced team of the player using current global config.
| [in,out] | player | Player to adjust. |
Definition at line 348 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, entity(), 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 318 of file teamplay.qc.
References entity().
Referenced by ClientCommand_clientversion(), ClientCommand_selectteam(), GameCommand_moveplayer(), joinAllowed(), and PlayerPreThink().
Returns whether player has real forced team.
Spectator team is ignored.
| [in] | player | Player to check. |
Definition at line 313 of file teamplay.qc.
References entity(), and 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 323 of file teamplay.qc.
References entity(), LOG_FATAL, TEAM_FORCE_DEFAULT, TEAM_FORCE_SPECTATOR, and Team_IsValidIndex().
Referenced by GameCommand_moveplayer(), MatchEnd_RestoreSpectatorAndTeamStatus(), 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 210 of file teamplay.qc.
References entity(), MUTATOR_CALLHOOK, SetPlayerColors(), Team_IndexToTeam(), and Team_TeamToIndex().
Referenced by SetPlayerTeam().
Returns true when enough players are queued that the next will join directly to the only available team (also triggering the joins of the queued players).
Optionally only counts players who selected a specific team when joining the queue.
Definition at line 238 of file teamplay.qc.
References entity(), FOREACH_CLIENT, IS_REAL_CLIENT, and LOG_DEBUG.
Referenced by ShowTeamSelection().
Definition at line 1325 of file teamplay.qc.
References autocvar_g_balance_teams_queue, autocvar_g_campaign, entity(), FOREACH_CLIENT, IS_REAL_CLIENT, TeamBalance_AreEqual(), teamplay, and warmup_stage.
Referenced by joinAllowed().
Definition at line 161 of file teamplay.qc.
References clientcolors, entity(), team, and teamplay.
Definition at line 196 of file teamplay.qc.
References entity(), 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 255 of file teamplay.qc.
References APP_TEAM_NUM, autocvar_sv_maxidle_playertospectator, CPID_IDLING, CS(), entity(), Entity_GetTeamIndex(), FRAGS_SPECTATOR, IS_BOT_CLIENT, just_joined, Kill_Notification(), KillPlayerForTeamChange(), LogTeamChange(), NULL, Player_SetTeamIndex(), PlayerScore_Clear(), ReadyCount(), Send_Notification(), TeamBalance_AutoBalanceBots(), and warmup_stage.
Referenced by ClientKill_Now_TeamChange(), MoveToTeam(), PutObserverInServer(), PutPlayerInServer(), TeamBalance_AutoBalanceBots(), and TeamBalance_JoinBestTeam().
Called when the player changes color with the "color" command.
| [in,out] | player | Player that requested a new color. |
| [in] | new_color | Requested color. |
Definition at line 1319 of file teamplay.qc.
References entity(), SetPlayerColors(), and teamplay.
Returns the number of alive players in a team.
| [in] | team_ent | Team entity. |
Definition at line 85 of file teamplay.qc.
References entity().
Referenced by CA_CheckTeams(), CA_count_alive_players(), CA_PreventStalemate(), freezetag_CheckTeams(), freezetag_count_alive_players(), MUTATOR_HOOKFUNCTION(), 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.
References entity().
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 entity(), g_team_entities, LOG_FATALF, Team_IsValidTeam(), and Team_TeamToIndex().
Referenced by CA_PreventStalemate(), and WinningCondition_RanOutOfSpawns().
Returns the global team entity at the given index.
| [in] | index | Index of the team. |
Definition at line 57 of file teamplay.qc.
References entity(), g_team_entities, LOG_FATALF, and Team_IsValidIndex().
Referenced by CA_CheckTeams(), CA_count_alive_players(), CA_PreventStalemate(), 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.
References entity().
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 entity(), and 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 entity(), and 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.
References entity().
Referenced by WinningCondition_RanOutOfSpawns(), and WinningCondition_Scores().
Definition at line 656 of file teamplay.qc.
References AVAILABLE_TEAMS, bots_would_leave, entity(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeamCounts(), and TeamBalance_GetTeamFromIndex().
Referenced by Join(), QueueNeeded(), and Remove_Countdown().
| void TeamBalance_AutoBalanceBots | ( | ) |
Switches a bot from one team to another if teams are not balanced.
Definition at line 1059 of file teamplay.qc.
References BITS, entity(), intermission_running, 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 1233 of file teamplay.qc.
References entity(), 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 459 of file teamplay.qc.
References autocvar_bot_vs_human, AVAILABLE_TEAMS, 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(), ClientKill_TeamChange(), dom_DelayedInit(), GameCommand_moveplayer(), MUTATOR_HOOKABLE(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), ons_ScoreRules(), ScoreRules_generic(), shuffleteams(), TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_CheckAllowedTeams(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_JoinBestTeam(), TeamBalance_QueuedPlayersTagIn(), TeamBalance_RemoveExcessPlayers(), TeamBalance_SizeDifference(), 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 1029 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 1273 of file teamplay.qc.
References bots_would_leave, ceil(), entity(), IS_REAL_CLIENT, min(), 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 599 of file teamplay.qc.
References entity(), NULL, and NUM_TEAMS.
Referenced by adjust_respawntime(), bot_setnameandstuff(), ClientCommand_selectteam(), ClientConnect(), ClientKill_TeamChange(), dom_DelayedInit(), GameCommand_moveplayer(), ons_ScoreRules(), ScoreRules_generic(), shuffleteams(), TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_CheckAllowedTeams(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_JoinBestTeam(), TeamBalance_QueuedPlayersTagIn(), TeamBalance_RemoveExcessPlayers(), and TeamBalance_SizeDifference().
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 944 of file teamplay.qc.
References entity(), GetGametype(), LOG_FATAL, LOG_FATALF, NULL, NUM_TEAMS, RandomSelection_AddFloat, RandomSelection_chosen_float, RandomSelection_Init(), TEAM_BALANCE_UNINITIALIZED, Team_IndexToBit(), Team_TeamToBit(), Team_TeamToIndex(), TeamBalance_FindBestTeams(), and TeamBalance_GetTeamCounts().
Referenced by ClientKill_TeamChange(), 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 984 of file teamplay.qc.
References entity(), 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(), MUTATOR_HOOKABLE(), TeamBalance_FindBestTeam(), and TeamBalance_FindBestTeams().
Returns the bitmask of allowed teams.
| [in] | balance | Team balance entity. |
Definition at line 612 of file teamplay.qc.
References entity(), 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 1131 of file teamplay.qc.
References entity(), NUM_TEAMS, Team_IndexToBit(), TeamBalance_GetTeamFromIndex(), TeamBalanceTeam_GetNumberOfPlayers(), TeamBalanceTeam_IsAllowed(), and teams.
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 927 of file teamplay.qc.
References entity(), 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 1161 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 MUTATOR_HOOKABLE(), 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 1253 of file teamplay.qc.
References entity(), Team_TeamToIndex(), and TeamBalance_GetTeamFromIndex().
Referenced by TeamBalance_CheckAllowedTeams(), TeamBalance_GetTeamCounts(), and TeamBalance_QueuedPlayersTagIn().
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 846 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(), MUTATOR_HOOKABLE(), TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_FindBestTeam(), TeamBalance_GetTeamCounts(), TeamBalance_QueuedPlayersTagIn(), TeamBalance_RemoveExcessPlayers(), and TeamBalance_SizeDifference().
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 1244 of file teamplay.qc.
References entity(), LOG_FATALF, and Team_IsValidIndex().
Referenced by TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_CompareTeams(), TeamBalance_GetLargestTeamIndex(), TeamBalance_GetTeam(), TeamBalance_GetTeamCounts(), TeamBalance_QueuedPlayersTagIn(), TeamBalance_RemoveExcessPlayers(), and TeamBalance_SizeDifference().
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 826 of file teamplay.qc.
References entity(), LOG_FATAL, LOG_FATALF, NULL, TEAM_BALANCE_UNINITIALIZED, Team_IsValidIndex(), and TeamBalance_IsTeamAllowedInternal().
Referenced by adjust_respawntime(), ClientCommand_selectteam(), 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 1227 of file teamplay.qc.
References entity(), and TEAM_NOT_ALLOWED.
Referenced by 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 423 of file teamplay.qc.
References entity(), Player_HasRealForcedTeam(), SetPlayerTeam(), TEAM_CHANGE_AUTO, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_FindBestTeam(), TeamBalance_IsTeamAllowedInternal(), and teamplay.
Referenced by PutPlayerInServer().
Joins queued player(s) to team(s) with a shortage, this should be more robust than only replacing the player that left.
Chooses players with a specific team preference first to increase chances of everyone getting what they want. Returns true if the teams are now balanced.
Definition at line 775 of file teamplay.qc.
References AVAILABLE_TEAMS, bots_would_leave, ceil(), entity(), ftoe, Join(), maxclients, min(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeam(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), and teamplay.
Referenced by ClientDisconnect(), and ClientKill_Now_TeamChange().
Definition at line 712 of file teamplay.qc.
References autocvar_g_balance_teams_remove_wait, autocvar_g_campaign, AVAILABLE_TEAMS, CS(), entity(), FOREACH_CLIENT, INGAME, IS_REAL_CLIENT, min(), new_pure, NULL, playername(), PutObserverInServer(), Remove_Countdown(), remove_countdown, Send_Notification(), setthink, startplaytime, Team_IndexToTeam(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), and time.
Referenced by ClientDisconnect(), ClientKill_Now_TeamChange(), and Remove_Countdown().
Returns the size difference between the largest and smallest team (bots included).
Definition at line 633 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), teamplay, ts_max, and ts_min.
Referenced by ReadyCount().
Returns the number of bots in a team.
| [in] | team_ent | Team entity. |
Definition at line 1268 of file teamplay.qc.
References entity().
Returns the number of players (both humans and bots) in a team.
| [in] | team_ent | Team entity. |
Definition at line 1263 of file teamplay.qc.
References entity().
Referenced by TeamBalance_AutoBalanceBots(), and TeamBalance_GetLargestTeamIndex().
Returns whether the team is allowed.
| [in] | team_ent | Team entity. |
Definition at line 1258 of file teamplay.qc.
References entity(), and TEAM_NOT_ALLOWED.
Referenced by TeamBalance_AutoBalanceBots(), TeamBalance_CompareTeamsInternal(), TeamBalance_GetLargestTeamIndex(), and TeamBalance_GetTeamCounts().
| bool autocvar_g_balance_teams |
Definition at line 7 of file teamplay.qh.
Referenced by ClientCommand_clientversion(), PlayerPreThink(), and ShowTeamSelection().
| bool autocvar_g_balance_teams_prevent_imbalance |
Definition at line 8 of file teamplay.qh.
Referenced by ClientCommand_selectteam().
| bool autocvar_g_balance_teams_queue |
Definition at line 9 of file teamplay.qh.
Referenced by QueueNeeded().
| bool autocvar_g_balance_teams_remove |
Definition at line 10 of file teamplay.qh.
Referenced by ClientDisconnect(), and ClientKill_Now_TeamChange().
| int autocvar_g_balance_teams_remove_wait |
Definition at line 11 of file teamplay.qh.
Referenced by TeamBalance_RemoveExcessPlayers().
| string autocvar_g_forced_team_otherwise |
Definition at line 13 of file teamplay.qh.
Referenced by nJoinAllowed(), and Player_DetermineForcedTeam().
| bool autocvar_teamplay_lockonrestart |
Definition at line 5 of file teamplay.qh.
Referenced by ReadyRestart_force().
| int autocvar_teamplay_mode |
Definition at line 3 of file teamplay.qh.
Referenced by Damage().
| bool lockteams |
Definition at line 15 of file teamplay.qh.
Referenced by ClientCommand_selectteam(), GameCommand_lockteams(), GameCommand_unlockteams(), joinAllowed(), MoveToTeam(), nJoinAllowed(), ReadyRestart_force(), and SERVER_COMMAND().
| int team_forced |
Definition at line 17 of file teamplay.qh.