From: Mario Date: Sat, 17 Feb 2018 17:48:56 +0000 (+1000) Subject: Change speed modifying mutators to use the maxspeed_mod stat and PlayerPhysics_Update... X-Git-Tag: xonotic-v0.8.5~2296 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cbd5749bf3064a7b8cde93d3e366719fc9ca1f6a;p=xonotic%2Fxonotic-data.pk3dir.git Change speed modifying mutators to use the maxspeed_mod stat and PlayerPhysics_UpdateStats --- diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index f4fcc8e1b..fa718eb16 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -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) diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index a3ddf4474..616a05da3 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -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) diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 7cc641a76..e183c3339 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -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) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 6e2091649..4b2ffc55f 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -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; diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index badae12c2..567f24b47 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -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)