]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow overriding frag centerprint message, fixes double kill message in freeze tag
authorMario <mario@smbclan.net>
Wed, 14 Sep 2016 22:43:07 +0000 (08:43 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Sep 2016 22:43:07 +0000 (08:43 +1000)
notifications.cfg
qcsrc/common/notifications/all.inc
qcsrc/server/g_damage.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_freezetag.qc

index 2409b83d68e961634a316d738c81beb1b030fcb5..fc998ccc879ff106f9b831206ccd9df3e887280b 100644 (file)
@@ -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
index b9f7b36a91302663bb27857caae3fb061d9c0452..d2226444109f6ea8ec55b648a28d13ff41a34375 100644 (file)
     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"))
 
     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"), "")
     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)
index 3e448363655f6ce712a84efb3af74f3202a68db1..b8b13c8db3d688481f09cfcd78966d3dd8752453 100644 (file)
@@ -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,
index cc593ad5d13344d5adb4b9a07afaa6317a258809..179faf1f6b6e93d35ad66df811843326594e4504 100644 (file)
@@ -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) \
index 0143760872504e1fbc6a143714b6bc2e5eba47fb..9d4abe6d87a0e051f96ae55e9e888ac681c434ab 100644 (file)
@@ -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;