From 3c3430532c12aa200f9893dd445c1b14a677ced5 Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 13 Jun 2016 17:54:15 +1000 Subject: [PATCH] Global forces: allow self damage to be ignored --- qcsrc/common/mutators/mutator/globalforces/globalforces.qc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qcsrc/common/mutators/mutator/globalforces/globalforces.qc b/qcsrc/common/mutators/mutator/globalforces/globalforces.qc index 4e2e0424f..662d4e24b 100644 --- a/qcsrc/common/mutators/mutator/globalforces/globalforces.qc +++ b/qcsrc/common/mutators/mutator/globalforces/globalforces.qc @@ -1,6 +1,7 @@ #ifdef IMPLEMENTATION AUTOCVAR(g_globalforces, float, false, "Global forces: knockback affects everyone"); +AUTOCVAR(g_globalforces_noself, bool, false, "Global forces: ignore self damage"); REGISTER_MUTATOR(mutator_globalforces, autocvar_g_globalforces); MUTATOR_HOOKFUNCTION(mutator_globalforces, BuildMutatorsString) { @@ -12,7 +13,9 @@ MUTATOR_HOOKFUNCTION(mutator_globalforces, BuildMutatorsPrettyString) { } MUTATOR_HOOKFUNCTION(mutator_globalforces, PlayerDamage_SplitHealthArmor) { + entity frag_attacker = M_ARGV(1, entity); entity frag_target = M_ARGV(2, entity); + if (autocvar_g_globalforces_noself && frag_target == frag_attacker) return; vector damage_force = M_ARGV(3, vector) * autocvar_g_globalforces; FOREACH_CLIENT(IS_PLAYER(it) && it != frag_target, { it.velocity += damage_explosion_calcpush(it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor); -- 2.39.2