]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 f4fcc8e1b8c706250b0eca1014fa9ec61cb94239..fa718eb16fe9884a74512688212372359fd026b6 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 a3ddf4474df99fb1d5433588fd37f60fc1a3e95c..616a05da3c93e9c77294028f469ae9a1c649a9ce 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 7cc641a76ac7c1074d4ec7ad937ee8fdea1c7f40..e183c3339b14711dd3225669be3f788da743f334 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 6e2091649a7e11e78be65c8e8aadf7039608cae9..4b2ffc55f90595c9eb3efc3cbb65db7a5858da48 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 badae12c2d4897090aaec805bc594d4f1cc9de76..567f24b478a47d1e536f731db06af69b190ace97 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)