|
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 client, int team_index) |
| 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 () |
| int | Team_MapEnts_FindOrSpawn (string ent_classname, int defaultmask) |
| Finds any team map entities and returns their bitmask, else spawns them. | |
| 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_CompareTeamsInternal (entity team_a, entity team_index_b, 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. | |
Variables | |
| bool | autocvar_g_balance_teams |
| bool | autocvar_g_balance_teams_prevent_imbalance |
| bool | autocvar_g_balance_teams_queue |
| bool | autocvar_g_balance_teams_remove |
| int | autocvar_g_balance_teams_remove_wait |
| int | autocvar_g_balance_teams_skill |
| float | autocvar_g_balance_teams_skill_significance_threshold |
| float | autocvar_g_balance_teams_skill_unranked_factor |
| string | autocvar_g_forced_team_otherwise |
| bool | autocvar_teamplay_lockonrestart |
| int | autocvar_teamplay_mode |
| bool | lockteams |
| float | m_skill_mu |
| Team: members' inverse-variance weighted skill mean. | |
| float | m_skill_var |
| Team: members' inverse-variance weighted skill variance (sigma**2). | |
| float | server_skill_average |
| Scaled inverse-variance weighted mean of all clients' m_skill_mu, for unranked clients. | |
| int | team_forced |
| can be a team number to force a team, or 0 for default action, or -1 for forced spectator | |
| int | teamplay_bitmask |
| The set of currently available teams (AVAILABLE_TEAMS is the number of them). | |
| 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 127 of file teamplay.qh.
| anonymous enum |
Describes the result of comparing teams.
Definition at line 260 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 150 of file teamplay.qh.
Returns the team entity of the given entity.
| [in] | this | Entity to check. |
Definition at line 215 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 210 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 205 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 1232 of file teamplay.qc.
References Damage(), DMG_NOWEP, entity(), IS_DEAD, and MUTATOR_CALLHOOK.
Referenced by SetPlayerTeam().
Definition at line 1219 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 328 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 377 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 347 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 342 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 352 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 239 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 267 of file teamplay.qc.
References entity(), FOREACH_CLIENT, IS_REAL_CLIENT, and LOG_DEBUG.
Referenced by ShowTeamSelection().
Definition at line 1333 of file teamplay.qc.
References autocvar_g_balance_teams_queue, autocvar_g_campaign, entity(), FOREACH_CLIENT, IS_REAL_CLIENT, Team_IndexToBit(), TeamBalance_AreEqual(), TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_FindBestTeams(), TeamBalance_GetTeamCounts(), teamplay, and warmup_stage.
Referenced by joinAllowed().
Definition at line 190 of file teamplay.qc.
References clientcolors, entity(), team, and teamplay.
Definition at line 225 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 284 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(), Join(), 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 1327 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 114 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 139 of file teamplay.qc.
References AVAILABLE_TEAMS, g_team_entities, m_num_players_alive, 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 167 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 177 of file teamplay.qc.
References AVAILABLE_TEAMS, g_team_entities, m_num_owned_items, 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 95 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 86 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 104 of file teamplay.qc.
References entity().
Referenced by WinningCondition_RanOutOfSpawns().
| int Team_GetWinnerAliveTeam | ( | ) |
Returns the winner team.
Definition at line 124 of file teamplay.qc.
References AVAILABLE_TEAMS, g_team_entities, m_num_players_alive, 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 152 of file teamplay.qc.
References AVAILABLE_TEAMS, g_team_entities, m_num_owned_items, and Team_IndexToTeam().
Referenced by Domination_CheckWinner(), and Onslaught_CheckWinner().
| void Team_InitTeams | ( | ) |
Definition at line 76 of file teamplay.qc.
References AVAILABLE_TEAMS, g_team_entities, and new_pure.
Referenced by ScoreRules_basics().
Finds any team map entities and returns their bitmask, else spawns them.
| [in] | ent_classname | The gametype-specific entity classname to search for. |
| [in] | defaultmask | The bitmask of the team entities to spawn if the map has none. |
Definition at line 56 of file teamplay.qc.
References _SpawnTeam(), classname, entity(), LOG_TRACEF, NUM_TEAMS, Team_IndexToBit(), Team_IndexToTeam(), Team_IsValidTeam(), Team_TeamToBit(), and teams.
Referenced by ctf_DelayedInit(), tdm_DelayedInit(), and tmayhem_DelayedInit().
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 119 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 172 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 109 of file teamplay.qc.
References entity().
Referenced by WinningCondition_RanOutOfSpawns(), and WinningCondition_Scores().
Definition at line 654 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), team_size, 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 1078 of file teamplay.qc.
References AVAILABLE_TEAMS, BITS, entity(), intermission_running, NULL, 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 1252 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), 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 488 of file teamplay.qc.
References autocvar_bot_vs_human, AVAILABLE_TEAMS, BIT, entity(), g_team_entities, IS_BOT_CLIENT, setthink, spawn, TEAM_BALANCE_TEAMS_CHECKED, TEAM_NOT_ALLOWED, TeamBalance_BanTeamsExcept(), TeamBalance_Destroy(), TeamBalance_IsTeamAllowedInternal(), teamplay_bitmask, and time.
Referenced by adjust_respawntime(), bot_removefromlargestteam(), bot_setnameandstuff(), ClientCommand_selectteam(), ClientConnect(), ClientKill_TeamChange(), GameCommand_moveplayer(), Join(), MUTATOR_HOOKABLE(), QueueNeeded(), shuffleteams(), TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_JoinBestTeam(), TeamBalance_QueuedPlayersTagIn(), TeamBalance_RemoveExcessPlayers(), TeamBalance_SizeDifference(), and WinningCondition_RanOutOfSpawns().
Compares two teams for the purposes of game balance.
| [in] | team_a | First team. |
| [in] | team_b | Second team. |
| [in] | use_score | Whether to take into account team scores and skill ratings. |
Definition at line 1292 of file teamplay.qc.
References autocvar_g_balance_teams_skill, autocvar_g_balance_teams_skill_significance_threshold, autocvar_timelimit, entity(), game_starttime, TEAMS_COMPARE_EQUAL, TEAMS_COMPARE_GREATER, TEAMS_COMPARE_LESS, time, and warmup_stage.
Referenced by TeamBalance_FindBestTeams().
Destroy the team balance entity.
| [in,out] | balance | Team balance entity to destroy. |
Definition at line 597 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), and NULL.
Referenced by adjust_respawntime(), bot_setnameandstuff(), ClientCommand_selectteam(), ClientConnect(), ClientKill_TeamChange(), GameCommand_moveplayer(), Join(), QueueNeeded(), 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 962 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), GetGametype(), LOG_FATAL, LOG_FATALF, NULL, 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(), Join(), 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 and skill ratings. |
Definition at line 1002 of file teamplay.qc.
References autocvar_g_balance_teams_skill, autocvar_g_balance_teams_skill_significance_threshold, autocvar_sv_teamnagger, AVAILABLE_TEAMS, entity(), fabs(), LOG_FATAL, M_ARGV, MUTATOR_CALLHOOK, NULL, server_skill_average, sqrt(), TEAM_BALANCE_TEAM_COUNTS_FILLED, Team_IndexToBit(), TeamBalance_CompareTeamsInternal(), TeamBalance_FindBestTeams(), TeamBalance_GetTeamFromIndex(), TeamBalance_IsTeamAllowedInternal(), TEAMS_COMPARE_EQUAL, TEAMS_COMPARE_LESS, and warmup_stage.
Referenced by ClientCommand_selectteam(), MUTATOR_HOOKABLE(), QueueNeeded(), TeamBalance_FindBestTeam(), and TeamBalance_FindBestTeams().
Returns the bitmask of allowed teams.
| [in] | balance | Team balance entity. |
Definition at line 610 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), LOG_FATAL, NULL, result, TEAM_BALANCE_UNINITIALIZED, Team_IndexToBit(), and TeamBalance_IsTeamAllowedInternal().
Referenced by ClientConnect().
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 1150 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), 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 945 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 1180 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 1272 of file teamplay.qc.
References entity(), Team_TeamToIndex(), and TeamBalance_GetTeamFromIndex().
Referenced by 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 827 of file teamplay.qc.
References autocvar_g_balance_teams_skill_unranked_factor, autocvar_g_campaign, autocvar_g_campaign_forceteam, AVAILABLE_TEAMS, bots_would_leave, ceil(), entity(), FOREACH_CLIENT, IS_BOT_CLIENT, LOG_FATAL, M_ARGV, min(), MUTATOR_CALLHOOK, NULL, Player_HasRealForcedTeam(), server_skill_average, 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(), QueueNeeded(), 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 1263 of file teamplay.qc.
References entity(), LOG_FATALF, and Team_IsValidIndex().
Referenced by TeamBalance_AreEqual(), TeamBalance_AutoBalanceBots(), TeamBalance_FindBestTeams(), 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 807 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 1246 of file teamplay.qc.
References AVAILABLE_TEAMS, 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 452 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 763 of file teamplay.qc.
References AVAILABLE_TEAMS, entity(), ftoe, Join(), maxclients, TeamBalance_CheckAllowedTeams(), TeamBalance_Destroy(), TeamBalance_GetTeam(), TeamBalance_GetTeamCounts(), TeamBalance_GetTeamFromIndex(), and teamplay.
Referenced by ClientDisconnect(), and ClientKill_Now_TeamChange().
Definition at line 700 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 631 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 1287 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 1282 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 1277 of file teamplay.qc.
References entity(), and TEAM_NOT_ALLOWED.
Referenced by TeamBalance_AutoBalanceBots(), 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 ClientCommand_selectteam(), and 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().
| int autocvar_g_balance_teams_skill |
Definition at line 12 of file teamplay.qh.
Referenced by PlayerStats_PlayerBasic(), TeamBalance_CompareTeamsInternal(), and TeamBalance_FindBestTeams().
| float autocvar_g_balance_teams_skill_significance_threshold |
Definition at line 14 of file teamplay.qh.
Referenced by TeamBalance_CompareTeamsInternal(), and TeamBalance_FindBestTeams().
| float autocvar_g_balance_teams_skill_unranked_factor |
Definition at line 13 of file teamplay.qh.
Referenced by TeamBalance_GetTeamCounts().
| string autocvar_g_forced_team_otherwise |
Definition at line 16 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 20 of file teamplay.qh.
Referenced by ClientCommand_selectteam(), GameCommand_lockteams(), GameCommand_unlockteams(), joinAllowed(), MoveToTeam(), nJoinAllowed(), ReadyRestart_force(), and SERVER_COMMAND().
| float m_skill_mu |
Team: members' inverse-variance weighted skill mean.
Definition at line 23 of file teamplay.qh.
| float m_skill_var |
Team: members' inverse-variance weighted skill variance (sigma**2).
Definition at line 24 of file teamplay.qh.
| float server_skill_average |
Scaled inverse-variance weighted mean of all clients' m_skill_mu, for unranked clients.
Definition at line 21 of file teamplay.qh.
Referenced by TeamBalance_FindBestTeams(), and TeamBalance_GetTeamCounts().
| int team_forced |
can be a team number to force a team, or 0 for default action, or -1 for forced spectator
Definition at line 26 of file teamplay.qh.
| int teamplay_bitmask |
The set of currently available teams (AVAILABLE_TEAMS is the number of them).
Definition at line 18 of file teamplay.qh.
Referenced by CA_CheckTeams(), freezetag_CheckTeams(), GameCommand_moveplayer(), GameplayMode_DelayedInit(), MUTATOR_HOOKFUNCTION(), nb_delayedinit(), nb_spawnteams(), race_ScoreRules(), rc_SetLimits(), REGISTER_MUTATOR(), REGISTER_MUTATOR(), ScoreRules_basics(), ScoreRules_basics_end(), set_dom_state(), tdm_DelayedInit(), TeamBalance_CheckAllowedTeams(), and tmayhem_DelayedInit().