From: Mario Date: Fri, 14 Jun 2013 12:36:49 +0000 (+1000) Subject: Move a CA damage check into a mutator hook X-Git-Tag: xonotic-v0.8.0~366^2~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3cb5b6136013f391c7db05453a4efd1a2d177ee0;p=xonotic%2Fxonotic-data.pk3dir.git Move a CA damage check into a mutator hook --- diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index f8a77a2cd..d35af7cac 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -708,7 +708,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if (targ == attacker) { - if(g_ca || (g_cts && !autocvar_g_cts_selfdamage)) + if(g_cts && !autocvar_g_cts_selfdamage) damage = 0; else damage = damage * autocvar_g_balance_selfdamagepercent; // Partial damage if the attacker hits himself diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 7c8c1cb77..bf8fbbcbc 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -238,6 +238,15 @@ MUTATOR_HOOKFUNCTION(ca_SetStartItems) return 0; } +MUTATOR_HOOKFUNCTION(ca_PlayerDamage) +{ + if(IS_PLAYER(frag_attacker)) + if(frag_target == frag_attacker) + frag_damage = 0; + + return FALSE; +} + // scoreboard setup void ca_ScoreRules() { @@ -280,6 +289,7 @@ MUTATOR_DEFINITION(gamemode_ca) MUTATOR_HOOK(ForbidThrowCurrentWeapon, ca_ForbidThrowCurrentWeapon, CBC_ORDER_ANY); MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST); MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY); + MUTATOR_HOOK(PlayerDamage_Calculate, ca_PlayerDamage, CBC_ORDER_ANY); MUTATOR_ONADD {