]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/events.qh
Merge branch 'Lyberta/URS2' into Lyberta/RandomStartWeapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / events.qh
1 #pragma once
2
3 #include <common/mutators/base.qh>
4
5 // register all possible hooks here
6
7 /** called when a player becomes observer, after shared setup */
8 #define EV_MakePlayerObserver(i, o) \
9     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
10     /**/
11 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
12
13 /** */
14 #define EV_PutClientInServer(i, o) \
15         /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
16     /**/
17 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
18
19 /**
20  * return true to prevent a spectator/observer to spawn as player
21  */
22  #define EV_ForbidSpawn(i, o) \
23     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
24     /**/
25 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
26
27 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
28 #define EV_PlayerSpawn(i, o) \
29         /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
30     /** spot that was used, or NULL */ i(entity, MUTATOR_ARGV_1_entity) \
31     /**/
32 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
33
34 /** called after a player's weapon is chosen so it can be overriden here */
35 #define EV_PlayerWeaponSelect(i, o) \
36         /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
37     /**/
38 MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
39
40 /** called in reset_map */
41 #define EV_reset_map_global(i, o) \
42     /**/
43 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
44
45 /** called in reset_map */
46 #define EV_reset_map_players(i, o) \
47     /**/
48 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
49
50 /** returns 1 if clearing player score shall not be allowed */
51 #define EV_ForbidPlayerScore_Clear(i, o) \
52     /**/
53 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
54
55 /** called when a player disconnects */
56 #define EV_ClientDisconnect(i, o) \
57     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
58     /**/
59 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
60
61 /** called when a player dies to e.g. remove stuff he was carrying. */
62 #define EV_PlayerDies(i, o) \
63         /** inflictor           */ i(entity, MUTATOR_ARGV_0_entity) \
64     /** attacker        */ i(entity, MUTATOR_ARGV_1_entity) \
65     /** target                  */ i(entity, MUTATOR_ARGV_2_entity) \
66     /** deathtype       */ i(float,  MUTATOR_ARGV_3_float) \
67     /** damage         */ i(float,  MUTATOR_ARGV_4_float) \
68     /** damage                  */ o(float,  MUTATOR_ARGV_4_float) \
69     /**/
70 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
71
72 /** called after a player died. */
73 #define EV_PlayerDied(i, o) \
74     /** player                  */ i(entity, MUTATOR_ARGV_0_entity) \
75     /**/
76 MUTATOR_HOOKABLE(PlayerDied, EV_PlayerDied);
77
78 /** allows overriding the frag centerprint messages */
79 #define EV_FragCenterMessage(i, o) \
80     /** attacker       */ i(entity, MUTATOR_ARGV_0_entity) \
81     /** target         */ i(entity, MUTATOR_ARGV_1_entity) \
82     /** deathtype      */ i(float, MUTATOR_ARGV_2_float) \
83     /** attacker kcount*/ i(int,  MUTATOR_ARGV_3_int) \
84     /** targ killcount */ i(int,  MUTATOR_ARGV_4_int) \
85     /**/
86 MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage);
87
88 /** called when a player dies to e.g. remove stuff he was carrying */
89 #define EV_PlayHitsound(i, o) \
90     /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
91     /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
92     /**/
93 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
94
95 /** called when an item model is about to be set, allows custom paths etc. */
96 #define EV_ItemModel(i, o) \
97     /** model       */ i(string, MUTATOR_ARGV_0_string) \
98     /** output      */ i(string, MUTATOR_ARGV_1_string) \
99     /**/               o(string, MUTATOR_ARGV_1_string) \
100     /**/
101 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
102
103 /** called when an item sound is about to be played, allows custom paths etc. */
104 #define EV_ItemSound(i, o) \
105     /** sound       */ i(string, MUTATOR_ARGV_0_string) \
106     /** output      */ i(string, MUTATOR_ARGV_1_string) \
107     /**/               o(string, MUTATOR_ARGV_1_string) \
108     /**/
109 MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
110
111 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
112 #define EV_GiveFragsForKill(i, o) \
113     /** attacker   */ i(entity, MUTATOR_ARGV_0_entity) \
114     /** target     */ i(entity, MUTATOR_ARGV_1_entity) \
115     /** frag score */ i(float, MUTATOR_ARGV_2_float) \
116     /**            */ o(float, MUTATOR_ARGV_2_float) \
117     /**/
118 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
119
120 /** called when the match ends */
121 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
122
123 /** allows adjusting allowed teams */
124 #define EV_CheckAllowedTeams(i, o) \
125     /** mask of teams      */ i(float, MUTATOR_ARGV_0_float) \
126     /**/                      o(float, MUTATOR_ARGV_0_float) \
127     /** team entity name   */ i(string, MUTATOR_ARGV_1_string) \
128     /**/                      o(string, MUTATOR_ARGV_1_string) \
129     /** player checked     */ i(entity, MUTATOR_ARGV_2_entity) \
130     /**/
131 MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
132
133 /** copies variables for spectating "spectatee" to "this" */
134 #define EV_SpectateCopy(i, o) \
135     /** spectatee   */ i(entity, MUTATOR_ARGV_0_entity) \
136     /** client      */ i(entity, MUTATOR_ARGV_1_entity) \
137     /**/
138 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
139
140 /** called when formatting a chat message to replace fancy functions */
141 #define EV_FormatMessage(i, o) \
142     /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
143     /** escape        */ i(string, MUTATOR_ARGV_1_string) \
144     /** replacement   */ i(string, MUTATOR_ARGV_2_string) \
145     /**/                 o(string, MUTATOR_ARGV_2_string) \
146     /** message       */ i(string, MUTATOR_ARGV_3_string) \
147     /**/
148 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
149
150 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
151 #define EV_PreFormatMessage(i, o) \
152     /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
153     /** message       */ i(string, MUTATOR_ARGV_1_string) \
154     /**/                 o(string, MUTATOR_ARGV_1_string) \
155     /**/
156 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
157
158 /** returns true if throwing the current weapon shall not be allowed */
159 #define EV_ForbidThrowCurrentWeapon(i, o) \
160     /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
161     /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
162     /**/
163 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
164
165 /** returns true if dropping the current weapon shall not be allowed at any time including death */
166 #define EV_ForbidDropCurrentWeapon(i, o) \
167     /** player */        i(entity, MUTATOR_ARGV_0_entity) \
168     /** weapon id */     i(int, MUTATOR_ARGV_1_int) \
169     /**/
170 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
171
172 /**  */
173 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
174
175 /** allows changing attack rate */
176 #define EV_WeaponRateFactor(i, o) \
177     /** weapon rate */  i(float, MUTATOR_ARGV_0_float) \
178     /**/                o(float, MUTATOR_ARGV_0_float) \
179     /** player */       i(entity, MUTATOR_ARGV_1_entity) \
180     /**/
181 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
182
183 /** allows changing weapon speed (projectiles mostly) */
184 #define EV_WeaponSpeedFactor(i, o) \
185     /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
186     /**/                o(float, MUTATOR_ARGV_0_float) \
187     /** player */       i(entity, MUTATOR_ARGV_1_entity) \
188     /**/
189 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
190
191 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
192 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
193
194 /** called every frame. customizes the waypoint for spectators */
195 #define EV_CustomizeWaypoint(i, o) \
196     /** waypoint                        */ i(entity, MUTATOR_ARGV_0_entity) \
197     /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
198     /**/
199 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
200
201 /**
202  * checks if the current item may be spawned (.items and .weapons may be read and written to, as well as the ammo_ fields)
203  * return error to request removal
204  */
205 #define EV_FilterItem(i, o) \
206     /** item        */ i(entity, MUTATOR_ARGV_0_entity) \
207     /**/
208 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
209
210 /** return error to request removal */
211 #define EV_TurretSpawn(i, o) \
212     /** turret        */ i(entity, MUTATOR_ARGV_0_entity) \
213     /**/
214 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
215
216 /** return error to not attack */
217 #define EV_TurretFire(i, o) \
218     /** turret        */ i(entity, MUTATOR_ARGV_0_entity) \
219     /**/
220 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
221
222 /** return error to not attack */
223 #define EV_Turret_CheckFire(i, o) \
224     /** turret                      */ i(entity, MUTATOR_ARGV_0_entity) \
225     /** to fire or not to fire      */ o(bool, MUTATOR_ARGV_1_bool) \
226     /**/
227 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
228
229 /** return error to prevent entity spawn, or modify the entity */
230 #define EV_OnEntityPreSpawn(i, o) \
231    /** entity  */ i(entity, MUTATOR_ARGV_0_entity) \
232     /**/
233 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
234
235 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
236 #define EV_PlayerPreThink(i, o) \
237     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
238     /**/
239 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
240
241 /** TODO change this into a general PlayerPostThink hook? */
242 #define EV_GetPressedKeys(i, o) \
243     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
244     /**/
245 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
246
247 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
248 #define EV_GetCvars(i, o) \
249     /**/ i(float, get_cvars_f) \
250     /**/ i(string, get_cvars_s) \
251     /**/
252 float get_cvars_f;
253 string get_cvars_s;
254 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
255
256 /** can edit any "just fired" projectile */
257 #define EV_EditProjectile(i, o) \
258     /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
259     /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
260     /**/
261 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
262
263 /** called when a monster spawns */
264 #define EV_MonsterSpawn(i, o) \
265     /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
266     /**/
267 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
268
269 /** called when a monster dies */
270 #define EV_MonsterDies(i, o) \
271     /** target       */ i(entity, MUTATOR_ARGV_0_entity) \
272     /** attacker     */ i(entity, MUTATOR_ARGV_1_entity) \
273     /** deathtype    */ i(float, MUTATOR_ARGV_2_float) \
274     /**/
275 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
276
277 /** called when a monster dies */
278 #define EV_MonsterRemove(i, o) \
279     /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
280     /**/
281 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
282
283 /** called when a monster wants to respawn */
284 #define EV_MonsterRespawn(i, o) \
285     /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
286     /**/
287 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
288
289 /** called when a monster is dropping loot */
290 #define EV_MonsterDropItem(i, o) \
291     /* monster */                          i(entity, MUTATOR_ARGV_0_entity) \
292     /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
293     /**/                                   o(entity, MUTATOR_ARGV_1_entity) \
294     /* attacker */                         i(entity, MUTATOR_ARGV_2_entity) \
295     /**/
296 .entity monster_loot;
297 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
298
299 /**
300  * called when a monster moves
301  * returning true makes the monster stop
302  */
303 #define EV_MonsterMove(i, o) \
304     /** monster */       i(entity, MUTATOR_ARGV_0_entity) \
305     /** run speed */     i(float, MUTATOR_ARGV_1_float) \
306     /**/                 o(float, MUTATOR_ARGV_1_float) \
307     /** walk speed */    i(float, MUTATOR_ARGV_2_float) \
308     /**/                 o(float, MUTATOR_ARGV_2_float) \
309     /** move target */   i(entity, MUTATOR_ARGV_3_entity) \
310     /**/                 o(entity, MUTATOR_ARGV_3_entity) \
311     /**/
312 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
313
314 /** called when a monster looks for another target */
315 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
316
317 /**
318  * called when validating a monster's target
319  */
320 #define EV_MonsterValidTarget(i, o) \
321     /** monster */       i(entity, MUTATOR_ARGV_0_entity) \
322     /** target */        i(entity, MUTATOR_ARGV_1_entity) \
323     /**/
324 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
325
326 /** called to change a random monster to a miniboss */
327 #define EV_MonsterCheckBossFlag(i, o) \
328     /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
329     /**/
330 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
331
332 /**
333  * called when a player tries to spawn a monster
334  * return 1 to prevent spawning
335  * NOTE: requires reason if disallowed
336  */
337  #define EV_AllowMobSpawning(i, o) \
338     /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
339     /** reason */ o(string, MUTATOR_ARGV_1_string) \
340     /**/
341 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
342
343 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
344 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
345         /** inflictor           */ i(entity, MUTATOR_ARGV_0_entity) \
346     /** attacker        */ i(entity, MUTATOR_ARGV_1_entity) \
347     /** target                  */ i(entity, MUTATOR_ARGV_2_entity) \
348     /** force (no out)  */ i(vector, MUTATOR_ARGV_3_vector) \
349     /** damage take     */ i(float,  MUTATOR_ARGV_4_float) \
350     /** damage take     */ o(float,  MUTATOR_ARGV_4_float) \
351     /** damage save     */ i(float,  MUTATOR_ARGV_5_float) \
352     /** damage save     */ o(float,  MUTATOR_ARGV_5_float) \
353     /** deathtype               */ i(float,  MUTATOR_ARGV_6_float) \
354     /** damage              */ i(float,  MUTATOR_ARGV_7_float) \
355     /**/
356 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
357
358 /**
359  * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
360  * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
361  */
362 #define EV_Damage_Calculate(i, o) \
363     /** inflictor               */ i(entity, MUTATOR_ARGV_0_entity) \
364     /** attacker        */ i(entity, MUTATOR_ARGV_1_entity) \
365     /** target                  */ i(entity, MUTATOR_ARGV_2_entity) \
366     /** deathtype       */ i(float,  MUTATOR_ARGV_3_float) \
367     /** damage          */ i(float,  MUTATOR_ARGV_4_float) \
368     /** damage                  */ o(float,  MUTATOR_ARGV_4_float) \
369     /** mirrordamage    */ i(float,  MUTATOR_ARGV_5_float) \
370     /** mirrordamage    */ o(float,  MUTATOR_ARGV_5_float) \
371     /** force           */ i(vector, MUTATOR_ARGV_6_vector) \
372     /** force                   */ o(vector, MUTATOR_ARGV_6_vector) \
373     /**/
374 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
375
376 /**
377  * Called when a player is damaged
378  */
379 #define EV_PlayerDamaged(i, o) \
380     /** attacker  */ i(entity, MUTATOR_ARGV_0_entity) \
381     /** target    */ i(entity, MUTATOR_ARGV_1_entity) \
382     /** health    */ i(float,    MUTATOR_ARGV_2_float) \
383     /** armor     */ i(float,    MUTATOR_ARGV_3_float) \
384     /** location  */ i(vector, MUTATOR_ARGV_4_vector) \
385     /** deathtype */ i(int,    MUTATOR_ARGV_5_int) \
386     /** potential_damage     */ i(float,    MUTATOR_ARGV_6_float) \
387     /**/
388 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
389
390 /**
391  * Called by W_DecreaseAmmo
392  */
393 #define EV_W_DecreaseAmmo(i, o) \
394     /** actor */            i(entity, MUTATOR_ARGV_0_entity) \
395     /** weapon entity */    i(entity, MUTATOR_ARGV_1_entity) \
396     /**/
397 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
398
399 /**
400  * Called by W_Reload
401  */
402 #define EV_W_Reload(i, o) \
403     /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
404     /**/
405 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
406
407 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
408 #define EV_PlayerPowerups(i, o) \
409     /** player */    i(entity, MUTATOR_ARGV_0_entity) \
410     /** old items */ i(int, MUTATOR_ARGV_1_int) \
411     /**/
412 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
413
414 /**
415  * called every player think frame
416  * return 1 to disable regen
417  */
418  #define EV_PlayerRegen(i, o) \
419     /** player */               i(entity, MUTATOR_ARGV_0_entity) \
420     /** max_mod */              i(float, MUTATOR_ARGV_1_float) \
421     /**/                        o(float, MUTATOR_ARGV_1_float) \
422     /** regen_mod */            i(float, MUTATOR_ARGV_2_float) \
423     /**/                        o(float, MUTATOR_ARGV_2_float) \
424     /** rot_mod */              i(float, MUTATOR_ARGV_3_float) \
425     /**/                        o(float, MUTATOR_ARGV_3_float) \
426     /** limit_mod */            i(float, MUTATOR_ARGV_4_float) \
427     /**/                        o(float, MUTATOR_ARGV_4_float) \
428     /** health_regen */         i(float, MUTATOR_ARGV_5_float) \
429     /**/                        o(float, MUTATOR_ARGV_5_float) \
430     /** health_regenlinear */   i(float, MUTATOR_ARGV_6_float) \
431     /**/                        o(float, MUTATOR_ARGV_6_float) \
432     /** health_rot */           i(float, MUTATOR_ARGV_7_float) \
433     /**/                        o(float, MUTATOR_ARGV_7_float) \
434     /** health_rotlinear */     i(float, MUTATOR_ARGV_8_float) \
435     /**/                        o(float, MUTATOR_ARGV_8_float) \
436     /** health_stable */        i(float, MUTATOR_ARGV_9_float) \
437     /**/                        o(float, MUTATOR_ARGV_9_float) \
438     /** health_rotstable */     i(float, MUTATOR_ARGV_10_float) \
439     /**/                        o(float, MUTATOR_ARGV_10_float) \
440     /**/
441 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
442
443 /**
444  * called when the use key is pressed
445  * if MUTATOR_RETURNVALUE is 1, don't do anything
446  * return 1 if the use key actually did something
447  */
448  #define EV_PlayerUseKey(i, o) \
449     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
450     /**/
451 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
452
453 /**
454  * called when a client command is parsed
455  * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
456  * NOTE: return true if you handled the command, return false to continue handling
457  * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
458  * // example:
459  * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
460  * {
461  *     if (MUTATOR_RETURNVALUE) // command was already handled?
462  *         return false;
463  *     if (cmd_name == "echocvar" && cmd_argc >= 2)
464  *     {
465  *         print(cvar_string(argv(1)), "\n");
466  *         return true;
467  *     }
468  *     if (cmd_name == "echostring" && cmd_argc >= 2)
469  *     {
470  *         print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
471  *         return true;
472  *     }
473  *     return false;
474  * }
475  */
476 #define EV_SV_ParseClientCommand(i, o) \
477         /** client sending the command */       i(entity, MUTATOR_ARGV_0_entity) \
478     /** command name */                     i(string, MUTATOR_ARGV_1_string) \
479         /** argc (also, argv() can be used) */  i(int, MUTATOR_ARGV_2_int) \
480         /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
481     /**/
482 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
483
484 /** please read EV_SV_ParseClientCommand description before using */
485 #define EV_SV_ParseServerCommand(i, o) \
486    /** command name */ i(string, MUTATOR_ARGV_0_string) \
487         /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
488         /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
489     /**/
490 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
491
492 /**
493  * called when a spawnpoint is being evaluated
494  * return 1 to make the spawnpoint unusable
495  */
496 #define EV_Spawn_Score(i, o) \
497     /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
498     /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
499     /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
500     /**/ o(vector, MUTATOR_ARGV_2_vector) \
501     /**/
502 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
503
504 /** runs globally each server frame */
505 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
506
507 #define EV_SetModname(i, o) \
508     /** name of the mutator/mod if it warrants showing as such in the server browser */ \
509     /**/ i(string, MUTATOR_ARGV_0_string) \
510     /**/ o(string, MUTATOR_ARGV_0_string) \
511     /**/
512 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
513
514 /**
515  * called for each item being spawned on a map, including dropped weapons
516  * return 1 to remove an item
517  */
518 #define EV_Item_Spawn(i, o) \
519     /** item */ i(entity, MUTATOR_ARGV_0_entity) \
520     /**/
521 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
522
523 #define EV_SetWeaponreplace(i, o) \
524     /** map entity */  i(entity, MUTATOR_ARGV_0_entity) \
525     /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
526     /** replacement */ i(string, MUTATOR_ARGV_2_string) \
527     /**/               o(string, MUTATOR_ARGV_2_string) \
528     /**/
529 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
530
531 /** called when an item is about to respawn */
532 #define EV_Item_RespawnCountdown(i, o) \
533     /** item */   i(entity, MUTATOR_ARGV_0_entity) \
534     /**/
535 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
536
537 /** called when a bot checks a target to attack */
538 #define EV_BotShouldAttack(i, o) \
539     /** bot */    i(entity, MUTATOR_ARGV_0_entity) \
540     /** target */ i(entity, MUTATOR_ARGV_1_entity) \
541     /**/
542 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
543
544 /**
545  * called whenever a player goes through a portal gun teleport
546  * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
547  */
548 #define EV_PortalTeleport(i, o) \
549     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
550     /**/
551 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
552
553 /**
554  * called whenever a player uses impulse 33 (help me) in impulse.qc
555  * normally help me ping uses .waypointsprite_attachedforcarrier,
556  * but if your mutator uses something different then you can handle it
557  * in a special manner using this hook
558  */
559 #define EV_HelpMePing(i, o) \
560     /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
561     /**/
562 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
563
564 /**
565  * called when a vehicle initializes
566  * return true to remove the vehicle
567  */
568 #define EV_VehicleInit(i, o) \
569     /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
570     /**/
571 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
572
573 /**
574  * called when a player enters a vehicle
575  * allows mutators to set special settings in this event
576  */
577 #define EV_VehicleEnter(i, o) \
578     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
579     /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
580     /**/
581 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
582
583 /**
584  * called when a player touches a vehicle
585  * return true to stop player from entering the vehicle
586  */
587 #define EV_VehicleTouch(i, o) \
588     /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
589     /** player */ i(entity, MUTATOR_ARGV_1_entity) \
590     /**/
591 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
592
593 /**
594  * called when a player exits a vehicle
595  * allows mutators to set special settings in this event
596  */
597 #define EV_VehicleExit(i, o) \
598     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
599     /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
600     /**/
601 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
602
603 /** called when a speedrun is aborted and the player is teleported back to start position */
604 #define EV_AbortSpeedrun(i, o) \
605     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
606     /**/
607 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
608
609 /** called at when a item is touched. Called early, can edit item properties. */
610 #define EV_ItemTouch(i, o) \
611     /** item */    i(entity, MUTATOR_ARGV_0_entity) \
612     /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
613     /**/           o(entity, MUTATOR_ARGV_1_entity) \
614     /**/
615 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
616
617 enum {
618         MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
619         MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
620         MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
621 };
622
623 /** Called when the amount of entity resources changes. Can be used to override
624 resource limit. */
625 #define EV_GetResourceLimit(i, o) \
626         /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
627         /** resource type */  i(int, MUTATOR_ARGV_1_int) \
628         /** limit */          i(float, MUTATOR_ARGV_2_float) \
629         /**/                  o(float, MUTATOR_ARGV_2_float) \
630         /**/
631 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
632
633 /** Called when the amount of resource of an entity changes. See RESOURCE_*
634 constants for resource types. Return true to forbid the change. */
635 #define EV_SetResourceAmount(i, o) \
636         /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
637         /** resource type */  i(int, MUTATOR_ARGV_1_int) \
638         /**/                  o(int, MUTATOR_ARGV_1_int) \
639         /** amount */         i(float, MUTATOR_ARGV_2_float) \
640         /**/                  o(float, MUTATOR_ARGV_2_float) \
641         /**/
642 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
643
644 /** Called when entity is being given some resource. See RESOURCE_* constants
645 for resource types. Return true to forbid giving. */
646 #define EV_GiveResource(i, o) \
647         /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
648         /** resource type */ i(int, MUTATOR_ARGV_1_int) \
649         /**/                 o(int, MUTATOR_ARGV_1_int) \
650         /** amount */        i(float, MUTATOR_ARGV_2_float) \
651         /**/                 o(float, MUTATOR_ARGV_2_float) \
652         /**/
653 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
654
655 /** called at when a player connect */
656 #define EV_ClientConnect(i, o) \
657     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
658     /**/
659 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
660
661 #define EV_HavocBot_ChooseRole(i, o) \
662     /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
663     /**/
664 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
665
666 /** called when a target is checked for accuracy */
667 #define EV_AccuracyTargetValid(i, o) \
668     /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
669     /** target */ i(entity, MUTATOR_ARGV_1_entity) \
670     /**/
671 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
672 enum {
673         MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
674         MUT_ACCADD_INVALID, // return this flag to make the function always continue
675         MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
676 };
677
678 /** Called when clearing the global parameters for a model */
679 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
680
681 /** Called when getting the global parameters for a model */
682 #define EV_GetModelParams(i, o) \
683     /** input */   i(string, MUTATOR_ARGV_0_string) \
684     /** command */ i(string, MUTATOR_ARGV_1_string) \
685     /**/
686 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
687
688 /** called when a bullet has hit a target */
689 #define EV_FireBullet_Hit(i, o) \
690     /** player */       i(entity, MUTATOR_ARGV_0_entity) \
691     /** targ */         i(entity, MUTATOR_ARGV_1_entity) \
692     /** start pos */    i(vector, MUTATOR_ARGV_2_vector) \
693     /** end pos */      i(vector, MUTATOR_ARGV_3_vector) \
694     /** damage */       i(float, MUTATOR_ARGV_4_float) \
695     /**/                o(float, MUTATOR_ARGV_4_float) \
696     /** wep entity */   i(entity, MUTATOR_ARGV_5_entity) \
697     /**/
698 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
699
700 #define EV_FixPlayermodel(i, o) \
701     /** model */    i(string, MUTATOR_ARGV_0_string) \
702     /**/            o(string, MUTATOR_ARGV_0_string) \
703     /** skin */     i(int, MUTATOR_ARGV_1_int) \
704     /**/            o(int, MUTATOR_ARGV_1_int) \
705     /** player */   i(entity, MUTATOR_ARGV_2_entity) \
706     /**/
707 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
708
709 /** Return error to play frag remaining announcements */
710 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
711
712 #define EV_GrappleHookThink(i, o) \
713     /** hook */                i(entity, MUTATOR_ARGV_0_entity) \
714     /** tarzan */              i(int, MUTATOR_ARGV_1_int) \
715     /**/                       o(int, MUTATOR_ARGV_1_int) \
716     /** pulling entity */      i(entity, MUTATOR_ARGV_2_entity) \
717     /**/                       o(entity, MUTATOR_ARGV_2_entity) \
718     /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
719     /**/                       o(float, MUTATOR_ARGV_3_float) \
720     /**/
721 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
722
723 #define EV_BuffModel_Customize(i, o) \
724     /** buff */    i(entity, MUTATOR_ARGV_0_entity) \
725     /** player */  i(entity, MUTATOR_ARGV_1_entity) \
726     /**/
727 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
728
729 /** called at when a buff is touched. Called early, can edit buff properties. */
730 #define EV_BuffTouch(i, o) \
731     /** buff */    i(entity, MUTATOR_ARGV_0_entity) \
732     /** player */  i(entity, MUTATOR_ARGV_1_entity) \
733     /**/           o(entity, MUTATOR_ARGV_1_entity) \
734     /**/
735 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
736
737 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
738
739 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
740
741 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
742
743 #define EV_GetRecords(i, o) \
744     /** page */           i(int, MUTATOR_ARGV_0_int) \
745     /** record list */    i(string, MUTATOR_ARGV_1_string) \
746     /**/                  o(string, MUTATOR_ARGV_1_string) \
747     /**/
748 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
749
750 #define EV_Race_FinalCheckpoint(i, o) \
751     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
752     /**/
753 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
754
755 /** called when player triggered kill (or is changing teams), return error to not do anything */
756 #define EV_ClientKill(i, o) \
757     /** player */        i(entity, MUTATOR_ARGV_0_entity) \
758     /** kill delay */    i(float, MUTATOR_ARGV_1_float) \
759     /**/                 o(float, MUTATOR_ARGV_1_float) \
760     /**/
761 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
762
763 #define EV_FixClientCvars(i, o) \
764     /** player */        i(entity, MUTATOR_ARGV_0_entity) \
765     /**/
766 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
767
768 #define EV_SpectateSet(i, o) \
769     /** client */    i(entity, MUTATOR_ARGV_0_entity) \
770     /** target */    i(entity, MUTATOR_ARGV_1_entity) \
771     /**/             o(entity, MUTATOR_ARGV_1_entity) \
772     /**/
773 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
774
775 #define EV_SpectateNext(i, o) \
776     /** client */    i(entity, MUTATOR_ARGV_0_entity) \
777     /** target */    i(entity, MUTATOR_ARGV_1_entity) \
778     /**/             o(entity, MUTATOR_ARGV_1_entity) \
779     /**/
780 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
781
782 #define EV_SpectatePrev(i, o) \
783     /** client */    i(entity, MUTATOR_ARGV_0_entity) \
784     /** target */    i(entity, MUTATOR_ARGV_1_entity) \
785     /**/             o(entity, MUTATOR_ARGV_1_entity) \
786         /** first */     i(entity, MUTATOR_ARGV_2_entity) \
787     /**/
788 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
789
790 enum {
791     MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
792     MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
793     MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
794 };
795
796 /** called when player triggered kill (or is changing teams), return error to not do anything */
797 #define EV_Bot_FixCount(i, o) \
798         /** active real players */  i(int, MUTATOR_ARGV_0_int) \
799         /**/                                            o(int, MUTATOR_ARGV_0_int) \
800     /** real players */                 i(int, MUTATOR_ARGV_1_int) \
801     /**/                                        o(int, MUTATOR_ARGV_1_int) \
802     /**/
803 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
804
805 #define EV_ClientCommand_Spectate(i, o) \
806     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
807     /**/
808 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
809
810 enum {
811     MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
812     MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
813     MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
814 };
815
816 #define EV_CheckRules_World(i, o) \
817     /** status */    i(float, MUTATOR_ARGV_0_float) \
818     /**/             o(float, MUTATOR_ARGV_0_float) \
819     /* time limit */ i(float, MUTATOR_ARGV_1_float) \
820     /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
821     /**/
822 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
823
824 #define EV_WantWeapon(i, o) \
825     /** weapon info entity */    i(entity, MUTATOR_ARGV_0_entity) \
826     /** do want? */              i(float, MUTATOR_ARGV_1_float) \
827     /**/                         o(float, MUTATOR_ARGV_1_float) \
828     /** want all guns */         i(bool, MUTATOR_ARGV_2_bool) \
829     /**/                         o(bool, MUTATOR_ARGV_2_bool) \
830     /** want mutator blocked */  i(bool, MUTATOR_ARGV_3_bool) \
831     /**/                         o(bool, MUTATOR_ARGV_3_bool) \
832     /**/
833 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
834
835 #define EV_AddPlayerScore(i, o) \
836     /** score field */  i(entity, MUTATOR_ARGV_0_entity) \
837     /** score */        i(float, MUTATOR_ARGV_1_float) \
838     /**/                o(float, MUTATOR_ARGV_1_float) \
839     /** player */       i(entity, MUTATOR_ARGV_2_entity) \
840     /**/
841 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
842
843 #define EV_GetPlayerStatus(i, o) \
844     /** player */    i(entity, MUTATOR_ARGV_0_entity) \
845     /**/
846 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
847
848 #define EV_SetWeaponArena(i, o) \
849     /** arena */     i(string, MUTATOR_ARGV_0_string) \
850     /**/             o(string, MUTATOR_ARGV_0_string) \
851     /**/
852 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
853
854 #define EV_DropSpecialItems(i, o) \
855     /** target */ i(entity, MUTATOR_ARGV_0_entity) \
856     /**/
857 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
858
859 /**
860  * called when an admin tries to kill all monsters
861  * return 1 to prevent spawning
862  */
863 #define EV_AllowMobButcher(i, o) \
864     /** reason */ o(string, MUTATOR_ARGV_0_string) \
865     /**/
866 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
867
868 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
869
870 #define EV_SendWaypoint(i, o) \
871         /** waypoint */     i(entity, MUTATOR_ARGV_0_entity) \
872         /** to */               i(entity, MUTATOR_ARGV_1_entity) \
873         /** send flags */   i(int, MUTATOR_ARGV_2_int) \
874         /**/                            o(int, MUTATOR_ARGV_2_int) \
875         /** wp flag */      i(int, MUTATOR_ARGV_3_int) \
876         /**/                            o(int, MUTATOR_ARGV_3_int) \
877     /**/
878 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
879
880 #define EV_TurretValidateTarget(i, o) \
881     /** turret */          i(entity, MUTATOR_ARGV_0_entity) \
882     /** target */          i(entity, MUTATOR_ARGV_1_entity) \
883     /** validate flags */  i(int, MUTATOR_ARGV_2_int) \
884     /** target score */    o(float, MUTATOR_ARGV_3_float) \
885     /**/
886 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
887
888 #define EV_TurretThink(i, o) \
889     /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
890     /**/
891 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
892
893 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
894
895 /** */
896 #define EV_PrepareExplosionByDamage(i, o) \
897     /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
898     /** attacker */   i(entity, MUTATOR_ARGV_1_entity) \
899     /**/
900 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
901
902 /** called when a monster model is about to be set, allows custom paths etc. */
903 #define EV_MonsterModel(i, o) \
904         /** model */  i(string, MUTATOR_ARGV_0_string) \
905         /** output */ i(string, MUTATOR_ARGV_1_string) \
906         /**/              o(string, MUTATOR_ARGV_1_string) \
907     /**/
908 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
909
910 /**/
911 #define EV_Player_ChangeTeam(i, o) \
912     /** player */         i(entity, MUTATOR_ARGV_0_entity) \
913         /** current team */   i(float, MUTATOR_ARGV_1_float) \
914         /** new team */       i(float, MUTATOR_ARGV_2_float) \
915     /**/
916 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
917
918 /**/
919 #define EV_URI_GetCallback(i, o) \
920         /** id */       i(float, MUTATOR_ARGV_0_float) \
921         /** status */   i(float, MUTATOR_ARGV_1_float) \
922         /** data */     i(string, MUTATOR_ARGV_2_string) \
923     /**/
924 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
925
926 /**
927  * return true to prevent weapon use for a player
928  */
929  #define EV_ForbidWeaponUse(i, o) \
930     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
931     /**/
932 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
933
934 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
935 #define EV_CopyBody(i, o) \
936     /** player */               i(entity, MUTATOR_ARGV_0_entity) \
937     /** newly created clone */  i(entity, MUTATOR_ARGV_1_entity) \
938     /** keepvelocity? */        i(bool, MUTATOR_ARGV_2_bool) \
939     /**/
940 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
941
942 /** called when sending a chat message, ret argument can be changed to prevent the message */
943 #define EV_ChatMessage(i, o) \
944     /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
945     /** ret */ i(int, MUTATOR_ARGV_1_int) \
946     /**/ o(int, MUTATOR_ARGV_1_int) \
947     /**/
948 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
949
950 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
951 #define EV_ChatMessageTo(i, o) \
952     /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
953     /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
954     /**/
955 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
956
957 /** return true to just restart the match, for modes that don't support readyrestart */
958 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
959
960 /** called when a fusion reactor is validating its target */
961 #define EV_FusionReactor_ValidTarget(i, o) \
962     /** turret */    i(entity, MUTATOR_ARGV_0_entity) \
963     /** target */    i(entity, MUTATOR_ARGV_1_entity) \
964     /**/
965 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
966
967 enum {
968     MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
969     MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
970     MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
971 };
972
973 /** return true to hide the 'teamnumbers are imbalanced' message */
974 #define EV_HideTeamNagger(i, o) \
975     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
976     /**/
977 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
978
979 /** return true to show a waypoint while the item is spawning */
980 #define EV_Item_ScheduleRespawn(i, o) \
981     /** item */             i(entity, MUTATOR_ARGV_0_entity) \
982     /** respawn time */     i(float, MUTATOR_ARGV_1_float) \
983     /**/
984 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
985
986 /** called before physics stats are set on a player, allows limited early customization */
987 #define EV_PlayerPhysics_UpdateStats(i, o) \
988     /** player */             i(entity, MUTATOR_ARGV_0_entity) \
989     /**/
990 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
991
992 /** return true to use your own aim target (or none at all) */
993 #define EV_HavocBot_Aim(i, o) \
994     /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
995     /**/
996 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);