]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/events.qh
Fix FL_WEAPON flag overlapping FL_JUMPRELEASED. This unintentional change was introdu...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / events.qh
index cae6b19842db105e39c08cecc0c20c459700fff4..6ee9574d057ed13876ea96d22e8ac7bc1dd72f42 100644 (file)
@@ -1,10 +1,8 @@
-#ifndef COMMON_MUTATORS_EVENTS_H
-#define COMMON_MUTATORS_EVENTS_H
+#pragma once
 
 #define EV_NO_ARGS(i, o)
 
 #pragma noref 1
-string ret_string;
 
 #define MUTATOR_TYPES(_, x) \
     _(x, bool) \
@@ -36,24 +34,24 @@ MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
 
 #pragma noref 0
 
-/** appends ":mutatorname" to ret_string for logging */
+/** appends ":mutatorname" to argument for logging */
 #define EV_BuildMutatorsString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
 
 /** appends ", Mutator name" to ret_string for display */
 #define EV_BuildMutatorsPrettyString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
 
 /** appends mutator string for displaying extra gameplay tips */
 #define EV_BuildGameplayTipsString(i, o) \
-    /**/ i(string, ret_string) \
-    /**/ o(string, ret_string) \
+    /** tips string */    i(string, MUTATOR_ARGV_0_string) \
+    /**/                  o(string, MUTATOR_ARGV_0_string) \
     /**/
 MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
 
@@ -67,6 +65,7 @@ MUTATOR_HOOKABLE(IsFlying, EV_IsFlying);
     /**/ i(string, MUTATOR_ARGV_1_string) \
     /**/ o(vector, MUTATOR_ARGV_2_vector) \
     /**/ o(string, MUTATOR_ARGV_3_string) \
+    /**/ o(string, MUTATOR_ARGV_4_string) \
     /**/
 MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
 
@@ -75,38 +74,49 @@ MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
  * is run AFTER bot code and idle checking on the server
  */
 #define EV_PlayerPhysics(i, o) \
-    /**/ i(entity, __self) \
+    /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** ticrate*/ i(float, MUTATOR_ARGV_1_float) \
     /**/
 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
 
 /** called when a player presses the jump key */
 #define EV_PlayerJump(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(float, player_multijump) \
-    /**/ i(float, player_jumpheight) \
-    /**/ o(float, player_multijump) \
-    /**/ o(float, player_jumpheight) \
+    /** player */      i(entity, MUTATOR_ARGV_0_entity) \
+    /** jump height */ i(float, MUTATOR_ARGV_1_float) \
+    /**/               o(float, MUTATOR_ARGV_1_float) \
+    /** multijump */   i(bool, MUTATOR_ARGV_2_bool) \
+    /**/               o(bool, MUTATOR_ARGV_2_bool) \
     /**/
-float player_multijump;
-float player_jumpheight;
 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
 
 /** called during player physics, allows adjusting the movement type used */
 #define EV_PM_Physics(i, o) \
-    /**/ i(entity, __self) \
-    /**/ i(float, pm_maxspeed_mod) \
+    /** player */       i(entity, MUTATOR_ARGV_0_entity) \
+    /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
+    /** tick rate */    i(float, MUTATOR_ARGV_2_float) \
     /**/
-float pm_maxspeed_mod;
 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
 
+/** called when a weapon sound is about to be played, allows custom paths etc. */
+#define EV_WeaponSound(i, o) \
+    /** sound       */ i(string, MUTATOR_ARGV_0_string) \
+    /** output      */ i(string, MUTATOR_ARGV_1_string) \
+    /**/               o(string, MUTATOR_ARGV_1_string) \
+    /**/
+MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
+
 /** called when a weapon model is about to be set, allows custom paths etc. */
 #define EV_WeaponModel(i, o) \
-    /**/ i(string, weapon_model) \
-    /**/ i(string, weapon_model_output) \
-    /**/ o(string, weapon_model_output) \
+    /** model */  i(string, MUTATOR_ARGV_0_string) \
+    /** output */ i(string, MUTATOR_ARGV_1_string) \
+    /**/          o(string, MUTATOR_ARGV_1_string) \
     /**/
-string weapon_model;
-string weapon_model_output;
 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
 
-#endif
+/** decides whether a player can crouch or not */
+#define EV_PlayerCanCrouch(i, o) \
+    /** player */      i(entity, MUTATOR_ARGV_0_entity) \
+    /** do_crouch */   i(bool, MUTATOR_ARGV_1_bool) \
+    /**/               o(bool, MUTATOR_ARGV_1_bool) \
+    /**/
+MUTATOR_HOOKABLE(PlayerCanCrouch, EV_PlayerCanCrouch);