]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clarify and simplify minplayers cvar description and related code
authorterencehill <piuntn@gmail.com>
Sun, 16 Sep 2018 11:08:38 +0000 (13:08 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 16 Sep 2018 11:08:38 +0000 (13:08 +0200)
qcsrc/server/bot/default/bot.qc
xonotic-server.cfg

index b80b498e7253fd0a13008d4ec2f0d214c8178734..2a6164a2826875af507597ba8523bf629bee0403 100644 (file)
@@ -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;
        }
index 4b9febd221d52af46f8d5717c87c4e5ed7b5cf32..ca9b72eeef4cda9edf6bbd7aee8b34ef2b445290 100644 (file)
@@ -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"