]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move a keepaway specific check into the keepaway mutator
authorMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 05:27:32 +0000 (15:27 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 05:27:56 +0000 (15:27 +1000)
qcsrc/server/bot/aim.qc
qcsrc/server/mutators/gamemode_keepaway.qc

index 5549778be82c2f50ce7928b3e5fe5e6bd6f52557..58ddfc0364f784e7ef60dd76055dd286ed9c6d15 100644 (file)
@@ -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)
index 65c7ba6e56635a727abfae89c2341a92fb422815..2416425e834228a54b421f0bc1d152a9fd7939d8 100644 (file)
@@ -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