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