]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Keepaway: only apply damage and force scaling to players, fixes #2605
authorMario <mario.mario@y7mail.com>
Fri, 25 Jun 2021 12:14:25 +0000 (22:14 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 25 Jun 2021 12:14:25 +0000 (22:14 +1000)
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc

index 27a69d19ad16dc889b9f1e1ce665c7255ad02e05..5b40ed02ccba5ebad778c6ca86d5c102f40feb68 100644 (file)
@@ -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)