]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
When sending an empty message, show a list of players and allow selecting a player... terencehill/chat_player_name_selection
authorterencehill <piuntn@gmail.com>
Tue, 24 Sep 2024 15:45:15 +0000 (17:45 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 24 Sep 2024 15:45:15 +0000 (17:45 +0200)
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/server/command/cmd.qc

index 710245445046c94e1c9a6e1f3dfd6a6cc5a0e19d..1328e5657075e54b5c9b7f09ad4d7d3cfcff7863 100644 (file)
@@ -774,15 +774,20 @@ void HUD_QuickMenu()
        } \
 }
 
-#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
-       if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
-               QUICKMENU_SMENU(submenu,eng_submenu) \
-               QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
+#define QUICKMENU_ENTRY_PL(title,command) { \
+       if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
+       { \
+               QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
                ++QuickMenu_Buffer_Size; \
                QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
-               ++QuickMenu_Buffer_Size; \
-               QUICKMENU_SMENU(submenu,eng_submenu) \
        } \
+       ++QuickMenu_Buffer_Size; \
+}
+
+#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
+       QUICKMENU_SMENU(submenu,eng_submenu) \
+       QUICKMENU_ENTRY_PL(strcat(ftos(teamplayers), ftos(without_me)), command) \
+       QUICKMENU_SMENU(submenu,eng_submenu) \
 }
 
 
@@ -843,6 +848,9 @@ void QuickMenu_Default(string target_submenu)
 
        QUICKMENU_SMENU(_("Chat"), "Chat")
                QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send public message to")), "Send public message to", "commandmode say %s:^7", 0, 1)
+               QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send team message to")), "Send team message to", "commandmode say_team %s:^7", 1, 1)
+               QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
+
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
                QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
@@ -871,8 +879,6 @@ void QuickMenu_Default(string target_submenu)
        QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
        }
 
-       QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
-
        QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
                QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
                        QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
index 25a8c1b67676dd0ee5bbb383bea2e36233208689..d5e4b6a6d0d4d7df55a75cc142d4a56b2430a1f7 100644 (file)
@@ -510,7 +510,10 @@ void ClientCommand_say(entity caller, int request, int argc, string command)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (argc >= 2)   Say(caller, false, NULL, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
+                       if (argc >= 2)
+                               Say(caller, false, NULL, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
+                       else // if the message is empty show a list of players and allow selecting a player to whom to send a message
+                               stuffcmd(caller, "quickmenu default \"Send public message to\"\n");
                        return;  // never fall through to usage
                }
 
@@ -532,6 +535,8 @@ void ClientCommand_say_team(entity caller, int request, int argc, string command
                {
                        if (argc >= 2)
                                Say(caller, true, NULL, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), 1);
+                       else // if the message is empty show a list of players and allow selecting a player to whom to send a message
+                               stuffcmd(caller, "quickmenu default \"Send team message to\"\n");
                        return;  // never fall through to usage
                }