]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
Soft reset: Fix warmup limit and repeatable restart
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index 3187d5d3a1014f7780b7ab1257897094a3e8849e..3e4195e509491e8cf41b9fcfb8850d63acab9228 100644 (file)
@@ -163,8 +163,7 @@ void GameCommand_allready(int request)
                {
                        if(warmup_stage)
                        {
-                               warmup_stage = 0;
-                               ReadyRestart();
+                               ReadyRestart(true);
                        }
                        else
                                LOG_INFO("Not in warmup.");
@@ -191,8 +190,7 @@ void GameCommand_allspec(int request, int argc)
                        string reason = argv(1);
                        int n = 0;
                        FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
-                               if (it.caplayer) it.caplayer = 0;
-                               PutObserverInServer(it);
+                               PutObserverInServer(it, true);
                                ++n;
                        });
                        if (n)   bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
@@ -1016,8 +1014,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                string pl_name = playername(client.netname, client.team, false);
                                                if (!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
-                                                       if (client.caplayer) client.caplayer = 0;
-                                                       PutObserverInServer(client);
+                                                       PutObserverInServer(client, true);
 
                                                        successful = strcat(successful, (successful ? ", " : ""), pl_name);
                                                }
@@ -1309,21 +1306,20 @@ void GameCommand_shuffleteams(int request)
        }
 }
 
-void GameCommand_srestart(int request)
+void GameCommand_reset(int request)
 {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       warmup_stage = cvar("g_warmup");
-                       ReadyRestart();
+                       ReadyRestart(false);
                        return;
                }
 
                default:
                case CMD_REQUEST_USAGE:
                {
-                       LOG_HELP("Usage:^3 sv_cmd srestart");
+                       LOG_HELP("Usage:^3 sv_cmd reset");
                        LOG_HELP("  No arguments required.");
                        return;
                }
@@ -1674,9 +1670,9 @@ SERVER_COMMAND(nospectators, "Automatically remove spectators from a match") { G
 SERVER_COMMAND(printstats, "Dump eventlog player stats and other score information") { GameCommand_printstats(request); }
 SERVER_COMMAND(radarmap, "Generate a radar image of the map") { GameCommand_radarmap(request, arguments); }
 SERVER_COMMAND(reducematchtime, "Decrease the timelimit value incrementally") { GameCommand_reducematchtime(request); }
+SERVER_COMMAND(reset, "Soft restart the server and reset the players") { GameCommand_reset(request); }
 SERVER_COMMAND(setbots, "Adjust how many bots are in the match") { GameCommand_setbots(request, arguments); }
 SERVER_COMMAND(shuffleteams, "Randomly move players to different teams") { GameCommand_shuffleteams(request); }
-SERVER_COMMAND(srestart, "Soft restart the server and reset the players") { GameCommand_srestart(request); }
 SERVER_COMMAND(stuffto, "Send a command to be executed on a client") { GameCommand_stuffto(request, arguments); }
 SERVER_COMMAND(trace, "Various debugging tools with tracing") { GameCommand_trace(request, arguments); }
 SERVER_COMMAND(unlockteams, "Enable the ability for players to switch or enter teams") { GameCommand_unlockteams(request); }