From: Mario Date: Thu, 26 Dec 2013 05:11:16 +0000 (+1100) Subject: Add a mutator hook for accuracy checking & fix notification typo X-Git-Tag: xonotic-v0.8.0~241^2^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d05395300e644d5519469ea8febdf4b9afae61eb;p=xonotic%2Fxonotic-data.pk3dir.git Add a mutator hook for accuracy checking & fix notification typo --- diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 77dc3e14b..e434187ce 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -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"), "") \ diff --git a/qcsrc/server/accuracy.qc b/qcsrc/server/accuracy.qc index b78cc4fcd..562766fc2 100644 --- a/qcsrc/server/accuracy.qc +++ b/qcsrc/server/accuracy.qc @@ -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; diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index 1aa3128ca..db15e6bae 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -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 diff --git a/qcsrc/server/mutators/gamemode_invasion.qc b/qcsrc/server/mutators/gamemode_invasion.qc index 2147e6a81..593b17fd3 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qc +++ b/qcsrc/server/mutators/gamemode_invasion.qc @@ -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 {