From f22ee2f870135644fb7092d1113266e31a378e05 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 11 Dec 2022 15:01:53 +1000 Subject: [PATCH] Some consistency and whitespace adjustments to Team Keepaway and Keepaway --- .../common/gamemodes/gamemode/keepaway/sv_keepaway.qc | 6 +++--- qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc | 10 +++++++--- qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc index 4ad694de8..1db7e4bfd 100644 --- a/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc +++ b/qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc @@ -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 { diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc index 6054df7f4..5419e96c9 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc @@ -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 { diff --git a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh index 61ec7a942..b4bb35323 100644 --- a/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh +++ b/qcsrc/common/gamemodes/gamemode/tka/sv_tka.qh @@ -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; } -- 2.39.2