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