X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fbot.qc;h=d7cf429d74e150a8324c0c30bfe0245d683658f1;hb=3b5e884b5e67ad05b088c0f0d6af589a6c39be3a;hp=792bde7cd969c395c6b835f5733fa512f3862d1a;hpb=12e3e2cb5f9d8cdd821a97894223fde2f5e2f816;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index 792bde7cd..d7cf429d7 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -64,7 +64,7 @@ void bot_think(entity this) if(autocvar_bot_god) this.flags |= FL_GODMODE; - this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * (0.5 ** this.bot_aiskill) * min(14 / (skill + 14), 1)); + this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * min(14 / (skill + this.bot_aiskill + 14), 1)); if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start)) { @@ -118,7 +118,6 @@ void bot_think(entity this) W_NextWeapon(this, 0, weaponentity); // block the bot during the countdown to game start CS(this).movement = '0 0 0'; - this.bot_nextthink = game_starttime; return; } @@ -170,7 +169,7 @@ void bot_setnameandstuff(entity this) int smallest_count = -1; if (teamplay) { - for (int i = 1; i <= AvailableTeams(); ++i) + for (int i = 1; i <= AVAILABLE_TEAMS; ++i) { // NOTE if (autocvar_g_campaign && autocvar_g_campaign_forceteam == i) // TeamBalance_GetNumberOfPlayers(balance, i); returns the number of players + 1 @@ -210,7 +209,7 @@ void bot_setnameandstuff(entity this) }); if (!conflict) prio += 1; - if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2)) + if (teamplay && !(autocvar_bot_vs_human && AVAILABLE_TEAMS == 2)) { int forced_team = stof(argv(5)); if (!Team_IsValidIndex(forced_team)) @@ -242,8 +241,12 @@ void bot_setnameandstuff(entity this) if(argv(4) != "" && stof(argv(4)) >= 0) bot_pants = argv(4); else bot_pants = ftos(floor(random() * 15)); - if (teamplay && !(autocvar_bot_vs_human && AvailableTeams() == 2)) + if (teamplay && !(autocvar_bot_vs_human && AVAILABLE_TEAMS == 2)) + { this.bot_forced_team = stof(argv(5)); + if (!Team_IsValidIndex(this.bot_forced_team)) + this.bot_forced_team = 0; + } else this.bot_forced_team = 0; @@ -438,7 +441,6 @@ void bot_clientconnect(entity this) if (!IS_BOT_CLIENT(this)) return; this.bot_preferredcolors = this.clientcolors; this.bot_nextthink = time - random(); - this.lag_func = bot_lagfunc; this.isbot = true; this.createdtime = this.bot_nextthink; @@ -607,13 +609,13 @@ bool bot_fixcount(bool multiple_per_frame) // But don't remove bots immediately on level change, as the real players // usually haven't rejoined yet bots_would_leave = false; - if (teamplay && autocvar_bot_vs_human && AvailableTeams() == 2) + if (autocvar_bot_vs_human && AVAILABLE_TEAMS == 2) bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers); 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()); + minplayers = max(0, floor(autocvar_minplayers_per_team) * AVAILABLE_TEAMS); int minbots = max(0, floor(autocvar_bot_number)); // add bots to reach minplayers if needed @@ -677,6 +679,7 @@ void bot_serverframe() // spectators in the scoreboard and never go away. This issue happens at time 2 if map is changed // with the gotomap command, minplayers is > 1 and human clients join as players very soon // either intentionally or automatically (sv_spectate 0) + // A working workaround for this bug was implemented in commit fbd145044, see entcs_attach if (time < 2.5) { currentbots = -1;