From: terencehill Date: Tue, 24 Sep 2024 15:45:15 +0000 (+0200) Subject: When sending an empty message, show a list of players and allow selecting a player... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fterencehill%2Fchat_player_name_selection;p=xonotic%2Fxonotic-data.pk3dir.git When sending an empty message, show a list of players and allow selecting a player to whom to send a message --- diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 710245445..1328e5657 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -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") diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 25a8c1b67..d5e4b6a6d 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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 }