From 8c1b0e27f131c21a6004c2e43749a4b7ef317eb4 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Apr 2018 22:30:53 +1000 Subject: [PATCH] Add a post-update mutator hook for physics stats (allows customizing the ending results) --- qcsrc/common/physics/player.qc | 2 ++ qcsrc/server/mutators/events.qh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 1b8065502..53765f419 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -77,6 +77,8 @@ void Physics_UpdateStats(entity this) STAT(MOVEVARS_JUMPVELOCITY, this) = Physics_ClientOption(this, "jumpvelocity", autocvar_sv_jumpvelocity); STAT(MOVEVARS_JUMPVELOCITY_CROUCH, this) = Physics_ClientOption(this, "jumpvelocity_crouch", autocvar_sv_jumpvelocity_crouch); STAT(MOVEVARS_TRACK_CANJUMP, this) = Physics_ClientOption(this, "track_canjump", autocvar_sv_track_canjump); + + MUTATOR_CALLHOOK(PlayerPhysics_PostUpdateStats, this, maxspd_mod); } #endif diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index c101be0cc..240f8fc25 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -1106,6 +1106,13 @@ MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn); /**/ MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats); +/** called after physics stats are set on a player, allows post-initialization modifications */ +#define EV_PlayerPhysics_PostUpdateStats(i, o) \ + /** player */ i(entity, MUTATOR_ARGV_0_entity) \ + /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \ + /**/ +MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats); + /** return true to use your own aim target (or none at all) */ #define EV_HavocBot_Aim(i, o) \ /** bot */ i(entity, MUTATOR_ARGV_0_entity) \ -- 2.39.2