]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/events.qh
Merge branch 'TimePath/guide_backports' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / events.qh
index 52be590ba5972b8e8eb8b4139bbbe97b628f84a0..01cdd168f797e454d6af7398b470627cc46adda1 100644 (file)
@@ -56,6 +56,13 @@ entity frag_target;
 int frag_deathtype;
 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
 
+/** called when a player dies to e.g. remove stuff he was carrying. */
+#define EV_PlayHitsound(i, o) \
+    /**/ i(entity, frag_victim) \
+    /**/
+entity frag_victim;
+MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
+
 /** called when a player presses the jump key */
 #define EV_PlayerJump(i, o) \
     /**/ i(float, player_multijump) \
@@ -95,6 +102,16 @@ MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
     /**/
 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
 
+/** called when formatting a chat message to replace fancy functions */
+#define EV_FormatMessage(i, o) \
+    /**/ i(string, format_escape) \
+    /**/ i(string, format_replacement) \
+    /**/ o(string, format_replacement) \
+    /**/
+string format_escape;
+string format_replacement;
+MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
+
 /** returns 1 if throwing the current weapon shall not be allowed */
 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
 
@@ -253,6 +270,18 @@ float frag_mirrordamage;
 vector frag_force;
 MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
 
+/**
+ * Called when a player is damaged
+ */
+#define EV_PlayerDamaged(i, o) \
+    /** attacker */ i(entity, mutator_argv_entity_0) \
+    /** target */ i(entity, mutator_argv_entity_1) \
+    /** health */ i(int, mutator_argv_int_0) \
+    /** armor */ i(int, mutator_argv_int_1) \
+    /** location */ i(vector, mutator_argv_vector_0) \
+    /**/
+MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
+
 /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
 #define EV_PlayerPowerups(i, o) \
     /**/ i(entity, self) \
@@ -290,8 +319,8 @@ MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
 
 /**
  * called when a client command is parsed
- * NOTE: hooks MUST start with if(MUTATOR_RETURNVALUE) return 0;
- * NOTE: return 1 if you handled the command, return 0 to continue handling
+ * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
+ * NOTE: return true if you handled the command, return false to continue handling
  * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
  * // example:
  * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)