From b704346536a2cb04a4038377b8e312549cae39e8 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 30 Aug 2015 15:27:32 +1000 Subject: [PATCH] Move a keepaway specific check into the keepaway mutator --- qcsrc/server/bot/aim.qc | 6 ------ qcsrc/server/mutators/gamemode_keepaway.qc | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 5549778be..58ddfc036 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -119,12 +119,6 @@ float bot_shouldattack(entity e) if(e.frozen) return false; - // If neither player has ball then don't attack unless the ball is on the - // ground. - if (g_keepaway) - if (!e.ballcarried && !self.ballcarried && ka_ball.owner) - return false; - if(teamplay) { if(e.team==0) diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 65c7ba6e5..2416425e8 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -356,6 +356,14 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPowerups) return 0; } +MUTATOR_HOOKFUNCTION(ka_BotShouldAttack) +{ + // if neither player has ball then don't attack unless the ball is on the ground + if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner) + return true; + return false; +} + MUTATOR_HOOKFUNCTION(ka_BotRoles) { if (self.ballcarried) @@ -430,6 +438,7 @@ MUTATOR_DEFINITION(gamemode_keepaway) MUTATOR_HOOK(PlayerDamage_Calculate, ka_PlayerDamage, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerPowerups, ka_PlayerPowerups, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerUseKey, ka_PlayerUseKey, CBC_ORDER_ANY); + MUTATOR_HOOK(BotShouldAttack, ka_BotShouldAttack, CBC_ORDER_ANY); MUTATOR_HOOK(HavocBot_ChooseRole, ka_BotRoles, CBC_ORDER_ANY); MUTATOR_ONADD -- 2.39.2