]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a post-update mutator hook for physics stats (allows customizing the ending results)
authorMario <mario@smbclan.net>
Thu, 26 Apr 2018 12:30:53 +0000 (22:30 +1000)
committerMario <mario@smbclan.net>
Thu, 26 Apr 2018 12:30:53 +0000 (22:30 +1000)
qcsrc/common/physics/player.qc
qcsrc/server/mutators/events.qh

index 1b80655026dcf4b2fdc00a7cf79b4bd5e628d7ed..53765f41919a4e313ae45e25aa594ce61226b3bc 100644 (file)
@@ -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
 
index c101be0ccf4b8aa9a53497268e922c3270613192..240f8fc25fac301033bee840e7bfcd1ce8cd0198 100644 (file)
@@ -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) \