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