From 01bea1371791edc7ab4998d9cef58880a7b538d9 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 25 Jun 2021 22:14:25 +1000 Subject: [PATCH] Keepaway: only apply damage and force scaling to players, fixes #2605 --- .../gamemode/keepaway/sv_keepaway.qc | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 27a69d19a..5b40ed02c 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -421,38 +421,37 @@ MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force valu { entity frag_attacker = M_ARGV(1, entity); entity frag_target = M_ARGV(2, entity); - float frag_damage = M_ARGV(4, float); - vector frag_force = M_ARGV(6, vector); + + // as a gamemode rule, only apply scaling to player versus player combat + if(!IS_PLAYER(frag_attacker) || !IS_PLAYER(frag_target)) + return; if(frag_attacker.ballcarried) // if the attacker is a ballcarrier { if(frag_target == frag_attacker) // damage done to yourself { - frag_damage *= autocvar_g_keepaway_ballcarrier_selfdamage; - frag_force *= autocvar_g_keepaway_ballcarrier_selfforce; + M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_selfdamage; + M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_selfforce; } else // damage done to noncarriers { - frag_damage *= autocvar_g_keepaway_ballcarrier_damage; - frag_force *= autocvar_g_keepaway_ballcarrier_force; + M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage; + M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force; } } - else if (IS_PLAYER(frag_attacker) && !frag_target.ballcarried) // if the target is a noncarrier + else // if the target is a noncarrier { if(frag_target == frag_attacker) // damage done to yourself { - frag_damage *= autocvar_g_keepaway_noncarrier_selfdamage; - frag_force *= autocvar_g_keepaway_noncarrier_selfforce; + M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_selfdamage; + M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_selfforce; } else // damage done to other noncarriers { - frag_damage *= autocvar_g_keepaway_noncarrier_damage; - frag_force *= autocvar_g_keepaway_noncarrier_force; + M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_damage; + M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_force; } } - - M_ARGV(4, float) = frag_damage; - M_ARGV(6, vector) = frag_force; } MUTATOR_HOOKFUNCTION(ka, ClientDisconnect) -- 2.39.2