]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add possibility to load a customized quickmenu file provided by the server in a serve...
authorterencehill <piuntn@gmail.com>
Fri, 6 May 2022 15:55:34 +0000 (17:55 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 6 May 2022 15:55:34 +0000 (17:55 +0200)
_hud_common.cfg
qcsrc/client/command/cl_cmd.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/quickmenu.qh
qcsrc/server/client.qc
qcsrc/server/client.qh
xonotic-server.cfg

index 5fdba67215a5ebebce6c9bb2c89e8d92bbd9de9d..74f48a6aa5b408a337eccc5cf9cf1390bab969bc 100644 (file)
@@ -110,6 +110,7 @@ seta hud_panel_itemstime_progressbar_maxtime "30" "when left time is at least th
 seta hud_panel_itemstime_hidespawned "1" "if 1 hide an item from the panel when all the occurrences of it are available again; if 2 hide it when at least one occurrence is available again"
 seta hud_panel_itemstime_hidebig "0" "if 1 hide big armor and health from the panel"
 
+set _hud_panel_quickmenu_file_from_server "" "reserved cvar set by the server with a custom server quickmenu file that appears in the default quickmenu"
 seta hud_panel_quickmenu_file "" "load the quick menu from this file (empty or 0 to disable)"
 seta hud_panel_quickmenu_translatecommands 0 "when the game is translated, translate strings inside commands too (useful for chat commands)"
 seta hud_panel_quickmenu_time 5 "quickmenu expires after this number of seconds in the same page"
index 49683b50db3d934d9770facb4f13493576b178ff..0f8a69e727d6b43c48bb9eaf17c6ed1a78029e20 100644 (file)
@@ -267,7 +267,7 @@ void LocalCommand_hud(int request, int argc)
                                {
                                        if (argv(2) == "help")
                                        {
-                                               LOG_HELP(" quickmenu [[default | file | \"\"] submenu file]");
+                                               LOG_HELP(" quickmenu [[default | file | \"\"] <submenu> <filename>]");
                                                LOG_HELP("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.");
                                                LOG_HELP("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.");
                                                LOG_HELP("A file name can also be given to open a different quickmenu");
index 01fae6e0203104e2df63874db8581b32bdced4b5..695a58fb04bc3ffbaecddeb8741a48139c41c59d 100644 (file)
@@ -872,6 +872,12 @@ void QuickMenu_Default(string target_submenu)
                QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
        QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
 
+       if (autocvar__hud_panel_quickmenu_file_from_server != "")
+       {
+       // TODO make it translatable
+       QUICKMENU_ENTRY("Server's custom quickmenu", "quickmenu; wait; quickmenu \"\" \"\" $_hud_panel_quickmenu_file_from_server")
+       }
+
        if(spectatee_status != 0)
        {
        QUICKMENU_SMENU_PL(CTX(_("QMCMD^Spectate a player")), "Spectate a player", "spectate \"%s^7\"", 0, 1)
index 3b6a1fe721b910f7bbe436fbbb2536ee6bd36e2a..249b5121f60256c217ba14115d39ad07ce806ae1 100644 (file)
@@ -6,6 +6,7 @@ float autocvar_hud_panel_quickmenu_align;
 float autocvar_hud_panel_quickmenu_translatecommands;
 string autocvar_hud_panel_quickmenu_file;
 float autocvar_hud_panel_quickmenu_time;
+string autocvar__hud_panel_quickmenu_file_from_server;
 
 bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
 bool QuickMenu_IsOpened();
index cab642e67fd9b0f8e65a3eafedb54800e8cc3927..88691ae39e4fe58091207030744a63eef5643c22 100644 (file)
@@ -1145,6 +1145,10 @@ void ClientConnect(entity this)
        {
                if (g_weaponarena_weapons == WEPSET(TUBA))
                        stuffcmd(this, "cl_cmd settemp chase_active 1\n");
+               // quickmenu file must be put in a subfolder with an unique name
+               // to reduce chances of overriding custom client quickmenus
+               if (autocvar_sv_quickmenu_file != "" && strstrofs(autocvar_sv_quickmenu_file, "/", 0) && fexists(autocvar_sv_quickmenu_file))
+                       stuffcmd(this, sprintf("cl_cmd settemp _hud_panel_quickmenu_file_from_server %s\n", autocvar_sv_quickmenu_file));
        }
 
        if (!autocvar_sv_foginterval && world.fog != "")
index 5fc5422c63f7e55e5d4316f1a91fad7f3b0bdce5..69bf720db0be48e5cea4c3bf3389baa44ca06029 100644 (file)
@@ -50,11 +50,12 @@ string autocvar_hostname;
 int autocvar_spawn_debug;
 string autocvar_sv_motd;
 int autocvar_sv_name_maxlength = 64;
+string autocvar_sv_quickmenu_file;
 bool autocvar_sv_servermodelsonly;
+bool autocvar_sv_showspectators;
 int autocvar_sv_spectate;
 bool autocvar_sv_teamnagger;
 float autocvar_sv_player_scale;
-bool autocvar_sv_showspectators;
 
 // WEAPONTODO
 .string weaponorder_byimpulse;
index 8593149805835749a9dc9848804a7113836a6f5b..334f749a2552baf0ab69165c106bbbb2aad469c8 100644 (file)
@@ -595,3 +595,5 @@ set sv_warpzone_allow_selftarget 0 "do not touch"
 
 // don't notify cvar changes in the chat
 sv_disablenotify 1
+
+set sv_quickmenu_file "" "filename of the quickmenu that appears in client's default quickmenu, file must be located in a subfolder with an unique name"