]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Merge branch 'master' into z411/annce_queue
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 570b8e5fc0bfcf180cb2fb61526e3b025a624182..e2d71597f44ae1f20369a8b6c7e2e2c59f38c90e 100644 (file)
@@ -73,8 +73,8 @@ void ClientCommand_autoswitch(entity caller, int request, int argc)
                {
                        if (argv(1) != "")
                        {
-                               CS_CVAR(caller).autoswitch = InterpretBoolean(argv(1));
-                               sprint(caller, strcat("^1autoswitch is currently turned ", (CS_CVAR(caller).autoswitch ? "on" : "off"), ".\n"));
+                               CS_CVAR(caller).cvar_cl_autoswitch = InterpretBoolean(argv(1));
+                               sprint(caller, strcat("^1autoswitch is currently turned ", (CS_CVAR(caller).cvar_cl_autoswitch ? "on" : "off"), ".\n"));
                                return;
                        }
                }
@@ -114,7 +114,7 @@ void ClientCommand_clientversion(entity caller, int request, int argc)  // inter
                                        else if (teamplay && !autocvar_sv_spectate && !(Player_GetForcedTeamIndex(caller) > 0))
                                        {
                                                TRANSMUTE(Observer, caller);  // really?
-                                               stuffcmd(caller, "menu_showteamselect\n");
+                                               stuffcmd(caller, "scoreboard_team_selection\n");
                                        }
                                }
 
@@ -164,7 +164,7 @@ void ClientCommand_wpeditor(entity caller, int request, int argc)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (!autocvar_g_waypointeditor)
+                       if (!waypointeditor_enabled)
                        {
                                sprint(caller, "ERROR: this command works only if the waypoint editor is on\n");
                                return;
@@ -282,6 +282,7 @@ void ClientCommand_join(entity caller, int request)
                                else if(time < CS(caller).jointime + MIN_SPEC_TIME)
                                        CS(caller).autojoin_checked = -1;
                        }
+                       CS(caller).parm_idlesince = time;
 
                        return;  // never fall through to usage
                }
@@ -366,40 +367,33 @@ void ClientCommand_physics(entity caller, int request, int argc)
        }
 }
 
-void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for toggling readyness
+void ClientCommand_ready(entity caller, int request)
 {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (IS_CLIENT(caller))
+                       if (IS_CLIENT(caller) && caller.last_ready < time - 3)
                        {
-                               if (warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2)
+                               if (warmup_stage || g_race_qualifying == 2)
                                {
-                                       if (!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
+                                       if (time < game_starttime) // game is already restarting
+                                               return;
+                                       if (caller.ready)            // toggle
                                        {
-                                               if (time < game_starttime) // game is already restarting
-                                                       return;
-                                               if (caller.ready)            // toggle
-                                               {
-                                                       caller.ready = false;
-                                                       if(IS_PLAYER(caller) || caller.caplayer == 1)
-                                                               bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n");
-                                               }
-                                               else
-                                               {
-                                                       caller.ready = true;
-                                                       if(IS_PLAYER(caller) || caller.caplayer == 1)
-                                                               bprint(playername(caller.netname, caller.team, false), "^2 is ready\n");
-                                               }
-
-                                               // cannot reset the game while a timeout is active!
-                                               if (!timeout_status) ReadyCount();
+                                               caller.ready = false;
+                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
+                                                       bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n");
                                        }
                                        else
                                        {
-                                               sprint(caller, "^1Game has already been restarted\n");
+                                               caller.ready = true;
+                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
+                                                       bprint(playername(caller.netname, caller.team, false), "^2 is ready\n");
                                        }
+
+                                       caller.last_ready = time;
+                                       ReadyCount();
                                }
                        }
                        return;  // never fall through to usage
@@ -560,22 +554,22 @@ void ClientCommand_selfstuff(entity caller, int request, string command)
        }
 }
 
-void ClientCommand_sentcvar(entity caller, int request, int argc, string command)
+void ClientCommand_sentcvar(entity caller, int request, int argc)
 {
        switch (request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argv(1) != "")
+                       if (argc >= 3)
                        {
-                               // float tokens;
-                               string s;
-
+                       // NOTE: client-side settings do not exist on the server, this functionality has been deprecated
+                       #if 0
                                if (argc == 2)  // undefined cvar: use the default value on the server then
                                {
-                                       s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
+                                       string s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
                                        tokenize_console(s);
                                }
+                       #endif
 
                                GetCvars(caller, CS_CVAR(caller), 1);
 
@@ -587,7 +581,7 @@ void ClientCommand_sentcvar(entity caller, int request, int argc, string command
                        sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
-                       sprint(caller, "\nUsage:^3 cmd sentcvar <cvar>\n");
+                       sprint(caller, "\nUsage:^3 cmd sentcvar <cvar> <arguments>\n");
                        sprint(caller, "  Where <cvar> is the cvar plus arguments to send to the server.\n");
                        return;
                }
@@ -815,7 +809,7 @@ void ClientCommand_(entity caller, int request)
        CLIENT_COMMAND("say_team", ClientCommand_say_team(ent, request, arguments, command), "Print a message to chat to all team mates") \
        CLIENT_COMMAND("selectteam", ClientCommand_selectteam(ent, request, arguments), "Attempt to choose a team to join into") \
        CLIENT_COMMAND("selfstuff", ClientCommand_selfstuff(ent, request, command), "Stuffcmd a command to your own client") \
-       CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(ent, request, arguments, command), "New system for sending a client cvar to the server") \
+       CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(ent, request, arguments), "New system for sending a client cvar to the server") \
        CLIENT_COMMAND("spectate", ClientCommand_spectate(ent, request), "Become an observer") \
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(ent, request, arguments), "Suggest a map to the mapvote at match end") \
        CLIENT_COMMAND("tell", ClientCommand_tell(ent, request, arguments, command), "Send a message directly to a player") \