]> 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 ad3685a1f0a549cc03631011531764dfb900cb34..00f1285ff22743a2e653e5d78a9ed3e27a9eede5 100644 (file)
@@ -275,7 +275,7 @@ 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);
@@ -366,13 +366,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) // anti-spam
                        {
                                if (warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2)
                                {
@@ -384,14 +384,16 @@ void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for tog
                                                {
                                                        caller.ready = false;
                                                        if(IS_PLAYER(caller) || caller.caplayer == 1)
-                                                               bprint(playername(caller.netname, caller.team, false), "^2 is ^1NOT^2 ready\n");
+                                                               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");
+                                                               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();
@@ -626,7 +628,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) != "")
                                {
@@ -670,6 +672,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)
@@ -842,6 +863,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, command), "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") \