]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add minplayers_per_team cvar: fill server with bots to reach this number of players...
authorterencehill <piuntn@gmail.com>
Sat, 26 Jan 2019 15:06:37 +0000 (16:06 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 26 Jan 2019 15:06:37 +0000 (16:06 +0100)
commands.cfg
qcsrc/server/autocvars.qh
qcsrc/server/bot/default/bot.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_world.qc
xonotic-server.cfg

index 0f2e5689253e3ef06acfc3c4b0cef282e7da7419..798104a68c065d0d5dfd1c9265c02886f06c6237 100644 (file)
@@ -117,9 +117,9 @@ alias menu_showquitdialog "menu_cmd directmenu Quit"
 alias menu_showmonstertools "menu_cmd directmenu MonsterTools"
 
 // command executed before loading a map by the menu
-// makes sure maxplayers is at least minplayers or bot_number + 1
+// makes sure maxplayers is at least minplayers or minplayers_per_team * 4 or bot_number + 1
 alias _menu_loadmap_prepare_maxpl "maxplayers $_menu_loadmap_maxplayers"
-alias menu_loadmap_prepare "disconnect; wait; g_campaign 0; menu_cmd rpn /_menu_loadmap_maxplayers menu_maxplayers minplayers bot_number 1 add max max def; _menu_loadmap_prepare_maxpl; g_maplist_shufflenow"
+alias menu_loadmap_prepare "disconnect; wait; g_campaign 0; menu_cmd rpn /_menu_loadmap_maxplayers menu_maxplayers minplayers bot_number 1 add max minplayers_per_team 4 mul max max def; _menu_loadmap_prepare_maxpl; g_maplist_shufflenow"
 
 
 // ==========================================================
index b23f6f148175478fbdc9acb885cc71cb3179b045..a50191775932476dc2963873b341845cdd4774a6 100644 (file)
@@ -251,6 +251,7 @@ bool autocvar_lastlevel;
 int autocvar_leadlimit_and_fraglimit;
 int autocvar_leadlimit_override;
 int autocvar_minplayers;
+int autocvar_minplayers_per_team;
 string autocvar_nextmap;
 string autocvar_quit_and_redirect;
 float autocvar_quit_and_redirect_timer;
index 9ebcffae3c8383657da46d4b571e24dfcdd92b2a..a0b7e47fbc37cb9e6954b91c1100a19fdf841c5f 100644 (file)
@@ -604,6 +604,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
index c3e5bf9015293c712bb59f4e1d05c6c71f626804..5dc92eb90400484f375ad60ee8c98b38c254c2c8 100644 (file)
@@ -330,6 +330,7 @@ void GameCommand_bot_cmd(int request, int argc, string command)
                        {
                                cvar_settemp("bot_vs_human", "0");
                                cvar_settemp("minplayers", "0");
+                               cvar_settemp("minplayers_per_team", "0");
                                cvar_settemp("bot_number", "0");
                                bot_fixcount();
                                cvar_settemp("bot_number", argv(2));
@@ -362,6 +363,7 @@ void GameCommand_bot_cmd(int request, int argc, string command)
                                                {
                                                        cvar_settemp("bot_vs_human", "0");
                                                        cvar_settemp("minplayers", "0");
+                                                       cvar_settemp("minplayers_per_team", "0");
                                                        cvar_settemp("bot_number", "0");
                                                        bot_fixcount();
                                                        cvar_settemp("bot_number", argv(3));
@@ -1281,6 +1283,7 @@ void GameCommand_setbots(int request, int argc)
                        if (argc >= 2)
                        {
                                cvar_settemp("minplayers", "0");
+                               cvar_settemp("minplayers_per_team", "0");
                                cvar_settemp("bot_number", argv(1));
                                bot_fixcount();
                                return;
index 522f4f041cc49af4810c0f53fb2070f30c4e75e4..12fcaae6318abd89758c68a4113b6042c44a8466 100644 (file)
@@ -431,6 +431,7 @@ void cvar_changes_init()
                BADCVAR("log_file");
                BADCVAR("maxplayers");
                BADCVAR("minplayers");
+               BADCVAR("minplayers_per_team");
                BADCVAR("net_address");
                BADCVAR("port");
                BADCVAR("rcon_password");
@@ -1004,8 +1005,11 @@ float GetMaplistPosition()
 
 bool MapHasRightSize(string map)
 {
-       if(currentbots || autocvar_bot_number || player_count < autocvar_minplayers)
-       if(autocvar_g_maplist_check_waypoints)
+       int minplayers = max(0, floor(autocvar_minplayers));
+       if (teamplay)
+               minplayers = max(0, floor(autocvar_minplayers_per_team) * AvailableTeams());
+       if (autocvar_g_maplist_check_waypoints
+               && (currentbots || autocvar_bot_number || player_count < minplayers))
        {
                string checkwp_msg = strcat("checkwp ", map);
                if(!fexists(strcat("maps/", map, ".waypoints")))
index e25ae7faca9b4d78250766ef4020dbdd4439e4ba..bb0d59371d04a66434bbb4df2a3f6f2a15b6cb73 100644 (file)
@@ -10,7 +10,8 @@ set sv_autotaunt 1 "allow autotaunts on the server"
 // server settings
 hostname "Xonotic $g_xonoticversion Server"
 set sv_mapchange_delay 5
-set minplayers 0 "fill server with bots to reach this number of players (if bot_number is not enough)"
+set minplayers 0 "fill server with bots to reach this number of players in teamless games (if bot_number is not enough)"
+set minplayers_per_team 0 "fill server with bots to reach this number of players per team (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"