From: Mario Date: Sun, 30 Aug 2015 05:27:32 +0000 (+1000) Subject: Move a keepaway specific check into the keepaway mutator X-Git-Tag: xonotic-v0.8.2~1985 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b704346536a2cb04a4038377b8e312549cae39e8;p=xonotic%2Fxonotic-data.pk3dir.git Move a keepaway specific check into the keepaway mutator --- 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