Change speed modifying mutators to use the maxspeed_mod stat and PlayerPhysics_Update...
authorMario <mario@smbclan.net>
Sat, 17 Feb 2018 17:48:56 +0000 (03:48 +1000)
committerMario <mario@smbclan.net>
Sat, 17 Feb 2018 17:48:56 +0000 (03:48 +1000)
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/physics/player.qh
qcsrc/server/mutators/mutator/gamemode_keepaway.qc

index f4fcc8e..fa718eb 100644 (file)
@@ -873,18 +873,13 @@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
        return false;
 }
 
-.float stat_sv_airspeedlimit_nonqw;
-.float stat_sv_maxspeed;
-
-MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(nb, PlayerPhysics_UpdateStats)
 {
        entity player = M_ARGV(0, entity);
+       // these automatically reset, no need to worry
 
        if(player.ballcarried)
-       {
-               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
-               player.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
-       }
+               STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nexball_basketball_carrier_highspeed;
 }
 
 MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
index a3ddf44..616a05d 100644 (file)
@@ -253,14 +253,13 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
        }
 }
 
-.float stat_sv_maxspeed;
-
-MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics_UpdateStats)
 {
        entity player = M_ARGV(0, entity);
+       // these automatically reset, no need to worry
 
        if(player.items & ITEM_Speed.m_itemid)
-               player.stat_sv_maxspeed = player.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
+               STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_instagib_speed_highspeed;
 }
 
 MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor)
index 7cc641a..e183c33 100644 (file)
@@ -1313,15 +1313,13 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        }
 }
 
-MUTATOR_HOOKFUNCTION(nades, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
 {
        entity player = M_ARGV(0, entity);
+       // these automatically reset, no need to worry
 
-       if (STAT(ENTRAP_ORB, player) > time)
-       {
-               player.stat_sv_maxspeed *= autocvar_g_nades_entrap_speed;
-               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nades_entrap_speed;
-       }
+       if(STAT(ENTRAP_ORB, player) > time)
+               STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nades_entrap_speed;
 }
 
 MUTATOR_HOOKFUNCTION(nades, MonsterMove)
index 6e20916..4b2ffc5 100644 (file)
@@ -255,10 +255,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 
        void PM_UpdateButtons(entity this, entity store);
 
-       // TODO: modify maxspeed_mod and get rid of these!
-       .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW);
-       .float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED);
-
        /** Not real stats */
        .string jumpspeedcap_min;
        .string jumpspeedcap_max;
index badae12..567f24b 100644 (file)
@@ -396,18 +396,14 @@ MUTATOR_HOOKFUNCTION(ka, PlayerPowerups)
                player.effects |= autocvar_g_keepaway_ballcarrier_effects;
 }
 
-.float stat_sv_airspeedlimit_nonqw;
-.float stat_sv_maxspeed;
 
-MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(ka, PlayerPhysics_UpdateStats)
 {
        entity player = M_ARGV(0, entity);
+       // these automatically reset, no need to worry
 
        if(player.ballcarried)
-       {
-               player.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
-               player.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
-       }
+               STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_keepaway_ballcarrier_highspeed;
 }
 
 MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)