]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Notifications: Implemented NOTIF_ALL_SPEC, NOTIF_TEAM_ONLY and NOTIF_TEAM_ONLY_EXCEPT
authorz411 <z411@omaera.org>
Wed, 11 Nov 2020 05:50:05 +0000 (02:50 -0300)
committerz411 <z411@omaera.org>
Wed, 11 Nov 2020 05:50:05 +0000 (02:50 -0300)
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qc
qcsrc/common/notifications/all.qh

index fbe6cbc1eeaf042a3c0cbbabb0b70f51cdbcdbb4..f285d6270305a1dd50eb821a39303f43fb2cde73 100644 (file)
@@ -721,6 +721,8 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
 
        // messages and sounds
        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_PICKUP), player.netname);
+       Send_Notification(NOTIF_ALL_SPEC, NULL, MSG_ANNCE, APP_TEAM_NUM(flag.team, ANNCE_CTF_SPEC_PICKUP));
+       
        if(ctf_stalemate)
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_STALEMATE_CARRIER);
        if(!flag.team)
@@ -728,13 +730,13 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        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);
+               Send_Notification(NOTIF_ONE_ONLY, 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);
+       Send_Notification(NOTIF_TEAM_ONLY_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); });
@@ -745,10 +747,10 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
                        {
                                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);
-                                       Send_Notification(NOTIF_ONE, it, MSG_ANNCE, ANNCE_CTF_PICKUP_TEAM);
+                                       Send_Notification(NOTIF_ONE_ONLY, 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);
+                                       Send_Notification(NOTIF_ONE_ONLY, it, MSG_ANNCE, ANNCE_CTF_PICKUP_ENEMY);
                                }
                        }
                });
index a1fabf945eea27fe4e52e18ea794b1c64ec60887..9bbf7fac728be6d1f9db39fc5acabb7c87a1c13f 100644 (file)
        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)
+       MULTITEAM_ANNCE(CTF_SPEC_PICKUP,                        N__ALWAYS, "ctf_spec_pickup_%s",CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
 
 // MSG_MEDAL_NOTIFICATIONS
 
index 9fb158dbb1391c7b7174aad1ecdf2d1c030f3c95..366b3dae4e6a5dcb5af399140eff0b4706c7c2b5 100644 (file)
@@ -41,6 +41,7 @@ string Notification_CheckArgs(
                        break;
                }
 
+               case NOTIF_ALL_SPEC:
                case NOTIF_ALL:
                {
                        if (client) {
@@ -50,6 +51,7 @@ string Notification_CheckArgs(
                }
 
                case NOTIF_TEAM:
+               case NOTIF_TEAM_ONLY:
                {
                        if (!teamplay) {
                                return "Teamplay not active!";
@@ -60,6 +62,7 @@ string Notification_CheckArgs(
                }
 
                case NOTIF_TEAM_EXCEPT:
+               case NOTIF_TEAM_ONLY_EXCEPT:
                {
                        if (!teamplay) {
                                return "Teamplay not active!";
@@ -117,6 +120,20 @@ bool Notification_ShouldSend(NOTIF broadcast, entity to_client, entity other_cli
                                        )
                                )
                        );
+               case NOTIF_TEAM_ONLY:
+                       return (
+                               (to_client.team == other_client.team)
+                       );
+               case NOTIF_TEAM_ONLY_EXCEPT:
+                       return (
+                               (to_client != other_client)
+                               &&
+                               (to_client.team == other_client.team)
+                       );
+               case NOTIF_ALL_SPEC:
+                       return (
+                               (IS_SPEC(to_client))
+                       );
                case NOTIF_ALL:
                        return true;
                case NOTIF_ALL_EXCEPT:
index abff1521360665b1a500d52f95c51fba7cc10d8b..5be01a202e24464c660ec27a9cd390cf0b50c1b1 100644 (file)
@@ -259,10 +259,16 @@ ENUMCLASS(NOTIF)
        CASE(NOTIF, TEAM)
        /** send only to X team and their spectators, except for Y person and their spectators */
        CASE(NOTIF, TEAM_EXCEPT)
+       /** send only to X team; don't include spectators */
+       CASE(NOTIF, TEAM_ONLY)
+       /** send to team X team except for Y person; don't include spectators */
+       CASE(NOTIF, TEAM_ONLY_EXCEPT)
        /** send to everyone */
        CASE(NOTIF, ALL)
        /** send to everyone except X person and their spectators */
        CASE(NOTIF, ALL_EXCEPT)
+       /** send to all spectators **/
+       CASE(NOTIF, ALL_SPEC)
 ENUMCLASS_END(NOTIF)
 
 string Get_Notif_BroadcastName(NOTIF broadcast)
@@ -271,10 +277,13 @@ string Get_Notif_BroadcastName(NOTIF broadcast)
        {
                case NOTIF_ONE: return "NOTIF_ONE";
                case NOTIF_ONE_ONLY: return "NOTIF_ONE_ONLY";
+               case NOTIF_ALL_SPEC: return "NOTIF_ALL_SPEC";
                case NOTIF_ALL_EXCEPT: return "NOTIF_ALL_EXCEPT";
                case NOTIF_ALL: return "NOTIF_ALL";
                case NOTIF_TEAM: return "NOTIF_TEAM";
                case NOTIF_TEAM_EXCEPT: return "NOTIF_TEAM_EXCEPT";
+               case NOTIF_TEAM_ONLY: return "NOTIF_TEAM_ONLY";
+               case NOTIF_TEAM_ONLY_EXCEPT: return "NOTIF_TEAM_ONLY_EXCEPT";
        }
        LOG_WARNF("Get_Notif_BroadcastName(%d): Improper broadcast!", broadcast);
        return "";