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