]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a mutator hook for accuracy checking & fix notification typo
authorMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:11:16 +0000 (16:11 +1100)
committerMario <mario.mario@y7mail.com>
Thu, 26 Dec 2013 05:11:16 +0000 (16:11 +1100)
qcsrc/common/notifications.qh
qcsrc/server/accuracy.qc
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/gamemode_invasion.qc

index 77dc3e14b08e5afd997e1933e46356f1207e2771..e434187cea46b5d39521727921eeffd9f7bc1787 100644 (file)
@@ -357,7 +357,7 @@ void Send_Notification_WOCOVA(
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FALL,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_fall",          _("^BG%s%s^K1 was grounded by ^BG%s^K1%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_FIRE,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_death",         _("^BG%s%s^K1 was burnt up into a crisp by ^BG%s^K1%s%s"), _("^BG%s%s^K1 felt a little hot from ^BG%s^K1's fire^K1%s%s")) \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_LAVA,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_lava",          _("^BG%s%s^K1 was cooked by ^BG%s^K1%s%s"), "") \
-       MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_MONSTER,           3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 d1",  "notify_death",         _("^BG%s%s^K1 was pushed infront of a monster by ^BG%s^K1%s%s"), "") \
+       MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_MONSTER,           3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_death",         _("^BG%s%s^K1 was pushed infront of a monster by ^BG%s^K1%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_NADE,              3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_death",         _("^BG%s%s^K1 was blown up by ^BG%s^K1's Nade%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_SHOOTING_STAR,     3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_shootingstar",  _("^BG%s%s^K1 was shot into space by ^BG%s^K1%s%s"), "") \
        MSG_INFO_NOTIF(1, INFO_DEATH_MURDER_SLIME,             3, 2, "spree_inf s1 s2 s3loc spree_end", "s2 s1",  "notify_slime",         _("^BG%s%s^K1 was slimed by ^BG%s^K1%s%s"), "") \
index b78cc4fcda0cdf02ef7f5ad9c03161f4e9464795..562766fc2c86dc893523b7efeef9761339093b4d 100644 (file)
@@ -109,11 +109,13 @@ void accuracy_add(entity e, float w, float fired, float hit)
 
 float accuracy_isgooddamage(entity attacker, entity targ)
 {
-       float targ_isvalid = ((g_invasion) ? (targ.flags & FL_MONSTER) : IS_CLIENT(targ));
+       frag_attacker = attacker;
+       frag_target = targ;
+       float mutator_check = MUTATOR_CALLHOOK(AccuracyTargetValid);
 
        if(!warmup_stage)
-       if(targ_isvalid)
        if(targ.deadflag == DEAD_NO)
+       if(mutator_check == MUT_ACCADD_INVALID || (mutator_check == MUT_ACCADD_VALID && IS_CLIENT(targ)))
        if(DIFF_TEAM(attacker, targ))
                return TRUE;
        return FALSE;
index 1aa3128ca99c1a3cd0fe65cb333655fe5e51b30a..db15e6bae668de8a7e666b2a206e7271c1d483f3 100644 (file)
@@ -347,3 +347,11 @@ MUTATOR_HOOKABLE(ClientConnect);
 
 MUTATOR_HOOKABLE(HavocBot_ChooseRule);
        entity self;
+
+MUTATOR_HOOKABLE(AccuracyTargetValid);
+       // called when a target is checked for accuracy
+       entity frag_attacker; // attacker
+       entity frag_target; // target
+       #define MUT_ACCADD_VALID 0 // return this flag to make the function continue if target is a client
+       #define MUT_ACCADD_INVALID 1 // return this flag to make the function always continue
+       #define MUT_ACCADD_INDIFFERENT 2 // return this flag to make the function always return
index 2147e6a816720859ebd01d590e1042e660b89d32..593b17fd33452373407b0d69dba8ac2bcf222f52 100644 (file)
@@ -276,6 +276,13 @@ MUTATOR_HOOKFUNCTION(invasion_SetStartItems)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
+{
+       if(frag_target.flags & FL_MONSTER)
+               return MUT_ACCADD_INVALID;
+       return MUT_ACCADD_INDIFFERENT;
+}
+
 void invasion_ScoreRules()
 {
        ScoreRules_basics(0, 0, 0, FALSE);
@@ -308,6 +315,7 @@ MUTATOR_DEFINITION(gamemode_invasion)
        MUTATOR_HOOK(PlayerDamage_Calculate, invasion_PlayerDamage, CBC_ORDER_ANY);
        MUTATOR_HOOK(SV_ParseClientCommand, invasion_PlayerCommand, CBC_ORDER_ANY);
        MUTATOR_HOOK(SetStartItems, invasion_SetStartItems, CBC_ORDER_ANY);
+       MUTATOR_HOOK(AccuracyTargetValid, invasion_AccuracyTargetValid, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {