]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Keepaway: fix noncarrier damage being applied to ball carriers too 1451/head
authorterencehill <piuntn@gmail.com>
Tue, 28 Jan 2025 11:53:31 +0000 (12:53 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 28 Jan 2025 15:04:05 +0000 (16:04 +0100)
This bug was introduced by 01bea1371

qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc

index ee159358d2379e4d3c00e313124ea63dca42bbd7..bba3baa3c3e73b4dba55954759a296cf3e9baeb8 100644 (file)
@@ -371,14 +371,17 @@ MUTATOR_HOOKFUNCTION(ka, PlayerDies)
 
        if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
        {
-               if(frag_target.ballcarried) { // add to amount of times killing carrier
+               if(frag_target.ballcarried) // add to amount of times killing carrier
+               {
                        GameRules_scoring_add(frag_attacker, KEEPAWAY_CARRIERKILLS, 1);
                        if(autocvar_g_keepaway_score_bckill) // add bckills to the score
                                GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_bckill);
                }
                else if(!frag_attacker.ballcarried)
+               {
                        if(autocvar_g_keepaway_noncarrier_warn)
                                Send_Notification(NOTIF_ONE_ONLY, frag_attacker, MSG_CENTER, CENTER_KEEPAWAY_WARN);
+               }
 
                if(frag_attacker.ballcarried) // add to amount of kills while ballcarrier
                        GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_killac);
@@ -435,13 +438,13 @@ MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force valu
                        M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_selfdamage;
                        M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_selfforce;
                }
-               else // damage done to other ballcarriers
+               else // damage done to other players (ballcarriers and noncarriers)
                {
                        M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage;
                        M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force;
                }
        }
-       else // if the attacker is a noncarrier
+       else if (!frag_target.ballcarried) // if the target is a noncarrier
        {
                if(frag_target == frag_attacker) // damage done to yourself
                {
index dd3c8ea082275b703806d355bcf3f5e25bbffc42..62aff020dc29d0d2a276caacc0e2559171304a81 100644 (file)
@@ -355,7 +355,8 @@ MUTATOR_HOOKFUNCTION(tka, PlayerDies)
                        team_has_ball = true;
                        break;
                });
-               if(frag_target.ballcarried) { // add to amount of times killing carrier
+               if(frag_target.ballcarried) // add to amount of times killing carrier
+               {
                        GameRules_scoring_add(frag_attacker, TKA_CARRIERKILLS, 1);
                        if(autocvar_g_tka_score_bckill) // add bckills to the score
                                GameRules_scoring_add_team(frag_attacker, SCORE, autocvar_g_tka_score_bckill);
@@ -444,13 +445,13 @@ MUTATOR_HOOKFUNCTION(tka, Damage_Calculate) // for changing damage and force val
                        frag_damage *= autocvar_g_tka_ballcarrier_selfdamage;
                        frag_force *= autocvar_g_tka_ballcarrier_selfforce;
                }
-               else // damage done to other ballcarriers
+               else // damage done to other players (ballcarriers and noncarriers)
                {
                        frag_damage *= autocvar_g_tka_ballcarrier_damage;
                        frag_force *= autocvar_g_tka_ballcarrier_force;
                }
        }
-       else // if the attacker is a noncarrier
+       else if (!frag_target.ballcarried) // if the target is a noncarrier
        {
                if(frag_target == frag_attacker) // damage done to yourself
                {