]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move a keepaway specific modifier into the keepaway mutator file
authorMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 11:41:33 +0000 (21:41 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 11:41:33 +0000 (21:41 +1000)
qcsrc/common/physics.qc
qcsrc/server/mutators/gamemode_keepaway.qc

index 33aaeb58b0456845e255761a6731b40e3df74021..b53696b987b18ad7604406bde27eac5763560db3 100644 (file)
@@ -976,15 +976,6 @@ void SpecialCommand()
 #endif
 }
 
-float PM_check_keepaway(void)
-{
-#ifdef SVQC
-       return (self.ballcarried && g_keepaway) ? autocvar_g_keepaway_ballcarrier_highspeed : 1;
-#else
-       return 1;
-#endif
-}
-
 void PM_check_race_movetime(void)
 {
 #ifdef SVQC
@@ -1675,7 +1666,6 @@ void PM_Main()
        WarpZone_PlayerPhysics_FixVAngle();
 #endif
        float maxspeed_mod = 1;
-       maxspeed_mod *= PM_check_keepaway();
        maxspeed_mod *= PHYS_HIGHSPEED;
 
 #ifdef SVQC
index 2416425e834228a54b421f0bc1d152a9fd7939d8..96765796a1de7967bd938b17e00facdf70f3a8a5 100644 (file)
@@ -356,6 +356,16 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPowerups)
        return 0;
 }
 
+MUTATOR_HOOKFUNCTION(ka_PlayerPhysics)
+{
+       if(self.ballcarried)
+       {
+               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
+               self.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
+       }
+       return false;
+}
+
 MUTATOR_HOOKFUNCTION(ka_BotShouldAttack)
 {
        // if neither player has ball then don't attack unless the ball is on the ground
@@ -438,6 +448,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(PlayerPhysics, ka_PlayerPhysics, CBC_ORDER_ANY);
        MUTATOR_HOOK(BotShouldAttack, ka_BotShouldAttack, CBC_ORDER_ANY);
        MUTATOR_HOOK(HavocBot_ChooseRole, ka_BotRoles, CBC_ORDER_ANY);