]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow all non?carrier -> non?carrier/self ka/tka dmg/force combos
authorotta8634 <k9wolf@pm.me>
Sun, 9 Mar 2025 11:04:15 +0000 (19:04 +0800)
committerotta8634 <k9wolf@pm.me>
Tue, 1 Apr 2025 10:58:50 +0000 (18:58 +0800)
Implemented this similar to as described here https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1431#note_2317419396, using a damage vector and force vector.
Currently the carrier -> carrier isn't very useful in ka/tka since there's only one ball, but this approach is consistent, and more balls may be allowed in future.
Consequently fixed up the comments.

gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc

index 5a443924bb1b8d7674df1d2489175420a809c141..27778c755fe12dfc66a4ba0ee97a3538a3d46820 100644 (file)
@@ -437,15 +437,11 @@ set g_keepaway_score_killac 1 "points for kills while holding the ball (Kill As
 set g_keepaway_score_timepoints 0 "points to add to ball carrier's score per second"
 set g_keepaway_ballcarrier_maxballs 1 "how many balls a single player may carry at once"
 set g_keepaway_ballcarrier_highspeed 1 "speed multiplier done to the person holding the ball (recommended when used with some mutators)"
-set g_keepaway_ballcarrier_damage      1       "damage multiplier while holding the ball"
-set g_keepaway_ballcarrier_force       1       "force multiplier while holding the ball"
-set g_keepaway_ballcarrier_selfdamage  1       "self damage multiplier while holding the ball"
-set g_keepaway_ballcarrier_selfforce   1       "self force multiplier while holding the ball"
+set g_keepaway_ballcarrier_damage      "1 1 1" "damage multiplier of ball carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_keepaway_ballcarrier_force       "1 1 1" "force multiplier of ball carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_keepaway_noncarrier_damage       "1 1 1" "damage multiplier of players who don't have the ball; to themselves (X), to carriers (Y), to other noncarriers (Z)"
+set g_keepaway_noncarrier_force        "1 1 1" "force multiplier of players who don't have the ball; to themselves (X), to carriers (Y), to other noncarriers (Z)"
 set g_keepaway_noncarrier_warn 1       "warn players when they kill without holding the ball"
-set g_keepaway_noncarrier_damage       1       "damage done to other players if both you and they don't have the ball"
-set g_keepaway_noncarrier_force        1       "force done to other players if both you and they don't have the ball"
-set g_keepaway_noncarrier_selfdamage   1       "self damage if you don't have the ball"
-set g_keepaway_noncarrier_selfforce    1       "self force if you don't have the ball"
 set g_keepawayball_count 1 "how many balls to spawn"
 set g_keepawayball_effects 8 "add together the numbers you want; EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
 set g_keepawayball_trail_color 254     "particle trail color from player/ball"
@@ -677,15 +673,11 @@ set g_tka_score_killac 1 "points for kills while holding the ball (Kill As Carri
 set g_tka_score_timepoints 0 "points to add to ball carrier's team's score per second"
 set g_tka_ballcarrier_maxballs 1 "how many balls a single player may carry at once"
 set g_tka_ballcarrier_highspeed 1 "speed multiplier done to the person holding the ball (recommended when used with some mutators)"
-set g_tka_ballcarrier_damage   1       "damage multiplier while holding the ball"
-set g_tka_ballcarrier_force    1       "force multiplier while holding the ball"
-set g_tka_ballcarrier_selfdamage       1       "self damage multiplier while holding the ball"
-set g_tka_ballcarrier_selfforce        1       "self force multiplier while holding the ball"
+set g_tka_ballcarrier_damage   "1 1 1" "damage multiplier of ball carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_tka_ballcarrier_force    "1 1 1" "force multiplier of ball carriers; to themselves (X), to other carriers (Y), to noncarriers (Z)"
+set g_tka_noncarrier_damage    "1 1 1" "damage multiplier of players who don't have the ball; to themselves (X), to carriers (Y), to other noncarriers (Z)"
+set g_tka_noncarrier_force     "1 1 1" "force multiplier of players who don't have the ball; to themselves (X), to carriers (Y), to other noncarriers (Z)"
 set g_tka_noncarrier_warn      1       "warn players when they kill without holding the ball"
-set g_tka_noncarrier_damage    1       "damage done to other players if both you and they don't have the ball"
-set g_tka_noncarrier_force     1       "force done to other players if both you and they don't have the ball"
-set g_tka_noncarrier_selfdamage        1       "self damage if you don't have the ball"
-set g_tka_noncarrier_selfforce 1       "self force if you don't have the ball"
 set g_tkaball_count 1 "how many balls to spawn"
 set g_tkaball_effects 8 "add together the numbers you want; EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
 set g_tkaball_trail_color      254     "particle trail color from player/ball"
index e61edf85191e763a6ddebd13b95e6e1e2449085e..3bff5c560af80b0e9a3db41af69a4030fa619d41 100644 (file)
 .entity previous_owner; // also used on kh keys
 
 int autocvar_g_keepaway_ballcarrier_maxballs;
-float autocvar_g_keepaway_ballcarrier_damage;
-float autocvar_g_keepaway_ballcarrier_force;
 float autocvar_g_keepaway_ballcarrier_highspeed;
-float autocvar_g_keepaway_ballcarrier_selfdamage;
-float autocvar_g_keepaway_ballcarrier_selfforce;
-float autocvar_g_keepaway_noncarrier_damage;
-float autocvar_g_keepaway_noncarrier_force;
-float autocvar_g_keepaway_noncarrier_selfdamage;
-float autocvar_g_keepaway_noncarrier_selfforce;
+vector autocvar_g_keepaway_ballcarrier_damage;
+vector autocvar_g_keepaway_ballcarrier_force;
+vector autocvar_g_keepaway_noncarrier_damage;
+vector autocvar_g_keepaway_noncarrier_force;
 bool autocvar_g_keepaway_noncarrier_warn;
+
 int autocvar_g_keepaway_score_bckill;
 int autocvar_g_keepaway_score_killac;
 int autocvar_g_keepaway_score_timepoints;
@@ -467,33 +464,43 @@ MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force valu
        entity frag_target = M_ARGV(2, entity);
 
        // as a gamemode rule, only apply scaling to player versus player combat
-       if(!IS_PLAYER(frag_attacker) || !IS_PLAYER(frag_target))
+       if (!IS_PLAYER(frag_attacker) || !IS_PLAYER(frag_target))
                return;
 
-       if(frag_attacker.ballcarried) // if the attacker is a ballcarrier
+       if (frag_attacker.ballcarried) // if the attacker is a ballcarrier
        {
-               if(frag_target == frag_attacker) // damage done to yourself
+               if (frag_target == frag_attacker) // damage done to themselves
+               {
+                       M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force.x;
+               }
+               else if (frag_target.ballcarried) // damage done to other ballcarriers
                {
-                       M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_selfdamage;
-                       M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_selfforce;
+                       M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force.y;
                }
-               else // damage done to other players (ballcarriers and noncarriers)
+               else // damage done to noncarriers
                {
-                       M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage;
-                       M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force;
+                       M_ARGV(4, float) *= autocvar_g_keepaway_ballcarrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_ballcarrier_force.z;
                }
        }
-       else if (!frag_target.ballcarried) // if the target is a noncarrier
+       else
        {
-               if(frag_target == frag_attacker) // damage done to yourself
+               if (frag_target == frag_attacker) // damage done to themselves
+               {
+                       M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_force.x;
+               }
+               else if (frag_target.ballcarried) // damage done to ballcarriers
                {
-                       M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_selfdamage;
-                       M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_selfforce;
+                       M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_force.y;
                }
                else // damage done to other noncarriers
                {
-                       M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_damage;
-                       M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_force;
+                       M_ARGV(4, float) *= autocvar_g_keepaway_noncarrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_keepaway_noncarrier_force.z;
                }
        }
 }
index 7bb60c93e902033558345ca9e63a486b8a7ebcf0..7f68e72672d5d2eb9dc78318e338f6fab94c8ee3 100644 (file)
@@ -7,16 +7,13 @@
 .entity previous_owner; // also used on kh keys
 
 int autocvar_g_tka_ballcarrier_maxballs;
-float autocvar_g_tka_ballcarrier_damage;
-float autocvar_g_tka_ballcarrier_force;
 float autocvar_g_tka_ballcarrier_highspeed;
-float autocvar_g_tka_ballcarrier_selfdamage;
-float autocvar_g_tka_ballcarrier_selfforce;
-float autocvar_g_tka_noncarrier_damage;
-float autocvar_g_tka_noncarrier_force;
-float autocvar_g_tka_noncarrier_selfdamage;
-float autocvar_g_tka_noncarrier_selfforce;
+vector autocvar_g_tka_ballcarrier_damage;
+vector autocvar_g_tka_ballcarrier_force;
+vector autocvar_g_tka_noncarrier_damage;
+vector autocvar_g_tka_noncarrier_force;
 bool autocvar_g_tka_noncarrier_warn;
+
 int autocvar_g_tka_score_bckill;
 int autocvar_g_tka_score_killac;
 bool autocvar_g_tka_score_team;
@@ -489,42 +486,47 @@ MUTATOR_HOOKFUNCTION(tka, Damage_Calculate) // for changing damage and force val
 {
        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))
+       if (!IS_PLAYER(frag_attacker) || !IS_PLAYER(frag_target))
                return;
 
-       if(frag_attacker.ballcarried) // if the attacker is a ballcarrier
+       if (frag_attacker.ballcarried) // if the attacker is a ballcarrier
        {
-               if(frag_target == frag_attacker) // damage done to yourself
+               if (frag_target == frag_attacker) // damage done to themselves
+               {
+                       M_ARGV(4, float) *= autocvar_g_tka_ballcarrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_tka_ballcarrier_force.x;
+               }
+               else if (frag_target.ballcarried) // damage done to other ballcarriers
                {
-                       frag_damage *= autocvar_g_tka_ballcarrier_selfdamage;
-                       frag_force *= autocvar_g_tka_ballcarrier_selfforce;
+                       M_ARGV(4, float) *= autocvar_g_tka_ballcarrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_tka_ballcarrier_force.y;
                }
-               else // damage done to other players (ballcarriers and noncarriers)
+               else // damage done to noncarriers
                {
-                       frag_damage *= autocvar_g_tka_ballcarrier_damage;
-                       frag_force *= autocvar_g_tka_ballcarrier_force;
+                       M_ARGV(4, float) *= autocvar_g_tka_ballcarrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_tka_ballcarrier_force.z;
                }
        }
-       else if (!frag_target.ballcarried) // if the target is a noncarrier
+       else
        {
-               if(frag_target == frag_attacker) // damage done to yourself
+               if (frag_target == frag_attacker) // damage done to themselves
                {
-                       frag_damage *= autocvar_g_tka_noncarrier_selfdamage;
-                       frag_force *= autocvar_g_tka_noncarrier_selfforce;
+                       M_ARGV(4, float) *= autocvar_g_tka_noncarrier_damage.x;
+                       M_ARGV(6, vector) *= autocvar_g_tka_noncarrier_force.x;
+               }
+               else if (frag_target.ballcarried) // damage done to ballcarriers
+               {
+                       M_ARGV(4, float) *= autocvar_g_tka_noncarrier_damage.y;
+                       M_ARGV(6, vector) *= autocvar_g_tka_noncarrier_force.y;
                }
                else // damage done to other noncarriers
                {
-                       frag_damage *= autocvar_g_tka_noncarrier_damage;
-                       frag_force *= autocvar_g_tka_noncarrier_force;
+                       M_ARGV(4, float) *= autocvar_g_tka_noncarrier_damage.z;
+                       M_ARGV(6, vector) *= autocvar_g_tka_noncarrier_force.z;
                }
        }
-
-       M_ARGV(4, float) = frag_damage;
-       M_ARGV(6, vector) = frag_force;
 }
 
 MUTATOR_HOOKFUNCTION(tka, ClientDisconnect)