From 0ed85c3c8c82a079b023eb2874ec4ae9c7e90757 Mon Sep 17 00:00:00 2001 From: Samual Date: Wed, 28 Dec 2011 14:04:26 -0500 Subject: [PATCH] Massive revamp of help system code --- qcsrc/client/command/cl_cmd.qc | 118 ++++--------------------------- qcsrc/common/command/generic.qc | 14 +--- qcsrc/common/command/generic.qh | 12 +++- qcsrc/common/command/markup.qh | 6 +- qcsrc/common/command/rpn.qc | 5 ++ qcsrc/common/command/rpn.qh | 5 ++ qcsrc/server/command/cmd.qc | 47 ++++++------- qcsrc/server/command/common.qc | 59 +++++++++++++++- qcsrc/server/command/sv_cmd.qc | 121 ++++++++------------------------ qcsrc/server/command/vote.qh | 1 + 10 files changed, 147 insertions(+), 241 deletions(-) diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index db75f9eed..9babf43db 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -1,51 +1,8 @@ // ============================================== // CSQC client commands code, written by Samual -// Last updated: December 27th, 2011 +// Last updated: December 28th, 2011 // ============================================== -/* -float cvar_clientsettemp(string tmp_cvar, string value) -{ - float created_saved_value; - entity e; - - if not(tmp_cvar || value) - { - dprint("Error: Invalid usage of cvar_clientsettemp(string, string); !\n"); - return FALSE; - } - - for(e = world; (e = find(e, classname, "saved_cvar_value")); ) - if(e.netname == tmp_cvar) - goto saved; // skip creation - - // creating a new entity to keep track of this cvar - e = spawn(); - e.classname = "saved_cvar_value"; - e.netname = strzone(tmp_cvar); - e.message = strzone(cvar_string(tmp_cvar)); - created_saved_value = TRUE; - - // an entity for this cvar already exists - :saved - - // update the cvar to the value given - cvar_set(tmp_cvar, value); - - return created_saved_value; -} - -float cvar_clientsettemp_restore() -{ - float i; - entity e; - - for(e = world; (e = find(e, classname, "saved_cvar_value")); ) - { cvar_set(e.netname, e.message); ++i; } - - return i; -}*/ - void DrawDebugModel() { if(time - floor(time) > 0.5) @@ -313,60 +270,6 @@ void LocalCommand_sendcvar(float request, float argc) } } -void LocalCommand_settemp(float request, float argc) -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - if(argc >= 3) - { - if(cvar_settemp(argv(1), argv(2))) - dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n"); - else - dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n"); - - return; - } - } - - default: - print("Incorrect parameters for ^2settemp^7\n"); - case CMD_REQUEST_USAGE: - { - print("\nUsage:^3 cl_cmd settemp \"cvar\" \"arguments\"\n"); - print(" Where 'cvar' is the cvar you want to temporarily set with 'arguments'.\n"); - return; - } - } -} - -void LocalCommand_settemp_restore(float request, float argc) -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - float i = cvar_settemp_restore(); - - if(i) - dprint("Restored ", ftos(i), " temporary cvar settings to their original values.\n"); - else - dprint("Nothing to restore.\n"); - - return; - } - - default: - case CMD_REQUEST_USAGE: - { - print("\nUsage:^3 cl_cmd settemp_restore\n"); - print(" No arguments required.\n"); - return; - } - } -} - /* 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 LocalCommand_(float request) @@ -404,8 +307,6 @@ void LocalCommand_(float request) CLIENT_COMMAND("localprint", LocalCommand_localprint(request, arguments), "Create your own centerprint sent to yourself") \ CLIENT_COMMAND("mv_download", LocalCommand_mv_download(request, arguments), "Retrieve mapshot picture from the server") \ CLIENT_COMMAND("sendcvar", LocalCommand_sendcvar(request, arguments), "Send a cvar to the server (like weaponpriority)") \ - CLIENT_COMMAND("settemp", LocalCommand_settemp(request, arguments), "Temporarily set a value to a cvar which is restored later") \ - CLIENT_COMMAND("settemp_restore", LocalCommand_settemp_restore(request, arguments), "Restore all cvars set by settemp command") \ /* nothing */ void LocalCommand_macro_help() @@ -460,13 +361,22 @@ void GameCommand(string command) { if(argc == 1) { - print("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are:\n"); + print("\nClient console commands:\n"); LocalCommand_macro_help(); - GenericCommand("help"); - print("For help about specific commands, type cl_cmd help COMMAND\n"); + + print("\nGeneric commands shared by all programs:\n"); + GenericCommand_macro_help(); + + print("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.\n"); + print("For help about a specific command, type cl_cmd help COMMAND\n"); + return; } - else if(LocalCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + else if(GenericCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + { + return; + } + else if(LocalCommand_macro_usage(argc)) // now try for normal commands too { return; } diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 516b9ccdb..61977f678 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -282,19 +282,7 @@ float GenericCommand(string command) // argv: 0 - 1 - 2 - 3 // cmd vote - master - login - password - if(strtolower(argv(0)) == "help") - { - if(argc == 1) - { - GenericCommand_macro_help(); - return TRUE; - } - else if(GenericCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it - { - return TRUE; - } - } - else if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands + if(GenericCommand_macro_command(argc, command)) // continue as usual and scan for normal commands { return TRUE; // handled by one of the above GenericCommand_* functions } diff --git a/qcsrc/common/command/generic.qh b/qcsrc/common/command/generic.qh index d6abcea03..4533eb67b 100644 --- a/qcsrc/common/command/generic.qh +++ b/qcsrc/common/command/generic.qh @@ -1,4 +1,12 @@ -float GenericCommand(string command); // returns true if handled, false if not. Note: It tokenizes its input, so be careful! +// ========================================================= +// Declarations for common command code, written by Samual +// Last updated: December 28th, 2011 +// ========================================================= -// returns command prefix specific for each program it is compiled in +// Used by other game command systems for common commands, +// and it returns true if handled, false if not. +// Note: It tokenizes its input, so be careful! +float GenericCommand(string command); + +// Returns command prefix specific for whatever program it is compiled in string GetProgramCommandPrefix(void); \ No newline at end of file diff --git a/qcsrc/common/command/markup.qh b/qcsrc/common/command/markup.qh index 331e2a5d7..6cf09d3ed 100644 --- a/qcsrc/common/command/markup.qh +++ b/qcsrc/common/command/markup.qh @@ -1,7 +1,7 @@ -// ========================================================= -// Markup chat characters command code, reworked by Samual +// ========================================================== +// Declarations for markup command code, reworked by Samual // Last updated: December 28th, 2011 -// ========================================================= +// ========================================================== #define NUM_MARKUPS 41 float markup_init; diff --git a/qcsrc/common/command/rpn.qc b/qcsrc/common/command/rpn.qc index 5a50577a1..d6c624bbb 100644 --- a/qcsrc/common/command/rpn.qc +++ b/qcsrc/common/command/rpn.qc @@ -1,3 +1,8 @@ +// ======================================== +// RPN command code, written by divVerent +// Last updated: December 28th, 2011 +// ======================================== + string rpn_pop() { if(rpn_sp > 0) { diff --git a/qcsrc/common/command/rpn.qh b/qcsrc/common/command/rpn.qh index 5ae0b842b..6ffc5e1cb 100644 --- a/qcsrc/common/command/rpn.qh +++ b/qcsrc/common/command/rpn.qh @@ -1,3 +1,8 @@ +// ========================================================= +// Declarations for RPN command code, written by divVerent +// Last updated: December 28th, 2011 +// ========================================================= + #define MAX_RPN_STACK 16 float rpn_db; float rpn_error; diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 521db1a0a..4ba8e1185 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -1,6 +1,6 @@ // ========================================================= // Server side networked commands code, reworked by Samual -// Last updated: December 26th, 2011 +// Last updated: December 28th, 2011 // ========================================================= float SV_ParseClientCommand_floodcheck() @@ -546,23 +546,13 @@ 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("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("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 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("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") \ @@ -571,14 +561,8 @@ 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("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("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") \ /* nothing */ void ClientCommand_macro_help() @@ -603,12 +587,12 @@ float ClientCommand_macro_command(float argc, string command) return FALSE; } -float ClientCommand_macro_usage(float argc, string command) +float ClientCommand_macro_usage(float argc) { #define CLIENT_COMMAND(name,function,description) \ { if(name == strtolower(argv(1))) { function; return TRUE; } } - CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, command) + CLIENT_COMMANDS(CMD_REQUEST_USAGE, argc, "") #undef CLIENT_COMMAND return FALSE; @@ -649,22 +633,31 @@ void SV_ParseClientCommand(string command) return print("^1ERROR: ^7ANTISPAM CAUGHT: ", command, ".\n"); // "FALSE": not allowed to continue, halt } - /* NOTE: totally disabled for now for bandwidth/security reasons, 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) { - sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are:\n"); - ClientCommand_macro_help; - sprint(self, "For help about specific commands, type cmd help COMMAND\n"); + print("\nClient networked commands:\n"); + ClientCommand_macro_help(); + + print("\nCommon networked commands:\n"); + CommonCommand_macro_help(); + + sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n"); + sprint(self, "For help about a specific command, type cmd help COMMAND\n"); return; } - else if(ClientCommand_macro_usage(argc, command)) // Instead of trying to call a command, we're going to see detailed information about it + else if(CommonCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + { + return; + } + else if(ClientCommand_macro_usage(argc)) // same, but for normal commands now { return; } } - else*/ if(MUTATOR_CALLHOOK(SV_ParseClientCommand)) + else if(MUTATOR_CALLHOOK(SV_ParseClientCommand)) { return; // handled by a mutator } @@ -672,6 +665,10 @@ void SV_ParseClientCommand(string command) { return; // handled by server/cheats.qc } + else if(CommonCommand_macro_command(argc, command)) + { + return; // handled by server/command/common.qc + } else if(ClientCommand_macro_command(argc, command)) // continue as usual and scan for normal commands { return; // handled by one of the above ClientCommand_* functions diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 3e8d8e7e6..821bf15c8 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -659,4 +659,61 @@ void CommonCommand_(float request, entity caller) } } } -*/ \ No newline at end of file +*/ + + +// ================================== +// Macro system for common commands +// ================================== + +// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;) +#define COMMON_COMMANDS(request,arguments,command) \ + COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, world), "Prints a list of all changed server cvars") \ + COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, world), "Prints a list of all changed gameplay cvars") \ + COMMON_COMMAND("info", CommonCommand_info(request, world, arguments), "Request for unique server information set up by admin") \ + COMMON_COMMAND("ladder", CommonCommand_ladder(request, world), "Get information about top players if supported") \ + COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, world), "List maps which can be used with the current game mode") \ + COMMON_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, world), "List maps which have no records or are seemingly unplayed yet") \ + COMMON_COMMAND("maplist", CommonCommand_maplist(request, world), "Display full server maplist reply") \ + COMMON_COMMAND("rankings", CommonCommand_rankings(request, world), "Print information about rankings") \ + COMMON_COMMAND("records", CommonCommand_records(request, world), "List top 10 records for the current map") \ + COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, world), "Show information about player and team scores") \ + COMMON_COMMAND("time", CommonCommand_time(request, world), "Print different formats/readouts of time") \ + COMMON_COMMAND("timein", CommonCommand_timein(request, world), "Resume the game from being paused with a timeout") \ + COMMON_COMMAND("timeout", CommonCommand_timeout(request, world), "Call a timeout which pauses the game for certain amount of time unless unpaused") \ + COMMON_COMMAND("vote", VoteCommand(request, world, arguments, command), "Request an action to be voted upon by players") \ + COMMON_COMMAND("who", CommonCommand_who(request, world, arguments), "Display detailed client information about all players") \ + /* nothing */ + +void CommonCommand_macro_help() +{ + #define COMMON_COMMAND(name,function,description) \ + { print(" ^2", name, "^7: ", description, "\n"); } + + COMMON_COMMANDS(0, 0, "") + #undef COMMON_COMMAND + + return; +} + +float CommonCommand_macro_command(float argc, string command) +{ + #define COMMON_COMMAND(name,function,description) \ + { if(name == strtolower(argv(0))) { function; return TRUE; } } + + COMMON_COMMANDS(CMD_REQUEST_COMMAND, argc, command) + #undef COMMON_COMMAND + + return FALSE; +} + +float CommonCommand_macro_usage(float argc) +{ + #define COMMON_COMMAND(name,function,description) \ + { if(name == strtolower(argv(1))) { function; return TRUE; } } + + COMMON_COMMANDS(CMD_REQUEST_USAGE, argc, "") + #undef COMMON_COMMAND + + return FALSE; +} diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index c553d88e7..ec756d451 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1,6 +1,6 @@ // ===================================================== // Server side game commands code, reworked by Samual -// Last updated: December 25th, 2011 +// Last updated: December 28th, 2011 // ===================================================== // used by GameCommand_make_mapinfo() @@ -61,34 +61,6 @@ void changematchtime(float delta, float mi, float ma) cvar_set("timelimit", ftos(new / 60)); } -// used by GameCommand_modelbug() // Samual: is this even needed? -float g_clientmodel_genericsendentity (entity to, float sf); -void modelbug_make_svqc(); -void modelbug_make_csqc() -{ - Net_LinkEntity(self, TRUE, 0, g_clientmodel_genericsendentity); - self.think = modelbug_make_svqc; - self.nextthink = time + 1; - setorigin(self, self.origin - '0 0 8'); -} -void modelbug_make_svqc() -{ - self.SendEntity = func_null; - self.think = modelbug_make_csqc; - self.nextthink = time + 1; - setorigin(self, self.origin + '0 0 8'); -} -void modelbug() -{ - entity e; - e = spawn(); - setorigin(e, nextent(world).origin); - precache_model("models_portal.md3"); - setmodel(e, "models/portal.md3"); - e.think = modelbug_make_svqc; - e.nextthink = time + 1; -} - // ======================= // Command Sub-Functions @@ -912,26 +884,6 @@ void GameCommand_make_mapinfo(float request) // legacy } } -void GameCommand_modelbug(float request) // legacy -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - modelbug(); - return; - } - - default: - case CMD_REQUEST_USAGE: - { - print("\nUsage:^3 sv_cmd modelbug\n"); - print(" No arguments required.\n"); - return; - } - } -} - void GameCommand_moveplayer(float request, float argc) { switch(request) @@ -1100,27 +1052,6 @@ void GameCommand_nospectators(float request) // legacy } } -void GameCommand_onslaught_updatelinks(float request) // legacy // should this be here? Perhaps some mutatorhook call instead.... -{ - switch(request) - { - case CMD_REQUEST_COMMAND: - { - onslaught_updatelinks(); - print("ONS links updated\n"); - return; - } - - default: - case CMD_REQUEST_USAGE: - { - print("\nUsage:^3 sv_cmd onslaught_updatelinks\n"); - print(" No arguments required.\n"); - return; - } - } -} - void GameCommand_playerdemo(float request, float argc) // mostly legacy { switch(request) @@ -1722,8 +1653,6 @@ void GameCommand_(float request) SERVER_COMMAND("bbox", GameCommand_bbox(request), "Print detailed information about world size") \ SERVER_COMMAND("bot_cmd", GameCommand_bot_cmd(request, arguments), "Control and send commands to bots") \ SERVER_COMMAND("cointoss", GameCommand_cointoss(request, arguments), "Flip a virtual coin and give random result") \ - SERVER_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, world), "Prints a list of all changed server cvars") \ - SERVER_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, world), "Prints a list of all changed gameplay cvars") \ SERVER_COMMAND("database", GameCommand_database(request, arguments), "Extra controls of the serverprogs database") \ SERVER_COMMAND("defer_clear", GameCommand_defer_clear(request, arguments), "Clear all queued defer commands for a specific client") \ SERVER_COMMAND("defer_clear_all", GameCommand_defer_clear_all(request), "Clear all queued defer commands for all clients") \ @@ -1734,35 +1663,20 @@ void GameCommand_(float request) SERVER_COMMAND("gametype", GameCommand_gametype(request, arguments), "Simple command to change the active gametype") \ SERVER_COMMAND("gettaginfo", GameCommand_gettaginfo(request, arguments), "Get specific information about a weapon model") \ SERVER_COMMAND("gotomap", GameCommand_gotomap(request, arguments), "Simple command to switch to another map") \ - SERVER_COMMAND("info", CommonCommand_info(request, world, arguments), "Request for unique server information set up by admin") \ - SERVER_COMMAND("ladder", CommonCommand_ladder(request, world), "Get information about top players if supported") \ SERVER_COMMAND("lockteams", GameCommand_lockteams(request), "Disable the ability for players to switch or enter teams") \ - SERVER_COMMAND("lsmaps", CommonCommand_lsmaps(request, world), "List maps which can be used with the current game mode") \ - SERVER_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, world), "List maps which have no records or are seemingly unplayed yet") \ SERVER_COMMAND("make_mapinfo", GameCommand_make_mapinfo(request), "Automatically rebuild mapinfo files") \ - SERVER_COMMAND("maplist", CommonCommand_maplist(request, world), "Display full server maplist reply") \ - SERVER_COMMAND("modelbug", GameCommand_modelbug(request), "Debugging tool for developers with weapon models") \ SERVER_COMMAND("moveplayer", GameCommand_moveplayer(request, arguments), "Change the team/status of a player") \ SERVER_COMMAND("nospectators", GameCommand_nospectators(request), "Automatically remove spectators from a match") \ - SERVER_COMMAND("onslaught_updatelinks", GameCommand_onslaught_updatelinks(request), "Refresh link status for onslaught") \ SERVER_COMMAND("playerdemo", GameCommand_playerdemo(request, arguments), "Control the ability to save demos of players") \ SERVER_COMMAND("printstats", GameCommand_printstats(request), "Dump eventlog player stats and other score information") \ SERVER_COMMAND("radarmap", GameCommand_radarmap(request, arguments), "Generate a radar image of the map") \ - SERVER_COMMAND("rankings", CommonCommand_rankings(request, world), "Print information about rankings") \ - SERVER_COMMAND("records", CommonCommand_records(request, world), "List top 10 records for the current map") \ SERVER_COMMAND("reducematchtime", GameCommand_reducematchtime(request), "Decrease the timelimit value incrementally") \ SERVER_COMMAND("setbots", GameCommand_setbots(request, arguments), "Adjust how many bots are in the match") \ SERVER_COMMAND("shuffleteams", GameCommand_shuffleteams(request), "Randomly move players to different teams") \ SERVER_COMMAND("stuffto", GameCommand_stuffto(request, arguments), "Send a command to be executed on a client") \ - SERVER_COMMAND("teamstatus", CommonCommand_teamstatus(request, world), "Show information about player and team scores") \ - SERVER_COMMAND("time", CommonCommand_time(request, world), "Print different formats/readouts of time") \ - SERVER_COMMAND("timein", CommonCommand_timein(request, world), "Resume the game from being paused with a timeout") \ - SERVER_COMMAND("timeout", CommonCommand_timeout(request, world), "Call a timeout which pauses the game for certain amount of time unless unpaused") \ SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \ SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \ SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \ - SERVER_COMMAND("vote", VoteCommand(request, world, arguments, command), "Server side control of voting") \ - SERVER_COMMAND("who", CommonCommand_who(request, world, arguments), "Display detailed client information about all players") \ /* nothing */ void GameCommand_macro_help() @@ -1817,26 +1731,47 @@ void GameCommand(string command) { if(argc == 1) { - print("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are:\n"); + print("\nServer console commands:\n"); GameCommand_macro_help(); + print("\nBanning commands:\n"); GameCommand_Ban("help"); - GenericCommand("help"); - print("For help about specific commands, type sv_cmd help COMMAND\n"); + + print("\nCommon networked commands:\n"); + CommonCommand_macro_help(); + + print("\nGeneric commands shared by all programs:\n"); + GenericCommand_macro_help(); + + print("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n"); + print("For help about a specific command, type sv_cmd help COMMAND\n"); + return; } - else if(GameCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + else if(CommonCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it + { + return; + } + else if(GenericCommand_macro_usage(argc)) // same here, but for generic commands instead + { + return; + } + else if(GameCommand_macro_usage(argc)) // finally try for normal commands too { return; } } else if(GameCommand_Ban(command)) { - return; // handled by server/ipban.qc + return; // handled by server/command/ipban.qc + } + else if(CommonCommand_macro_command(argc, command)) + { + return; // handled by server/command/common.qc } else if(GenericCommand(command)) { - return; // handled by common/gamecommand.qc + return; // handled by common/command/generic.qc } else if(GameCommand_macro_command(argc, command)) // continue as usual and scan for normal commands { diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 691407706..748b7ce6d 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -38,6 +38,7 @@ string vote_parsed_display; // visual string which is fixed after being parsed // allow functions to be used in other code like g_world.qc and teamplay.qc void VoteThink(); void VoteReset(); +void VoteCommand(float request, entity caller, float argc, string vote_command); // warmup and nagger stuff #define RESTART_COUNTDOWN 10 -- 2.39.2