]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added announcer for pickups in CTF
authorz411 <z411@omaera.org>
Tue, 10 Nov 2020 11:20:27 +0000 (08:20 -0300)
committerz411 <z411@omaera.org>
Tue, 10 Nov 2020 11:20:27 +0000 (08:20 -0300)
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/notifications/all.inc

index b017718088704c9d0168aa402e6670a8838385cc..fbe6cbc1eeaf042a3c0cbbabb0b70f51cdbcdbb4 100644 (file)
@@ -610,6 +610,13 @@ void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
        new_time = TIME_ENCODE(time - enemy_flag.ctf_pickuptime);
        if(!old_time || new_time < old_time)
                GameRules_scoring_add(player, CTF_CAPTIME, new_time - old_time);
+       
+       // announcer
+       WinningConditionHelper(NULL);
+       if (Score_NewLeader())
+               AnnounceNewLeader();
+       else
+               Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, APP_TEAM_NUM(player.team, ANNCE_TEAM_SCORES));
 
        // effects
        Send_Effect_(flag.capeffect, flag.origin, '0 0 0', 1);
@@ -719,11 +726,15 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        if(!flag.team)
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PICKUP_NEUTRAL);
        else if(CTF_DIFFTEAM(player, flag))
+       {
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, APP_TEAM_NUM(flag.team, CENTER_CTF_PICKUP));
+               Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_CTF_PICKUP);
+       }
        else
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((SAME_TEAM(player, flag)) ? CENTER_CTF_PICKUP_RETURN : CENTER_CTF_PICKUP_RETURN_ENEMY), Team_ColorCode(flag.team));
 
        Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_CHOICE, APP_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
+       Send_Notification(NOTIF_TEAM_EXCEPT, player, MSG_ANNCE, ANNCE_CTF_PICKUP_TEAM);
 
        if(!flag.team)
                FOREACH_CLIENT(IS_PLAYER(it) && it != player && DIFF_TEAM(it, player), { Send_Notification(NOTIF_ONE, it, MSG_CHOICE, CHOICE_CTF_PICKUP_ENEMY_NEUTRAL, Team_ColorCode(player.team), player.netname); });
@@ -732,10 +743,13 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
                FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
                        if(CTF_SAMETEAM(flag, it))
                        {
-                               if(SAME_TEAM(player, it))
+                               if(SAME_TEAM(player, it)) {
                                        Send_Notification(NOTIF_ONE, it, MSG_CHOICE, APP_TEAM_NUM(flag.team, CHOICE_CTF_PICKUP_TEAM), Team_ColorCode(player.team), player.netname);
-                               else
+                                       Send_Notification(NOTIF_ONE, it, MSG_ANNCE, ANNCE_CTF_PICKUP_TEAM);
+                               } else {
                                        Send_Notification(NOTIF_ONE, it, MSG_CHOICE, ((SAME_TEAM(flag, player)) ? CHOICE_CTF_PICKUP_ENEMY_TEAM : CHOICE_CTF_PICKUP_ENEMY), Team_ColorCode(player.team), player.netname);
+                                       Send_Notification(NOTIF_ONE, it, MSG_ANNCE, ANNCE_CTF_PICKUP_ENEMY);
+                               }
                        }
                });
 
index e4196239b5ecec0beec1718a7e6d9a318ba9a551..a1fabf945eea27fe4e52e18ea794b1c64ec60887 100644 (file)
        MSG_ANNCE_NOTIF(ROUND_OVER,                 N__ALWAYS, "round_over",        CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
        MSG_ANNCE_NOTIF(ROUND_TIED,                 N__ALWAYS, "round_tied",        CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
        MSG_ANNCE_NOTIF(ALONE,                      N__ALWAYS, "alone",             CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
+       
+       MSG_ANNCE_NOTIF(CTF_PICKUP,                 N__ALWAYS, "ctf_pickup",        CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
+       MSG_ANNCE_NOTIF(CTF_PICKUP_TEAM,            N__ALWAYS, "ctf_pickup_team",   CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
+       MSG_ANNCE_NOTIF(CTF_PICKUP_ENEMY,           N__ALWAYS, "ctf_pickup_enemy",  CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
 
 // MSG_MEDAL_NOTIFICATIONS