]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added place indicator in duel frag notification
authorz411 <z411@omaera.org>
Mon, 19 Apr 2021 08:14:44 +0000 (04:14 -0400)
committerz411 <z411@omaera.org>
Mon, 19 Apr 2021 08:14:44 +0000 (04:14 -0400)
qcsrc/common/gamemodes/gamemode/duel/sv_duel.qc
qcsrc/common/notifications/all.inc
qcsrc/common/notifications/all.qh

index 2cb1c8d5eb0c960c706f4034d6451d13d42e9f2a..75531a292c100772fab3cce0d4aba7331c9afa47 100644 (file)
@@ -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;
+}
index c910a5bd97a1a316dc861e6a3516bd86f7e243ed..77f2451369c384f20310c487caf8ae33047dcb42 100644 (file)
@@ -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)          )
index ade6321e74dd4cb2f6aa76531a132d13fab43503..999ba8e5545a5aeade7b25cf71ed32eb22f439c2 100644 (file)
@@ -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;