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