]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
join queue: fix HUD infomessage, improve consistency and clarity of notifications
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 14 Jun 2024 07:54:46 +0000 (17:54 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 5 Aug 2024 16:26:26 +0000 (02:26 +1000)
The state of having no team preference (deferred autoselect) was
implemented in 624a242e556387367d088dc2cde847989c0fd321 but it wasn't
correctly declared and networked and displayed in the HUD info panel (it
said you're queued to join the Neutral team).

qcsrc/client/hud/panel/infomessages.qc
qcsrc/common/ent_cs.qc
qcsrc/common/notifications/all.inc
qcsrc/server/client.qh

index f68e8722cced6d62a8bbfcfde5df2c49143478e0..2774d64983b31eec4325821072f0014c74ac0831 100644 (file)
@@ -127,11 +127,14 @@ void HUD_InfoMessages()
 
                        if(!mutator_returnvalue)
                        {
-                               if(entcs_GetWantsJoin(current_player))
+                               int tm = entcs_GetWantsJoin(current_player);
+                               if(tm > 0)
                                {
-                                       int tm = Team_IndexToTeam(entcs_GetWantsJoin(current_player));
+                                       tm = Team_IndexToTeam(tm);
                                        s = sprintf(_("^2You're queued to join the %s%s^2 team"), Team_ColorCode(tm), Team_ColorName(tm));
                                }
+                               else if (tm < 0)
+                                       s = sprintf(_("^2You're queued to join any available team"));
                                else
                                        s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey(_("jump"), "+jump"));
                                InfoMessage(s);
index d8e6fd23870d98b377f8331b65d367bfbfb310d3..cca9b70150df8d53d5b44c6032bb5d83df318a51 100644 (file)
@@ -152,9 +152,10 @@ ENTCS_PROP(FRAGS, true, frags, frags, ENTCS_SET_NORMAL,
        { WriteShort(chan, ent.frags); },
        { ent.frags = ReadShort(); })
 
+// index of join queue team selection, max 127 because -1 means any available team
 ENTCS_PROP(WANTSJOIN, true, wants_join, wants_join, ENTCS_SET_NORMAL,
-       { WriteByte(chan, ent.wants_join); },
-       { ent.wants_join = ReadByte(); })
+       { WriteChar(chan, ent.wants_join); },
+       { ent.wants_join = ReadChar(); })
 
 // use sv_solid to avoid changing solidity state of entcs entities
 ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
index 8db1de4f6a6ab82881e635c075111c86709d4015..0b4c0402d29ad1a0aec4543d1a5f5156c7dc362f 100644 (file)
@@ -427,13 +427,13 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_INFO_NOTIF(QUIT_DISCONNECT,                         N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 disconnected"), "")
     MSG_INFO_NOTIF(QUIT_KICK_IDLING,                        N_CHATCON,  1, 1, "s1 f1", "",      "",             _("^BG%s^F3 was kicked after idling for %s seconds"), "")
     MSG_INFO_NOTIF(MOVETOSPEC_IDLING,                       N_CHATCON,  1, 1, "s1 f1", "",      "",             _("^BG%s^F3 was moved to^BG spectators^F3 after idling for %s seconds"), "")
-    MSG_INFO_NOTIF(MOVETOSPEC_IDLING_QUEUE,                 N_CHATCON,  1, 1, "s1 f1", "",      "",             _("^BG%s^F3 has left the queue after idling for %s seconds"), "")
+    MSG_INFO_NOTIF(MOVETOSPEC_IDLING_QUEUE,                 N_CHATCON,  1, 1, "s1 f1", "",      "",             _("^BG%s^F3 has left the join queue after idling for %s seconds"), "")
     MSG_INFO_NOTIF(MOVETOSPEC_REMOVE,                       N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 was moved to^BG spectators^F3 for balance reasons"), "")
     MSG_INFO_NOTIF(QUIT_KICK_SPECTATING,                    N_CONSOLE,  0, 0, "", "",           "",             _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment."), "")
     MSG_INFO_NOTIF(QUIT_KICK_TEAMKILL,                      N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 was kicked for excessive teamkilling"), "")
     MSG_INFO_NOTIF(QUIT_PLAYBAN_TEAMKILL,                   N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 was forced to spectate for excessive teamkilling"), "")
     MSG_INFO_NOTIF(QUIT_SPECTATE,                           N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 is now^BG spectating"), "")
-    MSG_INFO_NOTIF(QUIT_QUEUE,                              N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 has left the queue"), "")
+    MSG_INFO_NOTIF(QUIT_QUEUE,                              N_CHATCON,  1, 0, "s1", "",         "",             _("^BG%s^F3 has left the join queue"), "")
 
     MSG_INFO_NOTIF(RACE_ABANDONED,                          N_CONSOLE,  1, 0, "s1", "",                                                                     "",                         _("^BG%s^BG has abandoned the race"), "")
     MSG_INFO_NOTIF(RACE_FAIL_RANKED,                        N_CONSOLE,  1, 3, "s1 race_col f1ord race_col f3race_time race_diff", "s1 f3race_time",         "race_newfail",             _("^BG%s^BG couldn't break their %s%s^BG place record of %s%s %s"), "")
@@ -723,8 +723,8 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_CENTER_NOTIF(JOIN_PLAYBAN,                      N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  BOLD(_("^K1You aren't allowed to play because you are banned in this server")), "")
     MSG_CENTER_NOTIF(JOIN_PREVENT,                      N_ENABLE,    0, 1, "f1",             CPID_PREVENT_JOIN,      "0 0",  _("^K1You may not join the game at this time.\nThis match is limited to ^F2%s^BG players."), "")
     MSG_CENTER_NOTIF(JOIN_PREVENT_MINIGAME,             N_ENABLE,    0, 0, "",               CPID_Null,              "0 0",  _("^K1Cannot join given minigame session!"), "" )
-    MSG_CENTER_NOTIF(JOIN_PREVENT_QUEUE,                N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^BGYou are now queued to join the game."), "")
-    MULTITEAM_CENTER(JOIN_PREVENT_QUEUE_TEAM,           N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^BGYou are now queued to join on ^TC^TT^BG team."), "", NAME)
+    MSG_CENTER_NOTIF(JOIN_PREVENT_QUEUE,                N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^BGYou're queued to join any available team."), "")
+    MULTITEAM_CENTER(JOIN_PREVENT_QUEUE_TEAM,           N_ENABLE,    0, 0, "",               CPID_PREVENT_JOIN,      "0 0",  _("^BGYou're queued to join the ^TC^TT^BG team."), "", NAME)
     MULTITEAM_CENTER(JOIN_PREVENT_QUEUE_TEAM_FAIL,      N_ENABLE,    1, 0, "s1",             CPID_PREVENT_JOIN,      "0 0",  _("^K2Please choose a different team! %s^K2 chose ^TC^TT^K2 first."), "", NAME)
 
     MSG_CENTER_NOTIF(KEEPAWAY_DROPPED,                  N_ENABLE,    1, 0, "s1",             CPID_KEEPAWAY,          "0 0",  _("^BG%s^BG has dropped the ball!"), "")
index df39de0c45c3659384afa39f156832e7a7117816..2bff393590cb278b38e61c70a3611df4de903a50 100644 (file)
@@ -74,7 +74,8 @@ float autocvar_sv_player_scale;
 
 .bool team_selected;
 .bool just_joined;
-.bool wants_join;
+/// > 0 is a team index, -1 means team selection is deferred until Join()
+.int wants_join;
 
 .int pressedkeys;
 
@@ -160,7 +161,7 @@ CLASS(Client, Object)
     ATTRIB(Client, teamkill_soundsource, entity, this.teamkill_soundsource);
     ATTRIB(Client, usekeypressed, bool, this.usekeypressed);
     ATTRIB(Client, jointime, float, this.jointime);
-    ATTRIB(Client, wants_join, bool, this.wants_join);
+    ATTRIB(Client, wants_join, int, this.wants_join);
     ATTRIB(Client, spectatortime, float, this.spectatortime);
     ATTRIB(Client, startplaytime, float, this.startplaytime);
     ATTRIB(Client, version_nagtime, float, this.version_nagtime);