]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some consistency and whitespace adjustments to Team Keepaway and Keepaway
authorMario <mario.mario@y7mail.com>
Sun, 11 Dec 2022 05:01:53 +0000 (15:01 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 11 Dec 2022 05:01:53 +0000 (15:01 +1000)
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc
qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh

index 4ad694de826f374e42bfa59eea7861b4b096a5a9..1db7e4bfd703e6aa8def105ca5c0bcbbd9437a3a 100644 (file)
@@ -431,7 +431,7 @@ MUTATOR_HOOKFUNCTION(ka, PlayerUseKey)
        }
 }
 
-MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force values that are applied to players in damage.qc
+MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force values that are applied to players
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
@@ -447,13 +447,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 noncarriers
+               else // damage done to other ballcarriers
                {
                        M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage;
                        M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force;
                }
        }
-       else // if the target is a noncarrier
+       else // if the attacker is a noncarrier
        {
                if(frag_target == frag_attacker) // damage done to yourself
                {
index 6054df7f4b942a196f72603049840f1503004880..5419e96c9936ad65af70dc72089e4fdf303009a3 100644 (file)
@@ -438,13 +438,17 @@ MUTATOR_HOOKFUNCTION(tka, PlayerUseKey)
        }
 }
 
-MUTATOR_HOOKFUNCTION(tka, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(tka, Damage_Calculate) // for changing damage and force values that are applied to players
 {
        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
@@ -452,13 +456,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 noncarriers
+               else // damage done to other ballcarriers
                {
                        frag_damage *= autocvar_g_tka_ballcarrier_damage;
                        frag_force *= autocvar_g_tka_ballcarrier_force;
                }
        }
-       else if (IS_PLAYER(frag_attacker) && !frag_target.ballcarried) // if the target is a noncarrier
+       else // if the attacker is a noncarrier
        {
                if(frag_target == frag_attacker) // damage done to yourself
                {
index 61ec7a942e7232fa67be6eb38ce198b5fe884e2c..b4bb353236870d10bad4d1478c35473d5cd6d5ac 100644 (file)
@@ -13,15 +13,15 @@ int autocvar_g_tka_teams_override;
 IntrusiveList g_tkaballs;
 REGISTER_MUTATOR(tka, false)
 {
-    MUTATOR_STATIC();
+       MUTATOR_STATIC();
        MUTATOR_ONADD
        {
                GameRules_teams(true);
-        GameRules_spawning_teams(autocvar_g_tka_team_spawns);
+               GameRules_spawning_teams(autocvar_g_tka_team_spawns);
                GameRules_limit_score(autocvar_g_tka_point_limit);
-        GameRules_limit_lead(autocvar_g_tka_point_leadlimit);
+               GameRules_limit_lead(autocvar_g_tka_point_leadlimit);
 
-        tka_Initialize();
+               tka_Initialize();
        }
        return false;
 }