3 #include <common/mutators/base.qh>
5 // register all possible hooks here
7 // to use a hook, first register your mutator using REGISTER_MUTATOR
8 // then create your function using MUTATOR_HOOKFUNCTION
10 /** called when a player becomes observer, after shared setup */
11 #define EV_MakePlayerObserver(i, o) \
12 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
14 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
17 #define EV_PutClientInServer(i, o) \
18 /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
20 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
23 * return true to prevent a spectator/observer to spawn as player
25 #define EV_ForbidSpawn(i, o) \
26 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
28 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
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) \
34 MUTATOR_HOOKABLE(ForbidRandomStartWeapons, EV_ForbidRandomStartWeapons);
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) \
41 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
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) \
47 MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
49 /** called in reset_map */
50 #define EV_reset_map_global(i, o) \
52 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
54 /** called in reset_map */
55 #define EV_reset_map_players(i, o) \
57 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
59 /** returns 1 if clearing player score shall not be allowed */
60 #define EV_ForbidPlayerScore_Clear(i, o) \
62 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
64 /** called when a player disconnects */
65 #define EV_ClientDisconnect(i, o) \
66 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
68 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
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) \
79 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
81 /** called after a player died. */
82 #define EV_PlayerDied(i, o) \
83 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
85 MUTATOR_HOOKABLE(PlayerDied, EV_PlayerDied);
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) \
95 MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage);
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) \
102 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
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) \
110 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
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) \
118 MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
120 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
121 #define EV_GiveFragsForKill(i, o) \
122 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
123 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
124 /** frag score */ i(float, MUTATOR_ARGV_2_float) \
125 /** */ o(float, MUTATOR_ARGV_2_float) \
126 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
127 /** wep entity */ i(entity, MUTATOR_ARGV_4_entity) \
129 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
131 /** called when the match ends */
132 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
134 /** allows adjusting allowed teams */
135 #define EV_CheckAllowedTeams(i, o) \
136 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
137 /**/ o(float, MUTATOR_ARGV_0_float) \
138 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
139 /**/ o(string, MUTATOR_ARGV_1_string) \
140 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
142 MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
144 /** return true to manually override team counts */
145 MUTATOR_HOOKABLE(GetTeamCounts, EV_NO_ARGS);
147 /** allow overriding of team counts */
148 #define EV_GetTeamCount(i, o) \
149 /** team to count */ i(float, MUTATOR_ARGV_0_float) \
150 /** player to ignore */ i(entity, MUTATOR_ARGV_1_entity) \
151 /** number of players in a team */ i(float, MUTATOR_ARGV_2_float) \
152 /**/ o(float, MUTATOR_ARGV_2_float) \
153 /** number of bots in a team */ i(float, MUTATOR_ARGV_3_float) \
154 /**/ o(float, MUTATOR_ARGV_3_float) \
155 /** lowest scoring human in a team */ i(entity, MUTATOR_ARGV_4_entity) \
156 /**/ o(entity, MUTATOR_ARGV_4_entity) \
157 /** lowest scoring bot in a team */ i(entity, MUTATOR_ARGV_5_entity) \
158 /**/ o(entity, MUTATOR_ARGV_5_entity) \
160 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
162 /** allows overriding best teams */
163 #define EV_FindBestTeams(i, o) \
164 /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
165 /** bitmask of teams */ o(float, MUTATOR_ARGV_1_float) \
167 MUTATOR_HOOKABLE(FindBestTeams, EV_FindBestTeams);
169 /** copies variables for spectating "spectatee" to "this" */
170 #define EV_SpectateCopy(i, o) \
171 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
172 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
174 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
176 /** called when formatting a chat message to replace fancy functions */
177 #define EV_FormatMessage(i, o) \
178 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
179 /** escape */ i(string, MUTATOR_ARGV_1_string) \
180 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
181 /**/ o(string, MUTATOR_ARGV_2_string) \
182 /** message */ i(string, MUTATOR_ARGV_3_string) \
184 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
186 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
187 #define EV_PreFormatMessage(i, o) \
188 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
189 /** message */ i(string, MUTATOR_ARGV_1_string) \
190 /**/ o(string, MUTATOR_ARGV_1_string) \
192 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
194 /** returns true if throwing the current weapon shall not be allowed */
195 #define EV_ForbidThrowCurrentWeapon(i, o) \
196 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
197 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
199 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
201 /** returns true if dropping the current weapon shall not be allowed at any time including death */
202 #define EV_ForbidDropCurrentWeapon(i, o) \
203 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
204 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
206 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
209 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
211 /** allows changing attack rate */
212 #define EV_WeaponRateFactor(i, o) \
213 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
214 /**/ o(float, MUTATOR_ARGV_0_float) \
215 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
217 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
219 /** allows changing weapon speed (projectiles mostly) */
220 #define EV_WeaponSpeedFactor(i, o) \
221 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
222 /**/ o(float, MUTATOR_ARGV_0_float) \
223 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
225 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
227 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
228 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
230 /** called every frame. customizes the waypoint for spectators */
231 #define EV_CustomizeWaypoint(i, o) \
232 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
233 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
235 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
237 /** Check if items having the given definition are allowed to spawn.
238 * Return true to disallow spawning.
240 #define EV_FilterItemDefinition(i, o) \
241 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
243 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
246 * checks if the current item may be spawned (.items may be read and written to, as well as the ammo_ fields)
247 * return error to request removal
249 #define EV_FilterItem(i, o) \
250 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
252 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
254 /** return error to request removal */
255 #define EV_TurretSpawn(i, o) \
256 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
258 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
260 /** return error to not attack */
261 #define EV_TurretFire(i, o) \
262 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
264 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
266 /** return error to not attack */
267 #define EV_Turret_CheckFire(i, o) \
268 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
269 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
271 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
273 /** return error to prevent entity spawn, or modify the entity */
274 #define EV_OnEntityPreSpawn(i, o) \
275 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
277 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
279 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
280 #define EV_PlayerPreThink(i, o) \
281 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
283 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
285 /** TODO change this into a general PlayerPostThink hook? */
286 #define EV_GetPressedKeys(i, o) \
287 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
289 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
291 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
292 #define EV_GetCvars(i, o) \
293 /**/ i(float, get_cvars_f) \
294 /**/ i(string, get_cvars_s) \
298 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
300 /** can edit any "just fired" projectile */
301 #define EV_EditProjectile(i, o) \
302 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
303 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
305 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
307 /** called when a monster spawns */
308 #define EV_MonsterSpawn(i, o) \
309 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
311 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
313 /** called when a monster dies */
314 #define EV_MonsterDies(i, o) \
315 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
316 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
317 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
319 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
321 /** called when a monster dies */
322 #define EV_MonsterRemove(i, o) \
323 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
325 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
327 /** called when a monster wants to respawn */
328 #define EV_MonsterRespawn(i, o) \
329 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
331 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
333 /** called when a monster is dropping loot */
334 #define EV_MonsterDropItem(i, o) \
335 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
336 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
337 /**/ o(entity, MUTATOR_ARGV_1_entity) \
338 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
340 .entity monster_loot;
341 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
344 * called when a monster moves
345 * returning true makes the monster stop
347 #define EV_MonsterMove(i, o) \
348 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
349 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
350 /**/ o(float, MUTATOR_ARGV_1_float) \
351 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
352 /**/ o(float, MUTATOR_ARGV_2_float) \
353 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
354 /**/ o(entity, MUTATOR_ARGV_3_entity) \
356 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
358 /** called when a monster looks for another target */
359 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
362 * called when validating a monster's target
364 #define EV_MonsterValidTarget(i, o) \
365 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
366 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
368 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
370 /** called to change a random monster to a miniboss */
371 #define EV_MonsterCheckBossFlag(i, o) \
372 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
374 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
377 * called when a player tries to spawn a monster
378 * return 1 to prevent spawning
379 * NOTE: requires reason if disallowed
381 #define EV_AllowMobSpawning(i, o) \
382 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
383 /** reason */ o(string, MUTATOR_ARGV_1_string) \
385 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
387 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
388 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
389 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
390 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
391 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
392 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
393 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
394 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
395 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
396 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
397 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
398 /** damage */ i(float, MUTATOR_ARGV_7_float) \
400 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
403 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
404 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
406 #define EV_Damage_Calculate(i, o) \
407 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
408 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
409 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
410 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
411 /** damage */ i(float, MUTATOR_ARGV_4_float) \
412 /** damage */ o(float, MUTATOR_ARGV_4_float) \
413 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
414 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
415 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
416 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
417 /** weapon entity */ i(entity, MUTATOR_ARGV_7_entity) \
419 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
422 * Called when a player is damaged
424 #define EV_PlayerDamaged(i, o) \
425 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
426 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
427 /** health */ i(float, MUTATOR_ARGV_2_float) \
428 /** armor */ i(float, MUTATOR_ARGV_3_float) \
429 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
430 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
431 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
433 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
436 * Called by W_DecreaseAmmo
438 #define EV_W_DecreaseAmmo(i, o) \
439 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
440 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
441 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
442 /**/ o(float, MUTATOR_ARGV_2_float) \
444 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
449 #define EV_W_Reload(i, o) \
450 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
452 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
454 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
455 #define EV_PlayerPowerups(i, o) \
456 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
457 /** old items */ i(int, MUTATOR_ARGV_1_int) \
459 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
462 * called every player think frame
463 * return 1 to disable regen
465 #define EV_PlayerRegen(i, o) \
466 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
467 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
468 /**/ o(float, MUTATOR_ARGV_1_float) \
469 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
470 /**/ o(float, MUTATOR_ARGV_2_float) \
471 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
472 /**/ o(float, MUTATOR_ARGV_3_float) \
473 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
474 /**/ o(float, MUTATOR_ARGV_4_float) \
475 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
476 /**/ o(float, MUTATOR_ARGV_5_float) \
477 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
478 /**/ o(float, MUTATOR_ARGV_6_float) \
479 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
480 /**/ o(float, MUTATOR_ARGV_7_float) \
481 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
482 /**/ o(float, MUTATOR_ARGV_8_float) \
483 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
484 /**/ o(float, MUTATOR_ARGV_9_float) \
485 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
486 /**/ o(float, MUTATOR_ARGV_10_float) \
488 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
491 * called when the use key is pressed
492 * if MUTATOR_RETURNVALUE is 1, don't do anything
493 * return 1 if the use key actually did something
495 #define EV_PlayerUseKey(i, o) \
496 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
498 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
501 * called when a client command is parsed
502 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
503 * NOTE: return true if you handled the command, return false to continue handling
504 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
506 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
508 * if (MUTATOR_RETURNVALUE) // command was already handled?
510 * if (cmd_name == "echocvar" && cmd_argc >= 2)
512 * print(cvar_string(argv(1)), "\n");
515 * if (cmd_name == "echostring" && cmd_argc >= 2)
517 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
523 #define EV_SV_ParseClientCommand(i, o) \
524 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
525 /** command name */ i(string, MUTATOR_ARGV_1_string) \
526 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
527 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
529 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
531 /** please read EV_SV_ParseClientCommand description before using */
532 #define EV_SV_ParseServerCommand(i, o) \
533 /** command name */ i(string, MUTATOR_ARGV_0_string) \
534 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
535 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
537 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
540 * called when a spawnpoint is being evaluated
541 * return 1 to make the spawnpoint unusable
543 #define EV_Spawn_Score(i, o) \
544 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
545 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
546 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
547 /**/ o(vector, MUTATOR_ARGV_2_vector) \
549 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
551 /** runs globally each server frame */
552 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
554 #define EV_SetModname(i, o) \
555 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
556 /**/ i(string, MUTATOR_ARGV_0_string) \
557 /**/ o(string, MUTATOR_ARGV_0_string) \
559 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
562 * called for each item being spawned on a map, including dropped weapons
563 * return 1 to remove an item
565 #define EV_Item_Spawn(i, o) \
566 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
568 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
570 #define EV_SetWeaponreplace(i, o) \
571 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
572 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
573 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
574 /**/ o(string, MUTATOR_ARGV_2_string) \
576 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
578 /** called when an item is about to respawn */
579 #define EV_Item_RespawnCountdown(i, o) \
580 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
582 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
584 /** called when a bot checks a target to attack */
585 #define EV_BotShouldAttack(i, o) \
586 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
587 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
589 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
592 * called whenever a player goes through a portal gun teleport
593 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
595 #define EV_PortalTeleport(i, o) \
596 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
598 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
601 * called whenever a player uses impulse 33 (help me) in impulse.qc
602 * normally help me ping uses .waypointsprite_attachedforcarrier,
603 * but if your mutator uses something different then you can handle it
604 * in a special manner using this hook
606 #define EV_HelpMePing(i, o) \
607 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
609 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
612 * called when a vehicle initializes
613 * return true to remove the vehicle
615 #define EV_VehicleInit(i, o) \
616 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
618 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
621 * called when a player enters a vehicle
622 * allows mutators to set special settings in this event
624 #define EV_VehicleEnter(i, o) \
625 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
626 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
628 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
631 * called when a player touches a vehicle
632 * return true to stop player from entering the vehicle
634 #define EV_VehicleTouch(i, o) \
635 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
636 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
638 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
641 * called when a player exits a vehicle
642 * allows mutators to set special settings in this event
644 #define EV_VehicleExit(i, o) \
645 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
646 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
648 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
650 /** called when a speedrun is aborted and the player is teleported back to start position */
651 #define EV_AbortSpeedrun(i, o) \
652 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
654 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
656 /** called at when a item is touched. Called early, can edit item properties. */
657 #define EV_ItemTouch(i, o) \
658 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
659 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
660 /**/ o(entity, MUTATOR_ARGV_1_entity) \
662 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
665 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
666 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
667 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
670 /** called after the item has been touched. */
671 #define EV_ItemTouched(i, o) \
672 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
673 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
675 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
677 /** Called when the amount of entity resources changes. Can be used to override
679 #define EV_GetResourceLimit(i, o) \
680 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
681 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
682 /** limit */ i(float, MUTATOR_ARGV_2_float) \
683 /**/ o(float, MUTATOR_ARGV_2_float) \
685 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
687 /** Called when the amount of resource of an entity changes. See RESOURCE_*
688 constants for resource types. Return true to forbid the change. */
689 #define EV_SetResourceAmount(i, o) \
690 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
691 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
692 /**/ o(int, MUTATOR_ARGV_1_int) \
693 /** amount */ i(float, MUTATOR_ARGV_2_float) \
694 /**/ o(float, MUTATOR_ARGV_2_float) \
696 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
698 /** Called after the amount of resource of an entity has changed. See RESOURCE_*
699 constants for resource types. Amount wasted is the amount of resource that is
700 above resource limit so it was not given. */
701 #define EV_ResourceAmountChanged(i, o) \
702 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
703 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
704 /** amount */ i(float, MUTATOR_ARGV_2_float) \
706 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
708 /** Called when there was an attempt to set entity resources higher than their
709 limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
710 of resource that is above resource limit so it was not given. */
711 #define EV_ResourceWasted(i, o) \
712 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
713 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
714 /** amount wasted */ i(float, MUTATOR_ARGV_2_float) \
716 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
718 /** Called when entity is being given some resource. See RESOURCE_* constants
719 for resource types. Return true to forbid giving. */
720 #define EV_GiveResource(i, o) \
721 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
722 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
723 /**/ o(int, MUTATOR_ARGV_1_int) \
724 /** amount */ i(float, MUTATOR_ARGV_2_float) \
725 /**/ o(float, MUTATOR_ARGV_2_float) \
727 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
729 /** Called when entity is being given some resource with specified limit. See
730 RESOURCE_* constants for resource types. Return true to forbid giving. */
731 #define EV_GiveResourceWithLimit(i, o) \
732 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
733 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
734 /**/ o(int, MUTATOR_ARGV_1_int) \
735 /** amount */ i(float, MUTATOR_ARGV_2_float) \
736 /**/ o(float, MUTATOR_ARGV_2_float) \
737 /** limit */ i(float, MUTATOR_ARGV_3_float) \
738 /**/ o(float, MUTATOR_ARGV_3_float) \
740 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
742 /** called at when a player connect */
743 #define EV_ClientConnect(i, o) \
744 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
746 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
748 #define EV_HavocBot_ChooseRole(i, o) \
749 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
751 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
753 /** called when a target is checked for accuracy */
754 #define EV_AccuracyTargetValid(i, o) \
755 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
756 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
758 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
760 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
761 MUT_ACCADD_INVALID, // return this flag to make the function always continue
762 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
765 /** Called when clearing the global parameters for a model */
766 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
768 /** Called when getting the global parameters for a model */
769 #define EV_GetModelParams(i, o) \
770 /** input */ i(string, MUTATOR_ARGV_0_string) \
771 /** command */ i(string, MUTATOR_ARGV_1_string) \
773 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
775 /** called when a bullet has hit a target */
776 #define EV_FireBullet_Hit(i, o) \
777 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
778 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
779 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
780 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
781 /** damage */ i(float, MUTATOR_ARGV_4_float) \
782 /**/ o(float, MUTATOR_ARGV_4_float) \
783 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
785 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
787 #define EV_FixPlayermodel(i, o) \
788 /** model */ i(string, MUTATOR_ARGV_0_string) \
789 /**/ o(string, MUTATOR_ARGV_0_string) \
790 /** skin */ i(int, MUTATOR_ARGV_1_int) \
791 /**/ o(int, MUTATOR_ARGV_1_int) \
792 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
794 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
796 /** Return error to play frag remaining announcements */
797 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
799 #define EV_GrappleHookThink(i, o) \
800 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
801 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
802 /**/ o(int, MUTATOR_ARGV_1_int) \
803 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
804 /**/ o(entity, MUTATOR_ARGV_2_entity) \
805 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
806 /**/ o(float, MUTATOR_ARGV_3_float) \
808 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
810 #define EV_BuffModel_Customize(i, o) \
811 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
812 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
814 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
816 /** called at when a buff is touched. Called early, can edit buff properties. */
817 #define EV_BuffTouch(i, o) \
818 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
819 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
820 /**/ o(entity, MUTATOR_ARGV_1_entity) \
822 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
824 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
826 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
828 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
830 #define EV_GetRecords(i, o) \
831 /** page */ i(int, MUTATOR_ARGV_0_int) \
832 /** record list */ i(string, MUTATOR_ARGV_1_string) \
833 /**/ o(string, MUTATOR_ARGV_1_string) \
835 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
837 #define EV_Race_FinalCheckpoint(i, o) \
838 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
840 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
842 /** called when player triggered kill (or is changing teams), return error to not do anything */
843 #define EV_ClientKill(i, o) \
844 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
845 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
846 /**/ o(float, MUTATOR_ARGV_1_float) \
848 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
850 /** called when player is about to be killed during kill command or changing teams */
851 #define EV_ClientKill_Now(i, o) \
852 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
854 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
856 #define EV_FixClientCvars(i, o) \
857 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
859 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
861 #define EV_SpectateSet(i, o) \
862 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
863 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
864 /**/ o(entity, MUTATOR_ARGV_1_entity) \
866 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
868 #define EV_SpectateNext(i, o) \
869 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
870 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
871 /**/ o(entity, MUTATOR_ARGV_1_entity) \
873 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
875 #define EV_SpectatePrev(i, o) \
876 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
877 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
878 /**/ o(entity, MUTATOR_ARGV_1_entity) \
879 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
881 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
884 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
885 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
886 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
889 /** called when player triggered kill (or is changing teams), return error to not do anything */
890 #define EV_Bot_FixCount(i, o) \
891 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
892 /**/ o(int, MUTATOR_ARGV_0_int) \
893 /** real players */ i(int, MUTATOR_ARGV_1_int) \
894 /**/ o(int, MUTATOR_ARGV_1_int) \
896 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
898 #define EV_ClientCommand_Spectate(i, o) \
899 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
901 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
904 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
905 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
906 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
909 #define EV_CheckRules_World(i, o) \
910 /** status */ i(float, MUTATOR_ARGV_0_float) \
911 /**/ o(float, MUTATOR_ARGV_0_float) \
912 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
913 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
915 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
917 #define EV_WantWeapon(i, o) \
918 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
919 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
920 /**/ o(float, MUTATOR_ARGV_1_float) \
921 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
922 /**/ o(bool, MUTATOR_ARGV_2_bool) \
923 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
924 /**/ o(bool, MUTATOR_ARGV_3_bool) \
926 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
928 #define EV_AddPlayerScore(i, o) \
929 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
930 /** score */ i(float, MUTATOR_ARGV_1_float) \
931 /**/ o(float, MUTATOR_ARGV_1_float) \
932 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
934 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
936 #define EV_AddedPlayerScore(i, o) \
937 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
938 /** score */ i(float, MUTATOR_ARGV_1_float) \
939 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
941 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
943 #define EV_GetPlayerStatus(i, o) \
944 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
946 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
948 #define EV_SetWeaponArena(i, o) \
949 /** arena */ i(string, MUTATOR_ARGV_0_string) \
950 /**/ o(string, MUTATOR_ARGV_0_string) \
952 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
954 #define EV_DropSpecialItems(i, o) \
955 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
957 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
960 * called when an admin tries to kill all monsters
961 * return 1 to prevent spawning
963 #define EV_AllowMobButcher(i, o) \
964 /** reason */ o(string, MUTATOR_ARGV_0_string) \
966 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
968 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
970 #define EV_SendWaypoint(i, o) \
971 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
972 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
973 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
974 /**/ o(int, MUTATOR_ARGV_2_int) \
975 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
976 /**/ o(int, MUTATOR_ARGV_3_int) \
978 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
980 #define EV_TurretValidateTarget(i, o) \
981 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
982 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
983 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
984 /** target score */ o(float, MUTATOR_ARGV_3_float) \
986 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
988 #define EV_TurretThink(i, o) \
989 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
991 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
993 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
996 #define EV_PrepareExplosionByDamage(i, o) \
997 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
998 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1000 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1002 /** called when a monster model is about to be set, allows custom paths etc. */
1003 #define EV_MonsterModel(i, o) \
1004 /** model */ i(string, MUTATOR_ARGV_0_string) \
1005 /** output */ i(string, MUTATOR_ARGV_1_string) \
1006 /**/ o(string, MUTATOR_ARGV_1_string) \
1008 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1011 * Called before player changes their team. Return true to block team change.
1013 #define EV_Player_ChangeTeam(i, o) \
1014 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1015 /** current team */ i(float, MUTATOR_ARGV_1_float) \
1016 /** new team */ i(float, MUTATOR_ARGV_2_float) \
1018 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1021 * Called after player has changed their team.
1023 #define EV_Player_ChangedTeam(i, o) \
1024 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1025 /** old team */ i(float, MUTATOR_ARGV_1_float) \
1026 /** current team */ i(float, MUTATOR_ARGV_2_float) \
1028 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1031 * Called when player is about to be killed when changing teams. Return true to block killing.
1033 #define EV_Player_ChangeTeamKill(i, o) \
1034 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1036 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1039 #define EV_URI_GetCallback(i, o) \
1040 /** id */ i(float, MUTATOR_ARGV_0_float) \
1041 /** status */ i(float, MUTATOR_ARGV_1_float) \
1042 /** data */ i(string, MUTATOR_ARGV_2_string) \
1044 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1047 * return true to prevent weapon use for a player
1049 #define EV_ForbidWeaponUse(i, o) \
1050 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1052 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1054 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1055 #define EV_CopyBody(i, o) \
1056 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1057 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1058 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1060 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1062 /** called when sending a chat message, ret argument can be changed to prevent the message */
1063 #define EV_ChatMessage(i, o) \
1064 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1065 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1066 /**/ o(int, MUTATOR_ARGV_1_int) \
1068 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1070 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1071 #define EV_ChatMessageTo(i, o) \
1072 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1073 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1075 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1077 /** return true to just restart the match, for modes that don't support readyrestart */
1078 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1080 /** called when a fusion reactor is validating its target */
1081 #define EV_FusionReactor_ValidTarget(i, o) \
1082 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1083 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1085 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1088 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1089 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1090 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1093 /** return true to hide the 'teamnumbers are imbalanced' message */
1094 #define EV_HideTeamNagger(i, o) \
1095 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1097 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1099 /** return true to show a waypoint while the item is spawning */
1100 #define EV_Item_ScheduleRespawn(i, o) \
1101 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1102 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1104 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1106 /** called before physics stats are set on a player, allows limited early customization */
1107 #define EV_PlayerPhysics_UpdateStats(i, o) \
1108 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1110 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1112 /** called after physics stats are set on a player, allows post-initialization modifications */
1113 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1114 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1115 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1117 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1119 /** return true to use your own aim target (or none at all) */
1120 #define EV_HavocBot_Aim(i, o) \
1121 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1123 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1125 /** return true to skip respawn time calculations */
1126 #define EV_CalculateRespawnTime(i, o) \
1127 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1129 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1131 /** called when parsing a vote command. */
1132 #define EV_VoteCommand_Parse(i, o) \
1133 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1134 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1135 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1136 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1137 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1139 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1142 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1143 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1144 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1145 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)