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