From 767c2f9f11e9f9bdbe287e011308eacbec78a819 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 15 Sep 2016 08:43:07 +1000 Subject: [PATCH] Allow overriding frag centerprint message, fixes double kill message in freeze tag --- notifications.cfg | 24 +++++++++++++++---- qcsrc/common/notifications/all.inc | 14 +++++++++-- qcsrc/server/g_damage.qc | 14 ++++++++++- qcsrc/server/mutators/events.qh | 10 ++++++++ .../mutators/mutator/gamemode_freezetag.qc | 21 ++++++++++++---- 5 files changed, 71 insertions(+), 12 deletions(-) diff --git a/notifications.cfg b/notifications.cfg index 2409b83d6..fc998ccc8 100644 --- a/notifications.cfg +++ b/notifications.cfg @@ -420,7 +420,7 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)" -// MSG_CENTER notifications (count = 225): +// MSG_CENTER notifications (count = 231): seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint" seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint" seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint" @@ -488,7 +488,15 @@ seta notification_CENTER_CTF_STALEMATE_CARRIER "1" "0 = off, 1 = centerprint" seta notification_CENTER_CTF_STALEMATE_OTHER "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_FRAG "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_FRAGGED "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAGGED_FIRE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAGGED_FIRE_VERBOSE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAGGED_FREEZE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAGGED_FREEZE_VERBOSE "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_FRAGGED_VERBOSE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAG_FIRE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAG_FIRE_VERBOSE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAG_FREEZE "1" "0 = off, 1 = centerprint" +seta notification_CENTER_DEATH_MURDER_FRAG_FREEZE_VERBOSE "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_FRAG_VERBOSE "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_TYPEFRAG "1" "0 = off, 1 = centerprint" seta notification_CENTER_DEATH_MURDER_TYPEFRAGGED "1" "0 = off, 1 = centerprint" @@ -537,8 +545,6 @@ seta notification_CENTER_DOOR_LOCKED_NEED "1" "0 = off, 1 = centerprint" seta notification_CENTER_DOOR_UNLOCKED "1" "0 = off, 1 = centerprint" seta notification_CENTER_EXTRALIVES "1" "0 = off, 1 = centerprint" seta notification_CENTER_FREEZETAG_AUTO_REVIVED "1" "0 = off, 1 = centerprint" -seta notification_CENTER_FREEZETAG_FREEZE "1" "0 = off, 1 = centerprint" -seta notification_CENTER_FREEZETAG_FROZEN "1" "0 = off, 1 = centerprint" seta notification_CENTER_FREEZETAG_REVIVE "1" "0 = off, 1 = centerprint" seta notification_CENTER_FREEZETAG_REVIVED "1" "0 = off, 1 = centerprint" seta notification_CENTER_FREEZETAG_REVIVE_SELF "1" "0 = off, 1 = centerprint" @@ -802,7 +808,7 @@ seta notification_WEAPON_TUBA_SUICIDE "1" "Enable this multiple notification" seta notification_WEAPON_VAPORIZER_MURDER "1" "Enable this multiple notification" seta notification_WEAPON_VORTEX_MURDER "1" "Enable this multiple notification" -// MSG_CHOICE notifications (count = 24): +// MSG_CHOICE notifications (count = 28): seta notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" seta notification_CHOICE_CTF_CAPTURE_BROKEN_BLUE_ALLOWED "2" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" seta notification_CHOICE_CTF_CAPTURE_BROKEN_PINK "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" @@ -847,6 +853,14 @@ seta notification_CHOICE_FRAG "1" "Choice for this notification 0 = off, 1 = def seta notification_CHOICE_FRAG_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" seta notification_CHOICE_FRAGGED "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" seta notification_CHOICE_FRAGGED_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" +seta notification_CHOICE_FRAGGED_FIRE "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" +seta notification_CHOICE_FRAGGED_FIRE_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" +seta notification_CHOICE_FRAGGED_FREEZE "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" +seta notification_CHOICE_FRAGGED_FREEZE_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" +seta notification_CHOICE_FRAG_FIRE "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" +seta notification_CHOICE_FRAG_FIRE_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" +seta notification_CHOICE_FRAG_FREEZE "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" +seta notification_CHOICE_FRAG_FREEZE_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" seta notification_CHOICE_TYPEFRAG "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" seta notification_CHOICE_TYPEFRAG_ALLOWED "1" "Allow choice for this notification 0 = off, 1 = only in warmup mode, 2 = always" seta notification_CHOICE_TYPEFRAGGED "1" "Choice for this notification 0 = off, 1 = default message, 2 = verbose message" @@ -869,4 +883,4 @@ seta notification_show_sprees_info "3" "Show spree information in MSG_INFO messa seta notification_show_sprees_info_newline "1" "Show attacker spree information for MSG_INFO messages on a separate line than the death notification itself" seta notification_show_sprees_info_specialonly "1" "Don't show attacker spree information in MSG_INFO messages if it isn't an achievement" -// Notification counts (total = 807): MSG_ANNCE = 89, MSG_INFO = 316, MSG_CENTER = 225, MSG_MULTI = 153, MSG_CHOICE = 24 +// Notification counts (total = 817): MSG_ANNCE = 89, MSG_INFO = 316, MSG_CENTER = 231, MSG_MULTI = 153, MSG_CHOICE = 28 diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index b9f7b36a9..d22264441 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -555,6 +555,14 @@ MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K1%sYou were fragged by ^BG%s"), _("^K1%sYou were scored against by ^BG%s")) MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_VERBOSE, 1, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", _("^K1%sYou were fragged by ^BG%s^BG%s"), _("^K1%sYou were scored against by ^BG%s^BG%s")) MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_VERBOSE, 1, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", _("^K3%sYou fragged ^BG%s^BG%s"), _("^K3%sYou scored against ^BG%s^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K3%sYou burned ^BG%s"), _("^K3%sYou scored against ^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FIRE, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K1%sYou were burned by ^BG%s"), _("^K1%sYou were scored against by ^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FIRE_VERBOSE, 1, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", _("^K1%sYou were burned by ^BG%s^BG%s"), _("^K1%sYou were scored against by ^BG%s^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE_VERBOSE, 1, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", _("^K3%sYou burned ^BG%s^BG%s"), _("^K3%sYou scored against ^BG%s^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K3%sYou froze ^BG%s"), _("^K3%sYou scored against ^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FREEZE, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K1%sYou were frozen by ^BG%s"), _("^K1%sYou were scored against by ^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FREEZE_VERBOSE,1, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", _("^K1%sYou were frozen by ^BG%s^BG%s"), _("^K1%sYou were scored against by ^BG%s^BG%s")) + MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE_VERBOSE, 1, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", _("^K3%sYou froze ^BG%s^BG%s"), _("^K3%sYou scored against ^BG%s^BG%s")) MSG_CENTER_NOTIF(DEATH_MURDER_TYPEFRAG, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K1%sYou typefragged ^BG%s"), _("^K1%sYou scored against ^BG%s^K1 while they were typing")) MSG_CENTER_NOTIF(DEATH_MURDER_TYPEFRAGGED, 1, 1, 1, "spree_cen s1", CPID_Null, "0 0", _("^K1%sYou were typefragged by ^BG%s"), _("^K1%sYou were scored against by ^BG%s^K1 while typing!")) MSG_CENTER_NOTIF(DEATH_MURDER_TYPEFRAGGED_VERBOSE, 1, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", _("^K1%sYou were typefragged by ^BG%s^BG%s"), _("^K1%sYou were scored against by ^BG%s^K1 while typing^BG%s")) @@ -610,8 +618,6 @@ MSG_CENTER_NOTIF(EXTRALIVES, 1, 0, 0, "", CPID_Null, "0 0", _("^F2You picked up some extra lives"), "") - MSG_CENTER_NOTIF(FREEZETAG_FREEZE, 1, 1, 0, "s1", CPID_Null, "0 0", _("^K3You froze ^BG%s"), "") - MSG_CENTER_NOTIF(FREEZETAG_FROZEN, 1, 1, 0, "s1", CPID_Null, "0 0", _("^K1You were frozen by ^BG%s"), "") MSG_CENTER_NOTIF(FREEZETAG_REVIVE, 1, 1, 0, "s1", CPID_Null, "0 0", _("^K3You revived ^BG%s"), "") MSG_CENTER_NOTIF(FREEZETAG_REVIVE_SELF, 1, 0, 0, "", CPID_Null, "0 0", _("^K3You revived yourself"), "") MSG_CENTER_NOTIF(FREEZETAG_REVIVED, 1, 1, 0, "s1", CPID_Null, "0 0", _("^K3You were revived by ^BG%s"), "") @@ -923,5 +929,9 @@ MSG_CHOICE_NOTIF(CTF_PICKUP_ENEMY_TEAM, 1, 2, MSG_CENTER, CENTER_CTF_PICKUP_ENEMY_TEAM, CENTER_CTF_PICKUP_ENEMY_TEAM_VERBOSE) MSG_CHOICE_NOTIF(FRAG, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAG, CENTER_DEATH_MURDER_FRAG_VERBOSE) MSG_CHOICE_NOTIF(FRAGGED, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED, CENTER_DEATH_MURDER_FRAGGED_VERBOSE) + MSG_CHOICE_NOTIF(FRAG_FIRE, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAG_FIRE, CENTER_DEATH_MURDER_FRAG_FIRE_VERBOSE) + MSG_CHOICE_NOTIF(FRAGGED_FIRE, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED_FIRE, CENTER_DEATH_MURDER_FRAGGED_FIRE_VERBOSE) + MSG_CHOICE_NOTIF(FRAG_FREEZE, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAG_FREEZE, CENTER_DEATH_MURDER_FRAG_FREEZE_VERBOSE) + MSG_CHOICE_NOTIF(FRAGGED_FREEZE, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_FRAGGED_FREEZE, CENTER_DEATH_MURDER_FRAGGED_FREEZE_VERBOSE) MSG_CHOICE_NOTIF(TYPEFRAG, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAG, CENTER_DEATH_MURDER_TYPEFRAG_VERBOSE) MSG_CHOICE_NOTIF(TYPEFRAGGED, 1, 1, MSG_CENTER, CENTER_DEATH_MURDER_TYPEFRAGGED, CENTER_DEATH_MURDER_TYPEFRAGGED_VERBOSE) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 3e4483636..b8b13c8db 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -264,6 +264,18 @@ float Obituary_WeaponDeath( return false; } +bool frag_centermessage_override(entity attacker, entity targ, int deathtype, int kill_count_to_attacker, int kill_count_to_target) +{ + if(deathtype == DEATH_FIRE.m_id) + { + Send_Notification(NOTIF_ONE, attacker, MSG_CHOICE, CHOICE_FRAG_FIRE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? -1 : targ.ping)); + Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, attacker.health, attacker.armorvalue, (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping)); + return true; + } + + return MUTATOR_CALLHOOK(FragCenterMessage, attacker, targ, deathtype, kill_count_to_attacker, kill_count_to_target); +} + .int buffs = _STAT(BUFFS); // TODO: remove entity buff_FirstFromFlags(int _buffs); void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) @@ -413,7 +425,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) (IS_BOT_CLIENT(attacker) ? -1 : attacker.ping) ); } - else + else if(!frag_centermessage_override(attacker, targ, deathtype, kill_count_to_attacker, kill_count_to_target)) { Send_Notification( NOTIF_ONE, diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index cc593ad5d..179faf1f6 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -63,6 +63,16 @@ MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect); /**/ MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies); +/** allows overriding the frag centerprint messages */ +#define EV_FragCenterMessage(i, o) \ + /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \ + /** target */ i(entity, MUTATOR_ARGV_1_entity) \ + /** deathtype */ i(float, MUTATOR_ARGV_2_float) \ + /** attacker kcount*/ i(int, MUTATOR_ARGV_3_int) \ + /** targ killcount */ i(int, MUTATOR_ARGV_4_int) \ + /**/ +MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage); + /** called when a player dies to e.g. remove stuff he was carrying */ #define EV_PlayHitsound(i, o) \ /** victim */ i(entity, MUTATOR_ARGV_0_entity) \ diff --git a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc index 014376087..9d4abe6d8 100644 --- a/qcsrc/server/mutators/mutator/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/mutator/gamemode_freezetag.qc @@ -378,10 +378,6 @@ MUTATOR_HOOKFUNCTION(ft, PlayerDies) } else { - if(IS_PLAYER(frag_target)) - Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_FROZEN, frag_attacker.netname); - if(IS_PLAYER(frag_attacker)) - Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_FREEZETAG_FREEZE, frag_target.netname); Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_FREEZE, frag_target.netname, frag_attacker.netname); } @@ -565,6 +561,23 @@ MUTATOR_HOOKFUNCTION(ft, SetWeaponArena) M_ARGV(0, string) = "most"; } +MUTATOR_HOOKFUNCTION(ft, FragCenterMessage) +{ + entity frag_attacker = M_ARGV(0, entity); + entity frag_target = M_ARGV(1, entity); + //float frag_deathtype = M_ARGV(2, float); + int kill_count_to_attacker = M_ARGV(3, int); + int kill_count_to_target = M_ARGV(4, int); + + if(STAT(FROZEN, frag_target)) + return; // target was already frozen, so this is just pushing them off the cliff + + Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : frag_target.ping)); + Send_Notification(NOTIF_ONE, frag_target, MSG_CHOICE, CHOICE_FRAGGED_FREEZE, frag_attacker.netname, kill_count_to_target, frag_attacker.health, frag_attacker.armorvalue, (IS_BOT_CLIENT(frag_attacker) ? -1 : frag_attacker.ping)); + + return true; +} + void freezetag_Initialize() { freezetag_teams = autocvar_g_freezetag_teams_override; -- 2.39.2