From: Mario Date: Thu, 26 Apr 2018 12:30:53 +0000 (+1000) Subject: Add a post-update mutator hook for physics stats (allows customizing the ending results) X-Git-Tag: xonotic-v0.8.5~2166 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8c1b0e27f131c21a6004c2e43749a4b7ef317eb4;p=xonotic%2Fxonotic-data.pk3dir.git Add a post-update mutator hook for physics stats (allows customizing the ending results) --- 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) \