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.
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"
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"
.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;
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;
}
}
}
.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;
{
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)