]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Merge branch 'master' into z411/bai-server
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 7241b7415dbb4487035fdca152c73ac2c99bfca8..4de77855565e69810e7f09fab2d6289a2e16d3e9 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");
                                        }
                                }
 
@@ -275,13 +275,14 @@ void ClientCommand_join(entity caller, int request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (!game_stopped && IS_CLIENT(caller) && !IS_PLAYER(caller))
+                       if (!game_stopped && !game_timeout && IS_CLIENT(caller) && !IS_PLAYER(caller))
                        {
                                if (joinAllowed(caller))
                                        Join(caller);
                                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,13 +367,13 @@ 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 || g_race_qualifying == 2)
                                {
@@ -381,16 +382,18 @@ void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for tog
                                        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");
+                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
+                                                       bprint("\{1}", 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");
+                                               if (IS_PLAYER(caller) || INGAME_JOINED(caller))
+                                                       bprint("\{1}", playername(caller.netname, caller.team, false), "^2 is ready\n");
                                        }
 
+                                       caller.last_ready = time;
+
                                        // cannot reset the game while a timeout is active!
                                        if (!timeout_status) ReadyCount();
                                }
@@ -593,7 +596,7 @@ void ClientCommand_spectate(entity caller, int request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (!intermission_running && IS_CLIENT(caller))
+                       if (!intermission_running && IS_CLIENT(caller) && !game_timeout)
                        {
                                if(argv(1) != "")
                                {
@@ -637,6 +640,25 @@ void ClientCommand_spectate(entity caller, int request)
        }
 }
 
+void ClientCommand_sounds(entity caller, int request)
+{
+       switch (request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       sprint(caller, strcat("Available sounds: \n\n", autocvar_sv_chat_sounds_list, "\n"));
+                       return; // never fall through to usage
+               }
+
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       sprint(caller, "\nUsage:^3 cmd sounds\n");
+                       return;
+               }
+       }
+}
+
 void ClientCommand_suggestmap(entity caller, int request, int argc)
 {
        switch (request)
@@ -810,6 +832,7 @@ void ClientCommand_(entity caller, int request)
        CLIENT_COMMAND("selfstuff", ClientCommand_selfstuff(ent, request, command), "Stuffcmd a command to your own client") \
        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("sounds", ClientCommand_sounds(ent, request), "Get list of commsnds") \
        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") \
        CLIENT_COMMAND("voice", ClientCommand_voice(ent, request, arguments, command), "Send voice message via sound") \