From: terencehill Date: Sun, 16 Sep 2018 11:08:38 +0000 (+0200) Subject: Clarify and simplify minplayers cvar description and related code X-Git-Tag: xonotic-v0.8.5~1856 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4dcd0138fefe9810c539cc0f5c8f6da5e81d1b06;p=xonotic%2Fxonotic-data.pk3dir.git Clarify and simplify minplayers cvar description and related code --- diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index b80b498e7..2a6164a28 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -594,8 +594,6 @@ float bot_fixcount() } int bots; - // add/remove bots if needed to make sure there are at least - // minplayers+bot_number, or remove all bots if no one is playing // But don't remove bots immediately on level change, as the real players // usually haven't rejoined yet bots_would_leave = false; @@ -603,15 +601,14 @@ float bot_fixcount() bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers); else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5))) { - float realminplayers, minplayers; - realminplayers = autocvar_minplayers; - minplayers = max(0, floor(realminplayers)); + int minplayers = max(0, floor(autocvar_minplayers)); + int minbots = max(0, floor(autocvar_bot_number)); - float realminbots, minbots; - realminbots = autocvar_bot_number; - minbots = max(0, floor(realminbots)); + // add bots to reach minplayers if needed + bots = max(minbots, minplayers - activerealplayers); + // cap bots to the max players allowed by the server + bots = min(bots, maxclients - realplayers); - bots = min(max(minbots, minplayers - activerealplayers), maxclients - realplayers); if(bots > minbots) bots_would_leave = true; } diff --git a/xonotic-server.cfg b/xonotic-server.cfg index 4b9febd22..ca9b72eee 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -10,7 +10,7 @@ set sv_autotaunt 1 "allow autotaunts on the server" // server settings hostname "Xonotic $g_xonoticversion Server" set sv_mapchange_delay 5 -set minplayers 0 "number of players playing at the same time (if not enough real players are there the remaining slots are filled with bots)" +set minplayers 0 "fill server with bots to reach this number of players (if bot_number is not enough)" // restart server if all players hit "ready"-button set sv_ready_restart 0 "allow a map to be restarted once all players pressed the \"ready\" button"