X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fbot.qc;h=90338d20214e1e0ec3132f7af1c3b597bba4f4a3;hb=5f22a2a699389fbdff74a80d48559f52106999fa;hp=9ebcffae3c8383657da46d4b571e24dfcdd92b2a;hpb=9ff975c1d5a91d3e27ea7f77c30375b50f2c15a6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 9ebcffae3..90338d202 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -215,13 +215,13 @@ void bot_setnameandstuff(entity this) prio = 6; - #define READSKILL(f, w, r) MACRO_BEGIN { \ + #define READSKILL(f, w, r) MACRO_BEGIN \ if(argv(prio) != "") \ this.f = stof(argv(prio)) * w; \ else \ this.f = (!autocvar_g_campaign) * (2 * random() - 1) * r * w; \ prio++; \ - } MACRO_END + MACRO_END //print(bot_name, ": ping=", argv(9), "\n"); READSKILL(havocbot_keyboardskill, 0.5, 0.5); // keyboard skill @@ -241,6 +241,9 @@ void bot_setnameandstuff(entity this) READSKILL(bot_thinkskill, 1, 0.5); // think skill READSKILL(bot_aiskill, 2, 0); // "ai" skill + if (file >= 0 && argv(prio) != "") + LOG_INFOF("^1Warning^7: too many parameters for bot %s, please check format of %s", bot_name, autocvar_bot_config_file); + this.bot_config_loaded = true; // this is really only a default, TeamBalance_JoinBestTeam is called later @@ -427,16 +430,15 @@ void bot_clientconnect(entity this) bot_setclientfields(this); } - if(this.bot_forced_team==1) - this.team = NUM_TEAM_1; - else if(this.bot_forced_team==2) - this.team = NUM_TEAM_2; - else if(this.bot_forced_team==3) - this.team = NUM_TEAM_3; - else if(this.bot_forced_team==4) - this.team = NUM_TEAM_4; + if (teamplay && Team_IsValidIndex(this.bot_forced_team)) + { + SetPlayerTeam(this, this.bot_forced_team, TEAM_CHANGE_MANUAL); + } else + { + this.bot_forced_team = 0; TeamBalance_JoinBestTeam(this); + } havocbot_setupbot(this); } @@ -604,6 +606,8 @@ bool bot_fixcount() else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5))) { int minplayers = max(0, floor(autocvar_minplayers)); + if (teamplay) + minplayers = max(0, floor(autocvar_minplayers_per_team) * AvailableTeams()); int minbots = max(0, floor(autocvar_bot_number)); // add bots to reach minplayers if needed @@ -611,7 +615,7 @@ bool bot_fixcount() // cap bots to the max players allowed by the server int player_limit = GetPlayerLimit(); if(player_limit) - bots = min(bots, player_limit - activerealplayers); + bots = min(bots, max(player_limit - activerealplayers, 0)); bots = min(bots, maxclients - realplayers); if(bots > minbots) @@ -634,7 +638,7 @@ bool bot_fixcount() return false; } } - while (currentbots > bots) + while (currentbots > bots && bots >= 0) bot_removenewest(); }