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