From: z411 Date: Wed, 11 Nov 2020 05:50:05 +0000 (-0300) Subject: Notifications: Implemented NOTIF_ALL_SPEC, NOTIF_TEAM_ONLY and NOTIF_TEAM_ONLY_EXCEPT X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=326f6c6cda871df8a42d6cf4617deaff52745221;p=xonotic%2Fxonotic-data.pk3dir.git Notifications: Implemented NOTIF_ALL_SPEC, NOTIF_TEAM_ONLY and NOTIF_TEAM_ONLY_EXCEPT --- diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index fbe6cbc1e..f285d6270 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -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); } } }); diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index a1fabf945..9bbf7fac7 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -235,6 +235,7 @@ 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 diff --git a/qcsrc/common/notifications/all.qc b/qcsrc/common/notifications/all.qc index 9fb158dbb..366b3dae4 100644 --- a/qcsrc/common/notifications/all.qc +++ b/qcsrc/common/notifications/all.qc @@ -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: diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index abff15213..5be01a202 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -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 "";