]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Finish up work on timeout system, now has much cleaner functionality (though it still...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index d5181ae4119591ac59ad176cfb79e67ea3102046..521db1a0ab1c5de878747c01bdc6e1185b56ade5 100644 (file)
@@ -1,11 +1,11 @@
 // =========================================================
 //  Server side networked commands code, reworked by Samual
-//  Last updated: December 13th, 2011
+//  Last updated: December 26th, 2011
 // =========================================================
 
 float SV_ParseClientCommand_floodcheck()
 {
-       if (timeoutStatus != 2) // if the game is not paused... but wait, doesn't that mean it could be dos'd by pausing it? eh? (old code)
+       if not(timeout_status) // not while paused
        {
                if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
                {
@@ -47,7 +47,7 @@ void ClientCommand_autoswitch(float request, float argc)
        }
 }
 
-void ClientCommand_checkfail(float request, string command) // used only by client side code
+void ClientCommand_checkfail(float request, string command) // internal command, used only by code
 {
        switch(request)
        {
@@ -61,14 +61,14 @@ void ClientCommand_checkfail(float request, string command) // used only by clie
                default:
                case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd checkfail message\n");
+                       sprint(self, "\nUsage:^3 cmd checkfail <message>\n");
                        sprint(self, "  Where 'message' is the message reported by client about the fail.\n");
                        return;
                }
        }
 }
 
-void ClientCommand_clientversion(float request, float argc) // used only by client side code
+void ClientCommand_clientversion(float request, float argc) // internal command, used only by code
 {
        switch(request)
        {
@@ -106,7 +106,7 @@ void ClientCommand_clientversion(float request, float argc) // used only by clie
        }
 }
 
-void ClientCommand_getmapvotepic(float request, float argc)
+void ClientCommand_getmapvotepic(float request, float argc) // internal command, used only by code
 {
        switch(request)
        {
@@ -128,7 +128,7 @@ void ClientCommand_getmapvotepic(float request, float argc)
        }
 }
 
-void ClientCommand_join(float request)
+void ClientCommand_join(float request) // legacy
 {
        switch(request)
        {
@@ -168,7 +168,7 @@ void ClientCommand_join(float request)
        }
 }
 
-void ClientCommand_ready(float request) 
+void ClientCommand_ready(float request) // todo: anti-spam for toggling readyness
 {
        switch(request)
        {
@@ -192,7 +192,7 @@ void ClientCommand_ready(float request)
                                                }
 
                                                // cannot reset the game while a timeout is active!
-                                               if(!timeoutStatus)
+                                               if not(timeout_status)
                                                        ReadyCount();
                                        } else {
                                                sprint(self, "^1Game has already been restarted\n");
@@ -212,7 +212,7 @@ void ClientCommand_ready(float request)
        }
 }
 
-void ClientCommand_reportcvar(float request, float argc, string command) // TODO: confirm this works
+void ClientCommand_reportcvar(float request, float argc, string command)
 {      
        switch(request)
        {
@@ -280,7 +280,7 @@ void ClientCommand_say_team(float request, float argc, string command)
        }
 }
 
-void ClientCommand_selectteam(float request, float argc) // TODO: Update the messages for this command
+void ClientCommand_selectteam(float request, float argc)
 {
        switch(request)
        {
@@ -350,7 +350,7 @@ void ClientCommand_selfstuff(float request, string command)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd selfstuff command\n");
+                       sprint(self, "\nUsage:^3 cmd selfstuff <command>\n");
                        sprint(self, "  Where 'command' is the string to be stuffed to your client.\n");
                        return;
                }
@@ -385,7 +385,7 @@ void ClientCommand_sentcvar(float request, float argc, string command)
        }
 }
 
-void ClientCommand_spectate(float request)
+void ClientCommand_spectate(float request) // legacy
 {
        switch(request)
        {
@@ -464,9 +464,9 @@ void ClientCommand_tell(float request, float argc, string command)
                                entity tell_to = GetFilteredEntity(argv(1));
                                float tell_accepted = VerifyClientEntity(tell_to, TRUE, FALSE);
                                
-                               if(tell_accepted > 0)
+                               if(tell_accepted > 0) // the target is a real client
                                {
-                                       if(tell_to != self)
+                                       if(tell_to != self) // and we're allowed to send to them :D
                                        {
                                                Say(self, FALSE, tell_to, substring(command, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)), TRUE);
                                                return;
@@ -493,7 +493,7 @@ void ClientCommand_tell(float request, float argc, string command)
        }
 }
 
-void ClientCommand_voice(float request, float argc, string command)
+void ClientCommand_voice(float request, float argc, string command) // legacy
 {
        switch(request)
        {
@@ -509,14 +509,16 @@ void ClientCommand_voice(float request, float argc, string command)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       sprint(self, "\nUsage:^3 cmd voice\n");
-                       sprint(self, "  FIXME ARGUMENTS UNKNOWN.\n");
+                       sprint(self, "\nUsage:^3 cmd voice messagetype <soundname>\n");
+                       sprint(self, "  'messagetype' is the type of broadcast to do, like team only or such,\n");
+                       sprint(self, "  and 'soundname' is the string/filename of the sound/voice message to play.\n");
                        return;
                }
        }
 }
 
-/* use this when creating a new command, making sure to place it in alphabetical order.
+/* use this when creating a new command, making sure to place it in alphabetical order... also,
+** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
 void ClientCommand_(float request)
 {
        switch(request)
@@ -544,22 +546,23 @@ void ClientCommand_(float request)
 // =====================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+// Common commands have double indentation to separate them a bit.
 #define CLIENT_COMMANDS(request,arguments,command) \
        CLIENT_COMMAND("autoswitch", ClientCommand_autoswitch(request, arguments), "Whether or not to switch automatically when getting a better weapon") \
        CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command), "Report if a client-side check failed") \
        CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments), "Release version of the game") \
-       CLIENT_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, self), "Prints a list of all changed server cvars") \
-       CLIENT_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, self), "Prints a list of all changed gameplay cvars") \
+               CLIENT_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, self), "Prints a list of all changed server cvars") \
+               CLIENT_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, self), "Prints a list of all changed gameplay cvars") \
        CLIENT_COMMAND("getmapvotepic", ClientCommand_getmapvotepic(request, arguments), "Retrieve mapshot picture from the server") \
-       CLIENT_COMMAND("info", CommonCommand_info(request, self, arguments), "Request for unique server information set up by admin") \
+               CLIENT_COMMAND("info", CommonCommand_info(request, self, arguments), "Request for unique server information set up by admin") \
        CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
-       CLIENT_COMMAND("ladder", CommonCommand_ladder(request, self), "Get information about top players if supported") \
-       CLIENT_COMMAND("lsmaps", CommonCommand_lsmaps(request, self), "List maps which can be used with the current game mode") \
-       CLIENT_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, self), "List maps which TODO") \
-       CLIENT_COMMAND("maplist", CommonCommand_maplist(request, self), "Display full server maplist reply") \
-       CLIENT_COMMAND("rankings", CommonCommand_rankings(request, self), "Print information about rankings") \
+               CLIENT_COMMAND("ladder", CommonCommand_ladder(request, self), "Get information about top players if supported") \
+               CLIENT_COMMAND("lsmaps", CommonCommand_lsmaps(request, self), "List maps which can be used with the current game mode") \
+               CLIENT_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, self), "List maps which have no records or are seemingly unplayed yet") \
+               CLIENT_COMMAND("maplist", CommonCommand_maplist(request, self), "Display full server maplist reply") \
+               CLIENT_COMMAND("rankings", CommonCommand_rankings(request, self), "Print information about rankings") \
        CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
-       CLIENT_COMMAND("records", CommonCommand_records(request, self), "List top 10 records for the current map") \
+               CLIENT_COMMAND("records", CommonCommand_records(request, self), "List top 10 records for the current map") \
        CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
        CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
        CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
@@ -568,14 +571,14 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("sentcvar", ClientCommand_sentcvar(request, arguments, command), "New system for sending a client cvar to the server") \
        CLIENT_COMMAND("spectate", ClientCommand_spectate(request), "Become an observer") \
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
-       CLIENT_COMMAND("teamstatus", CommonCommand_teamstatus(request, self), "Show information about player and team scores") \
+               CLIENT_COMMAND("teamstatus", CommonCommand_teamstatus(request, self), "Show information about player and team scores") \
        CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
-       CLIENT_COMMAND("time", CommonCommand_time(request, self), "Print different formats/readouts of time") \
-       CLIENT_COMMAND("timein", CommonCommand_timein(request, self), "Resume the game from being paused with a timeout") \
-       CLIENT_COMMAND("timeout", CommonCommand_timeout(request, self), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
+               CLIENT_COMMAND("time", CommonCommand_time(request, self), "Print different formats/readouts of time") \
+               CLIENT_COMMAND("timein", CommonCommand_timein(request, self), "Resume the game from being paused with a timeout") \
+               CLIENT_COMMAND("timeout", CommonCommand_timeout(request, self), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
        CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
-       CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \
-       CLIENT_COMMAND("who", CommonCommand_who(request, self, arguments), "Display detailed client information about all players") \
+               CLIENT_COMMAND("vote", VoteCommand(request, self, arguments, command), "Request an action to be voted upon by players") \
+               CLIENT_COMMAND("who", CommonCommand_who(request, self, arguments), "Display detailed client information about all players") \
        /* nothing */
        
 void ClientCommand_macro_help()
@@ -646,7 +649,7 @@ void SV_ParseClientCommand(string command)
                                return print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n"); // "FALSE": not allowed to continue, halt
        }
        
-       /* NOTE: totally disabled for now, however the functionality and descriptions are there if we ever want it.
+       /* NOTE: totally disabled for now for bandwidth/security reasons, however the functionality and descriptions are there if we ever want it.
        if(argv(0) == "help") 
        {
                if(argc == 1)