]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Retract from queue by spectating
authorz411 <z411@omaera.org>
Sun, 28 May 2023 06:36:34 +0000 (02:36 -0400)
committerz411 <z411@omaera.org>
Sun, 28 May 2023 06:36:34 +0000 (02:36 -0400)
qcsrc/common/notifications/all.inc
qcsrc/server/clientkill.qc
qcsrc/server/command/cmd.qc
qcsrc/server/teamplay.qc

index 52be4acffb585c4ffa7a417174524d5f914cdfa1..cbcf5aa059e21b7b0a700ed1dffb7e193e88b5f6 100644 (file)
@@ -786,6 +786,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MSG_CENTER_NOTIF(TIMEOUT_ENDING,                    N_ENABLE,    0, 1, "",               CPID_TIMEIN,            "1 f1", _("^F4Timeout ends in ^COUNT"), "")
 
     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_Null,              "0 0",  _("^BGYou are now queued to join the game."), "")
 
     MSG_CENTER_NOTIF(VEHICLE_ENTER,                     N_ENABLE,    0, 0, "pass_key",       CPID_VEHICLES,          "0 0",  _("^BGPress ^F2%s^BG to enter/exit the vehicle"), "")
     MSG_CENTER_NOTIF(VEHICLE_ENTER_GUNNER,              N_ENABLE,    0, 0, "pass_key",       CPID_VEHICLES,          "0 0",  _("^BGPress ^F2%s^BG to enter the vehicle gunner"), "")
index 296a95bfe5f384c9d8428626f0a1cbd0282fff2f..660d02e36cfb59fd9f63bfed306a94e730137bea 100644 (file)
@@ -25,7 +25,11 @@ void ClientKill_Now_TeamChange(entity this)
        {
                if (blockSpectators)
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
-               PutObserverInServer(this, false, true);
+
+               if (CS(this).wants_join)
+                       SetPlayerTeam(this, -1, TEAM_CHANGE_SPECTATOR);
+               else
+                       PutObserverInServer(this, false, true);
        }
        else
        {
index 947edd891e96e4b171396a5bc054019bcbd76668..67016dd89926f379eec297c4b8ba7ec8d9561b09 100644 (file)
@@ -593,7 +593,7 @@ void ClientCommand_spectate(entity caller, int request)
 
                                if (mutator_returnvalue == MUT_SPECCMD_RETURN) return;
 
-                               if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE))
+                               if ((IS_PLAYER(caller) || mutator_returnvalue == MUT_SPECCMD_FORCE || CS(caller).wants_join))
                                if (autocvar_sv_spectate == 1)
                                        ClientKill_TeamChange(caller, -2); // observe
                        }
index 18e2060e575039524f681d3dd613c0fa21fad177..89d9ad1cf2262f863558c89063f4f408a0083f32 100644 (file)
@@ -276,6 +276,7 @@ bool SetPlayerTeam(entity player, int team_index, int type)
                        if (IsQueueNeeded(player) && !SpectatorWantsJoin(player))
                        {
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(player.team, INFO_JOIN_WANTS_TEAM), player.netname);
+                               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_JOIN_PREVENT_QUEUE);
                                CS(player).wants_join = true; // TODO : Refactor
                        }
                        else
@@ -291,6 +292,11 @@ bool SetPlayerTeam(entity player, int team_index, int type)
                        Kill_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CPID_IDLING);
                        CS(player).idlekick_lasttimeleft = 0;
                }
+               else if (CS(player).wants_join)
+               {
+                       CS(player).wants_join = false;
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, player.netname);
+               }
                else if (!CS(player).just_joined && player.frags != FRAGS_SPECTATOR)
                {
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, player.netname);