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