this.bot_config_loaded = true;
- // this is really only a default, JoinBestTeam is called later
+ // this is really only a default, TeamBalance_JoinBestTeam is called later
setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants));
this.bot_preferredcolors = this.clientcolors;
else if(this.bot_forced_team==4)
this.team = NUM_TEAM_4;
else
- TeamBalance_JoinBestTeam(this, true);
+ TeamBalance_JoinBestTeam(this);
havocbot_setupbot(this);
}
accuracy_resend(this);
if (this.team < 0)
- TeamBalance_JoinBestTeam(this, true);
+ TeamBalance_JoinBestTeam(this);
entity spot = SelectSpawnPoint(this, false);
if (!spot) {
{
if(this.killindicator_teamchange == -1)
{
- TeamBalance_JoinBestTeam(this, true);
+ TeamBalance_JoinBestTeam(this);
}
else if(this.killindicator_teamchange == -2)
{
int playerid_save = this.playerid;
this.playerid = 0; // silent
- TeamBalance_JoinBestTeam(this, false); // if the team number is valid, keep it
this.playerid = playerid_save;
TRANSMUTE(Observer, this);
if (autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
- LogTeamchange(this.playerid, this.team, TEAM_CHANGE_CONNECT);
-
CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects
if(teamplay && IS_PLAYER(this))
if(!this.team_selected)
if(autocvar_g_campaign || autocvar_g_balance_teams)
- TeamBalance_JoinBestTeam(this, true);
+ TeamBalance_JoinBestTeam(this);
if(autocvar_g_campaign)
campaign_bots_may_start = true;
return team_bits;
}
-void TeamBalance_JoinBestTeam(entity this, bool force_best_team)
+void TeamBalance_JoinBestTeam(entity this)
{
- //PrintToChatAll(sprintf("JoinBestTeam: %s, %f", this.netname, force_best_team));
+ PrintToChatAll(sprintf("JoinBestTeam: %s, %f", this.netname));
// don't join a team if we're not playing a team game
if (!teamplay)
{
// find out what teams are available
entity balance = TeamBalance_CheckAllowedTeams(this);
- // if we don't care what team they end up on, put them on whatever team they entered as.
- // if they're not on a valid team, then let other code put them on the smallest team
- if (!force_best_team)
- {
- int selected_team_index = -1;
- for (int i = 1; i <= NUM_TEAMS; ++i)
- {
- if (TeamBalance_IsTeamAllowedInternal(balance, i) &&
- (Team_TeamToIndex(this.team) == i))
- {
- selected_team_index = i;
- break;
- }
- }
-
- if (Team_IsValidIndex(selected_team_index))
- {
- SetPlayerTeam(this, selected_team_index, TEAM_CHANGE_AUTO_RELAXED);
- TeamBalance_Destroy(balance);
- return;
- }
- }
- // otherwise end up on the smallest team (handled below)
if (this.bot_forced_team)
{
TeamBalance_Destroy(balance);
enum
{
- TEAM_CHANGE_CONNECT = 1,
TEAM_CHANGE_AUTO = 2,
TEAM_CHANGE_MANUAL = 3,
- TEAM_CHANGE_SPECTATOR = 4,
- TEAM_CHANGE_AUTO_RELAXED = 99
+ TEAM_CHANGE_SPECTATOR = 4
};
void LogTeamchange(float player_id, float team_number, int type);
/// function.
int TeamBalance_FindBestTeams(entity balance, entity player, bool use_score);
-void TeamBalance_JoinBestTeam(entity this, bool force_best_team);
+void TeamBalance_JoinBestTeam(entity this);
/// \brief Describes the result of comparing teams.
enum