From f084f1cb6897d099c08aacc95eb16ea2fe36f9aa Mon Sep 17 00:00:00 2001 From: z411 Date: Mon, 19 Apr 2021 04:14:44 -0400 Subject: [PATCH] Added place indicator in duel frag notification --- .../common/gamemodes/gamemode/duel/sv_duel.qc | 45 +++++++++++++++++++ qcsrc/common/notifications/all.inc | 2 + qcsrc/common/notifications/all.qh | 7 +++ 3 files changed, 54 insertions(+) diff --git a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc index 2cb1c8d5e..75531a292 100644 --- a/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc +++ b/qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc @@ -26,3 +26,48 @@ MUTATOR_HOOKFUNCTION(duel, FilterItemDefinition) return !autocvar_g_duel_with_powerups; } } + +MUTATOR_HOOKFUNCTION(duel, FragCenterMessage) +{ + // Use normal notifications in warmup + if(warmup_stage) return false; + + entity attacker = M_ARGV(0, entity); + entity targ = M_ARGV(1, entity); + string tie_str; + int kill_count_to_attacker = M_ARGV(3, int); + int kill_count_to_target = M_ARGV(4, int); + + WinningConditionHelper(NULL); + + if(WinningConditionHelper_equality) + tie_str = "^3Tied"; + else if(attacker == WinningConditionHelper_winner) + tie_str = "^2Leads"; + else + tie_str = "^1Trails"; + + Send_Notification( + NOTIF_ONE, + attacker, + MSG_CENTER, + CENTER_DEATH_MURDER_DUEL, + targ.netname, + tie_str, + kill_count_to_attacker, + GameRules_scoring_add(attacker, SCORE, 0) + ); + Send_Notification( + NOTIF_ONE, + targ, + MSG_CHOICE, + CHOICE_FRAGGED, + attacker.netname, + kill_count_to_target, + GetResource(attacker, RES_HEALTH), + GetResource(attacker, RES_ARMOR), + (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping) + ); + + return true; +} diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index c910a5bd9..77f245136 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -668,10 +668,12 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input != #define MURDER_FRAG strcat(BOLD_OPERATOR, _("^K3%sYou fragged ^BG%s")) #define MURDER_FRAG2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s")) #define MURDER_FRAG3 strcat(BOLD_OPERATOR, _("^K3%sYou fragged ^BG%s"), "\n", "%s^BG place with %s") + #define MURDER_FRAG4 strcat(BOLD_OPERATOR, _("^K3%sYou fragged ^BG%s"), "\n", "%s^BG with %s") #define MURDER_FRAGGED _("^K1%sYou were fragged by ^BG%s") #define MURDER_FRAGGED2 _("^K1%sYou were scored against by ^BG%s") MSG_CENTER_NOTIF(DEATH_MURDER_FRAG, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG, MURDER_FRAG2 ) MSG_CENTER_NOTIF(DEATH_MURDER_DM, N_ENABLE, 1, 2, "spree_cen s1 frag_pos f2", CPID_Null, "0 0", MURDER_FRAG3, "") + MSG_CENTER_NOTIF(DEATH_MURDER_DUEL, N_ENABLE, 2, 2, "spree_cen s1 s2 f2", CPID_Null, "0 0", MURDER_FRAG4, "") MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAGGED, MURDER_FRAGGED2 ) MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED), VERBOSE_MURDER(FRAGGED2) ) MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG), VERBOSE_MURDER(FRAG2) ) diff --git a/qcsrc/common/notifications/all.qh b/qcsrc/common/notifications/all.qh index ade6321e7..999ba8e55 100644 --- a/qcsrc/common/notifications/all.qh +++ b/qcsrc/common/notifications/all.qh @@ -492,6 +492,13 @@ MACRO_END SPREE_ITEM(15, 15, _("MAYHEM! "), _("%s^K1 executed MAYHEM! %s^BG"), _("%s^K1 made FIFTEEN SCORES IN A ROW! %s^BG")) \ #ifdef CSQC +// z411 TODO : This actually doesn't work very well. +// This gets run before the client gets score updates so it works +// fine when you're playing (because frags get updated first) +// but it breaks a lot when you're spectating because +// we sometimes get the new frag info at different times +// (before or after we run this). A suggested fix would +// be to do this sorting and comparison in the server. string notif_arg_frag_pos(int score) { entity pl; -- 2.39.2