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