From: bones_was_here Date: Fri, 14 Jun 2024 07:54:46 +0000 (+1000) Subject: join queue: fix HUD infomessage, improve consistency and clarity of notifications X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5bf4bb1dd2ce71d8ebfbfe2683d2a401b0e07685;p=xonotic%2Fxonotic-data.pk3dir.git join queue: fix HUD infomessage, improve consistency and clarity of notifications 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). --- diff --git a/qcsrc/client/hud/panel/infomessages.qc b/qcsrc/client/hud/panel/infomessages.qc index f68e8722c..2774d6498 100644 --- a/qcsrc/client/hud/panel/infomessages.qc +++ b/qcsrc/client/hud/panel/infomessages.qc @@ -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); diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index d8e6fd238..cca9b7015 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -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, diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 8db1de4f6..0b4c0402d 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -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!"), "") diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index df39de0c4..2bff39359 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -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);