1 #ifndef CLIENT_MUTATORS_EVENTS_H
2 #define CLIENT_MUTATORS_EVENTS_H
4 #include "../../common/mutators/base.qh"
13 * Called when a client command is parsed
14 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
15 * NOTE: return true if you handled the command, return false to continue handling
16 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
18 * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
19 * if (MUTATOR_RETURNVALUE) return false; // command was already handled
20 * if (cmd_name == "echocvar" && cmd_argc >= 2) {
21 * print(cvar_string(argv(1)), "\n");
24 * if (cmd_name == "echostring" && cmd_argc >= 2) {
25 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
31 #define EV_CSQC_ConsoleCommand(i, o) \
32 /** command name */ i(string, cmd_name) \
33 /** also, argv() can be used */ i(int, cmd_argc) \
34 /** whole command, use only if you really have to */ i(string, cmd_string) \
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
42 * Called when a temp entity is parsed
43 * NOTE: hooks MUST start with:
44 * if (MUTATOR_RETURNVALUE) return;
45 * if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return;
48 #define EV_CSQC_Parse_TempEntity(i, o) \
49 /** mutator id */ i(int, mutator_argv_int_0) \
51 MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity);
54 * Called when a shared entity is updated
55 * if (MUTATOR_RETURNVALUE) return;
56 * if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return;
59 #define EV_CSQC_Ent_Update(i, o) \
60 /** mutator id */ i(int, mutator_argv_int_0) \
61 /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \
63 MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update);
65 /** Called when a projectile is linked with CSQC */
66 #define EV_Ent_Projectile(i, o) \
67 /** entity id */ i(entity, __self) \
69 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
71 /** Called when a projectile's properties are being modified */
72 #define EV_EditProjectile(i, o) \
73 /** entity id */ i(entity, __self) \
75 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
77 /* Called when projectiles are precached */
78 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
80 /** Called when updating the attached tags index */
81 #define EV_TagIndex_Update(i, o) \
82 /** entity id */ i(entity, __self) \
84 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
86 /** Called when setting the attached tags */
87 #define EV_TagIndex_Apply(i, o) \
88 /** entity id */ i(entity, __self) \
90 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
92 /** Called when setting up skeleton bones */
93 #define EV_Skeleton_CheckBones(i, o) \
94 /** entity id */ i(entity, __self) \
96 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
98 /** Called when setting up bones from the loaded model */
99 #define EV_Skeleton_CheckModel(i, o) \
100 /** entity id */ i(entity, __self) \
102 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
104 /** Called when clearing the global parameters for a model */
105 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
107 /** Called when getting the global parameters for a model */
108 #define EV_GetModelParams(i, o) \
109 /** entity id */ i(string, checkmodel_input) \
110 /** entity id */ i(string, checkmodel_command) \
112 string checkmodel_input, checkmodel_command;
113 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
115 /** called when a player presses the jump key */
116 #define EV_PlayerJump(i, o) \
117 /**/ i(float, player_multijump) \
118 /**/ i(float, player_jumpheight) \
119 /**/ o(float, player_multijump) \
120 /**/ o(float, player_jumpheight) \
122 float player_multijump;
123 float player_jumpheight;
124 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
126 /** Called checking if 3rd person mode should be forced on */
127 #define EV_WantEventchase(i, o) \
128 /** entity id */ i(entity, __self) \
130 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
132 #define EV_AnnouncerOption(i, o) \
133 /**/ i(string, ret_string) \
134 /**/ o(string, ret_string) \
136 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
138 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);