From: Rudolf Polzer Date: Tue, 15 Jun 2010 09:08:10 +0000 (+0200) Subject: Merge remote branch 'refs/remotes/origin/terencehill/bot_vs_human_fix' X-Git-Tag: xonotic-v0.1.0preview~543 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=1f5d48dd87aaf7d479958202f3960de01ac877d2;hp=c52a7151ee8b3ab36c656dfe196cc61564b1332c Merge remote branch 'refs/remotes/origin/terencehill/bot_vs_human_fix' --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index fd4c100ce..725510d95 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -460,7 +460,7 @@ set bot_ai_aimskill_order_filter_5th 0.5 "Movement prediction filter. Used rarel set g_waypointeditor 0 set bot_ignore_bots 0 "When set, bots don't shoot at other bots" set bot_join_empty 0 "When set, bots also play if no player has joined the server" -set bot_vs_human 0 "Bots and humans play in different teams when set. positive values to make an all-bot blue team, set to negative values to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count)" +set bot_vs_human 0 "Bots and humans play in different teams when set. positive values to make an all-bot blue team, set to negative values to make an all-bot red team, the absolute value is the ratio bots vs humans (1 for equal count). Changes will be correctly applied only from the next game" alias g_waypointeditor_spawn "impulse 103" alias g_waypointeditor_remove "impulse 104" diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc index 5dd01d4dd..e68e29502 100644 --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@ -11,6 +11,7 @@ entity champion; float warmup; float allowed_to_spawn; float player_cnt; +float required_ca_players; .float caplayer; void PutObserverInServer(); @@ -43,7 +44,7 @@ void reset_map(float dorespawn) lms_next_place = player_count; race_ReadyRestart(); - + for(self = world; (self = nextent(self)); ) if(clienttype(self) == CLIENTTYPE_NOTACLIENT) { @@ -198,7 +199,7 @@ void Arena_Warmup() allowed_to_spawn = 0; - if(g_ca && (player_cnt < 2 || inWarmupStage)) + if(g_ca && (player_cnt < required_ca_players || inWarmupStage)) allowed_to_spawn = 1; msg = NEWLINES; @@ -280,13 +281,15 @@ void Spawnqueue_Check() } } - if(player_cnt < 2 && (redspawned && bluespawned)) { + required_ca_players = max(2, fabs(cvar("bot_vs_human") + 1)); + + if(player_cnt < required_ca_players && (redspawned && bluespawned)) { reset_map(TRUE); } - else if(player_cnt < 2) { + else if(player_cnt < required_ca_players) { FOR_EACH_CLIENT(self) if(self.classname == "player") - centerprint(self, strcat("^1Need at least 2 players to play CA", "^7\n")); + centerprint(self, strcat("^1Need at least 1 player in each team to play CA", "^7\n")); allowed_to_spawn = 1; return; diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 44ece52bf..940782c82 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -544,7 +544,7 @@ void bot_serverframe() FOR_EACH_REALCLIENT(head) { - if(head.classname == "player" || g_lms || g_arena) + if(head.classname == "player" || g_lms || g_arena || g_ca) ++activerealplayers; ++realplayers; } diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index b3f0e3ee5..3911ffecb 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -433,7 +433,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); - if((g_arena && numspawned < 2) || (g_ca && player_cnt < 2) && !inWarmupStage) + if((g_arena && numspawned < 2) || (g_ca && player_cnt < required_ca_players) && !inWarmupStage) return; if (!g_minstagib)