3 #include <common/mutators/base.qh>
5 // register all possible hooks here
7 // to use a hook, first register your mutator using REGISTER_MUTATOR
8 // then create your function using MUTATOR_HOOKFUNCTION
11 * Called when a client command is parsed
12 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
13 * NOTE: return true if you handled the command, return false to continue handling
14 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
16 * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
17 * if (MUTATOR_RETURNVALUE) return false; // command was already handled
18 * string cmd_name = M_ARGV(0, string);
19 * int cmd_argc = M_ARGV(1, int);
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, MUTATOR_ARGV_0_string) \
33 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
34 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
41 /** Called when a projectile is linked with CSQC */
42 #define EV_Ent_Projectile(i, o) \
43 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
45 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
47 /** Called when a projectile's properties are being modified */
48 #define EV_EditProjectile(i, o) \
49 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
51 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
53 /* Called when projectiles are precached */
54 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
56 /** Called when updating the attached tags index */
57 #define EV_TagIndex_Update(i, o) \
58 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
60 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
62 /** Called when setting the attached tags */
63 #define EV_TagIndex_Apply(i, o) \
64 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
66 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
68 /** Called when setting up skeleton bones */
69 #define EV_Skeleton_CheckBones(i, o) \
70 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
72 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
74 /** Called when setting up bones from the loaded model */
75 #define EV_Skeleton_CheckModel(i, o) \
76 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
78 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
80 /** Called when clearing the global parameters for a model */
81 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
83 /** Called when getting the global parameters for a model */
84 #define EV_GetModelParams(i, o) \
85 /** input */ i(string, MUTATOR_ARGV_0_string) \
86 /** command */ i(string, MUTATOR_ARGV_1_string) \
88 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
90 /** Called checking if 3rd person mode should be forced on */
91 #define EV_WantEventchase(i, o) \
92 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
94 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
96 /** allow customizing 3rd person mode effect */
97 #define EV_CustomizeEventchase(i, o) \
98 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
99 /* current_view_origin_override */ o(vector, MUTATOR_ARGV_0_vector) \
100 /* view_offset_override */ o(vector, MUTATOR_ARGV_1_vector) \
101 /* chase_distance_override */ o(float, MUTATOR_ARGV_0_float) \
103 MUTATOR_HOOKABLE(CustomizeEventchase, EV_CustomizeEventchase);
105 #define EV_AnnouncerOption(i, o) \
106 /** announcer string */ i(string, MUTATOR_ARGV_0_string) \
107 /** announcer string */ o(string, MUTATOR_ARGV_0_string) \
109 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
111 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
113 #define EV_HUD_Draw_overlay(i, o) \
114 /**/ o(vector, MUTATOR_ARGV_0_vector) \
115 /**/ o(float, MUTATOR_ARGV_1_float) \
117 MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
119 MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
121 /** Return true to not draw any vortex beam */
122 #define EV_Particles_VortexBeam(i, o) \
123 /** beam shot origin */ i(vector, MUTATOR_ARGV_0_vector) \
124 /** beam end position */ i(vector, MUTATOR_ARGV_1_vector) \
126 MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
128 /** Return true to not draw any impact effect */
129 #define EV_Weapon_ImpactEffect(i, o) \
130 /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \
131 /** damage entity */ i(entity, MUTATOR_ARGV_1_entity) \
133 MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
135 /* NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
137 #define EV_HUD_Command(i, o) \
138 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_0_int) \
140 MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command);
142 /** Draw the grapple hook, allows changing hook texture and colour */
143 #define EV_DrawGrapplingHook(i, o) \
144 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
145 /** texture */ i(string, MUTATOR_ARGV_1_string) \
146 /***/ o(string, MUTATOR_ARGV_1_string) \
147 /** colour */ i(vector, MUTATOR_ARGV_2_vector) \
148 /***/ o(vector, MUTATOR_ARGV_2_vector) \
149 /** team */ i(float, MUTATOR_ARGV_3_float) \
151 MUTATOR_HOOKABLE(DrawGrapplingHook, EV_DrawGrapplingHook);
153 /** Called when an entity is updated (either by SVQC networking or PVS) */
154 #define EV_Ent_Update(i, o) \
155 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
156 /** is new to client */ i(bool, MUTATOR_ARGV_1_bool) \
158 MUTATOR_HOOKABLE(Ent_Update, EV_Ent_Update);
160 /** Return true to not draw crosshair */
161 MUTATOR_HOOKABLE(DrawCrosshair, EV_NO_ARGS);
163 /** Return true to not draw scoreboard */
164 MUTATOR_HOOKABLE(DrawScoreboard, EV_NO_ARGS);
166 /** Called when drawing info messages, allows adding new info messages */
167 #define EV_DrawInfoMessages(i, o) \
168 /** pos */ i(vector, MUTATOR_ARGV_0_vector) \
169 /** mySize */ i(vector, MUTATOR_ARGV_1_vector) \
171 MUTATOR_HOOKABLE(DrawInfoMessages, EV_DrawInfoMessages);
173 /** Called when the view model is being animated (setorigin is called after the hook, so you only need to modify origin here if desired) */
174 #define EV_DrawViewModel(i, o) \
175 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
177 MUTATOR_HOOKABLE(DrawViewModel, EV_DrawViewModel);
179 /** Called when updating the view's liquid contents, return true to disable the standard checks and apply your own */
180 MUTATOR_HOOKABLE(HUD_Contents, EV_NO_ARGS);
182 /** Return true to disable player model forcing */
183 #define EV_ForcePlayermodels_Skip(i, o) \
184 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
185 /** is local */ i(bool, MUTATOR_ARGV_1_bool) \
187 MUTATOR_HOOKABLE(ForcePlayermodels_Skip, EV_ForcePlayermodels_Skip);
189 /** Return true to disable player color forcing */
190 #define EV_ForcePlayercolors_Skip(i, o) \
191 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
192 /** is local */ i(bool, MUTATOR_ARGV_1_bool) \
194 MUTATOR_HOOKABLE(ForcePlayercolors_Skip, EV_ForcePlayercolors_Skip);
196 /** Called when damage info is received on the client, useful for playing explosion effects */
197 #define EV_DamageInfo(i, o) \
198 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
199 /** death type */ i(int, MUTATOR_ARGV_1_int) \
200 /** hit origin */ i(vector, MUTATOR_ARGV_2_vector) \
202 MUTATOR_HOOKABLE(DamageInfo, EV_DamageInfo);
204 /** Return true to not draw zoom reticle */
205 MUTATOR_HOOKABLE(DrawReticle, EV_NO_ARGS);