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) \
127 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
129 /** called when the match ends */
130 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
132 /** allows adjusting allowed teams */
133 #define EV_CheckAllowedTeams(i, o) \
134 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
135 /**/ o(float, MUTATOR_ARGV_0_float) \
136 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
137 /**/ o(string, MUTATOR_ARGV_1_string) \
138 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
140 MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
142 /** return true to manually override team counts */
143 MUTATOR_HOOKABLE(GetTeamCounts, EV_NO_ARGS);
145 /** allow overriding of team counts */
146 #define EV_GetTeamCount(i, o) \
147 /** team to count */ i(float, MUTATOR_ARGV_0_float) \
148 /** player to ignore */ i(entity, MUTATOR_ARGV_1_entity) \
149 /** number of players in a team */ i(float, MUTATOR_ARGV_2_float) \
150 /**/ o(float, MUTATOR_ARGV_2_float) \
151 /** number of bots in a team */ i(float, MUTATOR_ARGV_3_float) \
152 /**/ o(float, MUTATOR_ARGV_3_float) \
153 /** lowest scoring human in a team */ i(entity, MUTATOR_ARGV_4_entity) \
154 /**/ o(entity, MUTATOR_ARGV_4_entity) \
155 /** lowest scoring bot in a team */ i(entity, MUTATOR_ARGV_5_entity) \
156 /**/ o(entity, MUTATOR_ARGV_5_entity) \
158 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
160 /** allows overriding best teams */
161 #define EV_FindBestTeams(i, o) \
162 /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
163 /** bitmask of teams */ o(float, MUTATOR_ARGV_1_float) \
165 MUTATOR_HOOKABLE(FindBestTeams, EV_FindBestTeams);
167 /** copies variables for spectating "spectatee" to "this" */
168 #define EV_SpectateCopy(i, o) \
169 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
170 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
172 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
174 /** called when formatting a chat message to replace fancy functions */
175 #define EV_FormatMessage(i, o) \
176 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
177 /** escape */ i(string, MUTATOR_ARGV_1_string) \
178 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
179 /**/ o(string, MUTATOR_ARGV_2_string) \
180 /** message */ i(string, MUTATOR_ARGV_3_string) \
182 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
184 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
185 #define EV_PreFormatMessage(i, o) \
186 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
187 /** message */ i(string, MUTATOR_ARGV_1_string) \
188 /**/ o(string, MUTATOR_ARGV_1_string) \
190 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
192 /** returns true if throwing the current weapon shall not be allowed */
193 #define EV_ForbidThrowCurrentWeapon(i, o) \
194 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
195 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
197 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
199 /** returns true if dropping the current weapon shall not be allowed at any time including death */
200 #define EV_ForbidDropCurrentWeapon(i, o) \
201 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
202 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
204 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
207 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
209 /** allows changing attack rate */
210 #define EV_WeaponRateFactor(i, o) \
211 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
212 /**/ o(float, MUTATOR_ARGV_0_float) \
213 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
215 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
217 /** allows changing weapon speed (projectiles mostly) */
218 #define EV_WeaponSpeedFactor(i, o) \
219 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
220 /**/ o(float, MUTATOR_ARGV_0_float) \
221 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
223 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
225 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
226 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
228 /** called every frame. customizes the waypoint for spectators */
229 #define EV_CustomizeWaypoint(i, o) \
230 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
231 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
233 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
235 /** Check if items having the given definition are allowed to spawn.
236 * Return true to disallow spawning.
238 #define EV_FilterItemDefinition(i, o) \
239 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
241 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
244 * checks if the current item may be spawned (.items and .weapons may be read and written to, as well as the ammo_ fields)
245 * return error to request removal
247 #define EV_FilterItem(i, o) \
248 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
250 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
252 /** return error to request removal */
253 #define EV_TurretSpawn(i, o) \
254 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
256 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
258 /** return error to not attack */
259 #define EV_TurretFire(i, o) \
260 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
262 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
264 /** return error to not attack */
265 #define EV_Turret_CheckFire(i, o) \
266 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
267 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
269 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
271 /** return error to prevent entity spawn, or modify the entity */
272 #define EV_OnEntityPreSpawn(i, o) \
273 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
275 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
277 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
278 #define EV_PlayerPreThink(i, o) \
279 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
281 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
283 /** TODO change this into a general PlayerPostThink hook? */
284 #define EV_GetPressedKeys(i, o) \
285 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
287 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
289 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
290 #define EV_GetCvars(i, o) \
291 /**/ i(float, get_cvars_f) \
292 /**/ i(string, get_cvars_s) \
296 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
298 /** can edit any "just fired" projectile */
299 #define EV_EditProjectile(i, o) \
300 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
301 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
303 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
305 /** called when a monster spawns */
306 #define EV_MonsterSpawn(i, o) \
307 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
309 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
311 /** called when a monster dies */
312 #define EV_MonsterDies(i, o) \
313 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
314 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
315 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
317 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
319 /** called when a monster dies */
320 #define EV_MonsterRemove(i, o) \
321 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
323 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
325 /** called when a monster wants to respawn */
326 #define EV_MonsterRespawn(i, o) \
327 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
329 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
331 /** called when a monster is dropping loot */
332 #define EV_MonsterDropItem(i, o) \
333 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
334 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
335 /**/ o(entity, MUTATOR_ARGV_1_entity) \
336 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
338 .entity monster_loot;
339 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
342 * called when a monster moves
343 * returning true makes the monster stop
345 #define EV_MonsterMove(i, o) \
346 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
347 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
348 /**/ o(float, MUTATOR_ARGV_1_float) \
349 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
350 /**/ o(float, MUTATOR_ARGV_2_float) \
351 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
352 /**/ o(entity, MUTATOR_ARGV_3_entity) \
354 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
356 /** called when a monster looks for another target */
357 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
360 * called when validating a monster's target
362 #define EV_MonsterValidTarget(i, o) \
363 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
364 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
366 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
368 /** called to change a random monster to a miniboss */
369 #define EV_MonsterCheckBossFlag(i, o) \
370 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
372 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
375 * called when a player tries to spawn a monster
376 * return 1 to prevent spawning
377 * NOTE: requires reason if disallowed
379 #define EV_AllowMobSpawning(i, o) \
380 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
381 /** reason */ o(string, MUTATOR_ARGV_1_string) \
383 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
385 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
386 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
387 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
388 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
389 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
390 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
391 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
392 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
393 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
394 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
395 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
396 /** damage */ i(float, MUTATOR_ARGV_7_float) \
398 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
401 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
402 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
404 #define EV_Damage_Calculate(i, o) \
405 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
406 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
407 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
408 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
409 /** damage */ i(float, MUTATOR_ARGV_4_float) \
410 /** damage */ o(float, MUTATOR_ARGV_4_float) \
411 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
412 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
413 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
414 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
416 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
419 * Called when a player is damaged
421 #define EV_PlayerDamaged(i, o) \
422 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
423 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
424 /** health */ i(float, MUTATOR_ARGV_2_float) \
425 /** armor */ i(float, MUTATOR_ARGV_3_float) \
426 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
427 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
428 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
430 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
433 * Called by W_DecreaseAmmo
435 #define EV_W_DecreaseAmmo(i, o) \
436 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
437 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
438 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
439 /**/ o(float, MUTATOR_ARGV_2_float) \
441 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
446 #define EV_W_Reload(i, o) \
447 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
449 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
451 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
452 #define EV_PlayerPowerups(i, o) \
453 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
454 /** old items */ i(int, MUTATOR_ARGV_1_int) \
456 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
459 * called every player think frame
460 * return 1 to disable regen
462 #define EV_PlayerRegen(i, o) \
463 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
464 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
465 /**/ o(float, MUTATOR_ARGV_1_float) \
466 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
467 /**/ o(float, MUTATOR_ARGV_2_float) \
468 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
469 /**/ o(float, MUTATOR_ARGV_3_float) \
470 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
471 /**/ o(float, MUTATOR_ARGV_4_float) \
472 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
473 /**/ o(float, MUTATOR_ARGV_5_float) \
474 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
475 /**/ o(float, MUTATOR_ARGV_6_float) \
476 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
477 /**/ o(float, MUTATOR_ARGV_7_float) \
478 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
479 /**/ o(float, MUTATOR_ARGV_8_float) \
480 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
481 /**/ o(float, MUTATOR_ARGV_9_float) \
482 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
483 /**/ o(float, MUTATOR_ARGV_10_float) \
485 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
488 * called when the use key is pressed
489 * if MUTATOR_RETURNVALUE is 1, don't do anything
490 * return 1 if the use key actually did something
492 #define EV_PlayerUseKey(i, o) \
493 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
495 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
498 * called when a client command is parsed
499 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
500 * NOTE: return true if you handled the command, return false to continue handling
501 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
503 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
505 * if (MUTATOR_RETURNVALUE) // command was already handled?
507 * if (cmd_name == "echocvar" && cmd_argc >= 2)
509 * print(cvar_string(argv(1)), "\n");
512 * if (cmd_name == "echostring" && cmd_argc >= 2)
514 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
520 #define EV_SV_ParseClientCommand(i, o) \
521 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
522 /** command name */ i(string, MUTATOR_ARGV_1_string) \
523 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
524 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
526 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
528 /** please read EV_SV_ParseClientCommand description before using */
529 #define EV_SV_ParseServerCommand(i, o) \
530 /** command name */ i(string, MUTATOR_ARGV_0_string) \
531 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
532 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
534 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
537 * called when a spawnpoint is being evaluated
538 * return 1 to make the spawnpoint unusable
540 #define EV_Spawn_Score(i, o) \
541 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
542 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
543 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
544 /**/ o(vector, MUTATOR_ARGV_2_vector) \
546 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
548 /** runs globally each server frame */
549 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
551 #define EV_SetModname(i, o) \
552 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
553 /**/ i(string, MUTATOR_ARGV_0_string) \
554 /**/ o(string, MUTATOR_ARGV_0_string) \
556 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
559 * called for each item being spawned on a map, including dropped weapons
560 * return 1 to remove an item
562 #define EV_Item_Spawn(i, o) \
563 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
565 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
567 #define EV_SetWeaponreplace(i, o) \
568 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
569 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
570 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
571 /**/ o(string, MUTATOR_ARGV_2_string) \
573 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
575 /** called when an item is about to respawn */
576 #define EV_Item_RespawnCountdown(i, o) \
577 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
579 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
581 /** called when a bot checks a target to attack */
582 #define EV_BotShouldAttack(i, o) \
583 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
584 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
586 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
589 * called whenever a player goes through a portal gun teleport
590 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
592 #define EV_PortalTeleport(i, o) \
593 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
595 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
598 * called whenever a player uses impulse 33 (help me) in impulse.qc
599 * normally help me ping uses .waypointsprite_attachedforcarrier,
600 * but if your mutator uses something different then you can handle it
601 * in a special manner using this hook
603 #define EV_HelpMePing(i, o) \
604 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
606 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
609 * called when a vehicle initializes
610 * return true to remove the vehicle
612 #define EV_VehicleInit(i, o) \
613 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
615 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
618 * called when a player enters a vehicle
619 * allows mutators to set special settings in this event
621 #define EV_VehicleEnter(i, o) \
622 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
623 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
625 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
628 * called when a player touches a vehicle
629 * return true to stop player from entering the vehicle
631 #define EV_VehicleTouch(i, o) \
632 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
633 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
635 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
638 * called when a player exits a vehicle
639 * allows mutators to set special settings in this event
641 #define EV_VehicleExit(i, o) \
642 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
643 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
645 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
647 /** called when a speedrun is aborted and the player is teleported back to start position */
648 #define EV_AbortSpeedrun(i, o) \
649 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
651 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
653 /** called at when a item is touched. Called early, can edit item properties. */
654 #define EV_ItemTouch(i, o) \
655 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
656 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
657 /**/ o(entity, MUTATOR_ARGV_1_entity) \
659 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
662 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
663 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
664 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
667 /** called after the item has been touched. */
668 #define EV_ItemTouched(i, o) \
669 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
670 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
672 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
674 /** Called when the amount of entity resources changes. Can be used to override
676 #define EV_GetResourceLimit(i, o) \
677 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
678 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
679 /** limit */ i(float, MUTATOR_ARGV_2_float) \
680 /**/ o(float, MUTATOR_ARGV_2_float) \
682 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
684 /** Called when the amount of resource of an entity changes. See RESOURCE_*
685 constants for resource types. Return true to forbid the change. */
686 #define EV_SetResourceAmount(i, o) \
687 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
688 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
689 /**/ o(int, MUTATOR_ARGV_1_int) \
690 /** amount */ i(float, MUTATOR_ARGV_2_float) \
691 /**/ o(float, MUTATOR_ARGV_2_float) \
693 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
695 /** Called after the amount of resource of an entity has changed. See RESOURCE_*
696 constants for resource types. Amount wasted is the amount of resource that is
697 above resource limit so it was not given. */
698 #define EV_ResourceAmountChanged(i, o) \
699 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
700 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
701 /** amount */ i(float, MUTATOR_ARGV_2_float) \
703 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
705 /** Called when there was an attempt to set entity resources higher than their
706 limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
707 of resource that is above resource limit so it was not given. */
708 #define EV_ResourceWasted(i, o) \
709 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
710 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
711 /** amount wasted */ i(float, MUTATOR_ARGV_2_float) \
713 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
715 /** Called when entity is being given some resource. See RESOURCE_* constants
716 for resource types. Return true to forbid giving. */
717 #define EV_GiveResource(i, o) \
718 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
719 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
720 /**/ o(int, MUTATOR_ARGV_1_int) \
721 /** amount */ i(float, MUTATOR_ARGV_2_float) \
722 /**/ o(float, MUTATOR_ARGV_2_float) \
724 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
726 /** Called when entity is being given some resource with specified limit. See
727 RESOURCE_* constants for resource types. Return true to forbid giving. */
728 #define EV_GiveResourceWithLimit(i, o) \
729 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
730 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
731 /**/ o(int, MUTATOR_ARGV_1_int) \
732 /** amount */ i(float, MUTATOR_ARGV_2_float) \
733 /**/ o(float, MUTATOR_ARGV_2_float) \
734 /** limit */ i(float, MUTATOR_ARGV_3_float) \
735 /**/ o(float, MUTATOR_ARGV_3_float) \
737 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
739 /** called at when a player connect */
740 #define EV_ClientConnect(i, o) \
741 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
743 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
745 #define EV_HavocBot_ChooseRole(i, o) \
746 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
748 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
750 /** called when a target is checked for accuracy */
751 #define EV_AccuracyTargetValid(i, o) \
752 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
753 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
755 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
757 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
758 MUT_ACCADD_INVALID, // return this flag to make the function always continue
759 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
762 /** Called when clearing the global parameters for a model */
763 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
765 /** Called when getting the global parameters for a model */
766 #define EV_GetModelParams(i, o) \
767 /** input */ i(string, MUTATOR_ARGV_0_string) \
768 /** command */ i(string, MUTATOR_ARGV_1_string) \
770 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
772 /** called when a bullet has hit a target */
773 #define EV_FireBullet_Hit(i, o) \
774 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
775 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
776 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
777 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
778 /** damage */ i(float, MUTATOR_ARGV_4_float) \
779 /**/ o(float, MUTATOR_ARGV_4_float) \
780 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
782 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
784 #define EV_FixPlayermodel(i, o) \
785 /** model */ i(string, MUTATOR_ARGV_0_string) \
786 /**/ o(string, MUTATOR_ARGV_0_string) \
787 /** skin */ i(int, MUTATOR_ARGV_1_int) \
788 /**/ o(int, MUTATOR_ARGV_1_int) \
789 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
791 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
793 /** Return error to play frag remaining announcements */
794 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
796 #define EV_GrappleHookThink(i, o) \
797 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
798 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
799 /**/ o(int, MUTATOR_ARGV_1_int) \
800 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
801 /**/ o(entity, MUTATOR_ARGV_2_entity) \
802 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
803 /**/ o(float, MUTATOR_ARGV_3_float) \
805 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
807 #define EV_BuffModel_Customize(i, o) \
808 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
809 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
811 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
813 /** called at when a buff is touched. Called early, can edit buff properties. */
814 #define EV_BuffTouch(i, o) \
815 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
816 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
817 /**/ o(entity, MUTATOR_ARGV_1_entity) \
819 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
821 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
823 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
825 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
827 #define EV_GetRecords(i, o) \
828 /** page */ i(int, MUTATOR_ARGV_0_int) \
829 /** record list */ i(string, MUTATOR_ARGV_1_string) \
830 /**/ o(string, MUTATOR_ARGV_1_string) \
832 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
834 #define EV_Race_FinalCheckpoint(i, o) \
835 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
837 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
839 /** called when player triggered kill (or is changing teams), return error to not do anything */
840 #define EV_ClientKill(i, o) \
841 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
842 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
843 /**/ o(float, MUTATOR_ARGV_1_float) \
845 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
847 /** called when player is about to be killed during kill command or changing teams */
848 #define EV_ClientKill_Now(i, o) \
849 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
851 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
853 #define EV_FixClientCvars(i, o) \
854 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
856 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
858 #define EV_SpectateSet(i, o) \
859 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
860 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
861 /**/ o(entity, MUTATOR_ARGV_1_entity) \
863 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
865 #define EV_SpectateNext(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) \
870 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
872 #define EV_SpectatePrev(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 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
878 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
881 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
882 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
883 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
886 /** called when player triggered kill (or is changing teams), return error to not do anything */
887 #define EV_Bot_FixCount(i, o) \
888 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
889 /**/ o(int, MUTATOR_ARGV_0_int) \
890 /** real players */ i(int, MUTATOR_ARGV_1_int) \
891 /**/ o(int, MUTATOR_ARGV_1_int) \
893 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
895 #define EV_ClientCommand_Spectate(i, o) \
896 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
898 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
901 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
902 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
903 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
906 #define EV_CheckRules_World(i, o) \
907 /** status */ i(float, MUTATOR_ARGV_0_float) \
908 /**/ o(float, MUTATOR_ARGV_0_float) \
909 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
910 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
912 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
914 #define EV_WantWeapon(i, o) \
915 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
916 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
917 /**/ o(float, MUTATOR_ARGV_1_float) \
918 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
919 /**/ o(bool, MUTATOR_ARGV_2_bool) \
920 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
921 /**/ o(bool, MUTATOR_ARGV_3_bool) \
923 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
925 #define EV_AddPlayerScore(i, o) \
926 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
927 /** score */ i(float, MUTATOR_ARGV_1_float) \
928 /**/ o(float, MUTATOR_ARGV_1_float) \
929 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
931 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
933 #define EV_AddedPlayerScore(i, o) \
934 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
935 /** score */ i(float, MUTATOR_ARGV_1_float) \
936 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
938 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
940 #define EV_GetPlayerStatus(i, o) \
941 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
943 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
945 #define EV_SetWeaponArena(i, o) \
946 /** arena */ i(string, MUTATOR_ARGV_0_string) \
947 /**/ o(string, MUTATOR_ARGV_0_string) \
949 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
951 #define EV_DropSpecialItems(i, o) \
952 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
954 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
957 * called when an admin tries to kill all monsters
958 * return 1 to prevent spawning
960 #define EV_AllowMobButcher(i, o) \
961 /** reason */ o(string, MUTATOR_ARGV_0_string) \
963 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
965 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
967 #define EV_SendWaypoint(i, o) \
968 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
969 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
970 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
971 /**/ o(int, MUTATOR_ARGV_2_int) \
972 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
973 /**/ o(int, MUTATOR_ARGV_3_int) \
975 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
977 #define EV_TurretValidateTarget(i, o) \
978 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
979 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
980 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
981 /** target score */ o(float, MUTATOR_ARGV_3_float) \
983 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
985 #define EV_TurretThink(i, o) \
986 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
988 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
990 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
993 #define EV_PrepareExplosionByDamage(i, o) \
994 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
995 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
997 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
999 /** called when a monster model is about to be set, allows custom paths etc. */
1000 #define EV_MonsterModel(i, o) \
1001 /** model */ i(string, MUTATOR_ARGV_0_string) \
1002 /** output */ i(string, MUTATOR_ARGV_1_string) \
1003 /**/ o(string, MUTATOR_ARGV_1_string) \
1005 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1008 * Called before player changes their team. Return true to block team change.
1010 #define EV_Player_ChangeTeam(i, o) \
1011 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1012 /** current team */ i(float, MUTATOR_ARGV_1_float) \
1013 /** new team */ i(float, MUTATOR_ARGV_2_float) \
1015 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1018 * Called after player has changed their team.
1020 #define EV_Player_ChangedTeam(i, o) \
1021 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1022 /** old team */ i(float, MUTATOR_ARGV_1_float) \
1023 /** current team */ i(float, MUTATOR_ARGV_2_float) \
1025 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1028 * Called when player is about to be killed when changing teams. Return true to block killing.
1030 #define EV_Player_ChangeTeamKill(i, o) \
1031 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1033 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1036 #define EV_URI_GetCallback(i, o) \
1037 /** id */ i(float, MUTATOR_ARGV_0_float) \
1038 /** status */ i(float, MUTATOR_ARGV_1_float) \
1039 /** data */ i(string, MUTATOR_ARGV_2_string) \
1041 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1044 * return true to prevent weapon use for a player
1046 #define EV_ForbidWeaponUse(i, o) \
1047 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1049 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1051 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1052 #define EV_CopyBody(i, o) \
1053 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1054 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1055 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1057 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1059 /** called when sending a chat message, ret argument can be changed to prevent the message */
1060 #define EV_ChatMessage(i, o) \
1061 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1062 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1063 /**/ o(int, MUTATOR_ARGV_1_int) \
1065 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1067 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1068 #define EV_ChatMessageTo(i, o) \
1069 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1070 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1072 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1074 /** return true to just restart the match, for modes that don't support readyrestart */
1075 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1077 /** called when a fusion reactor is validating its target */
1078 #define EV_FusionReactor_ValidTarget(i, o) \
1079 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1080 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1082 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1085 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1086 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1087 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1090 /** return true to hide the 'teamnumbers are imbalanced' message */
1091 #define EV_HideTeamNagger(i, o) \
1092 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1094 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1096 /** return true to show a waypoint while the item is spawning */
1097 #define EV_Item_ScheduleRespawn(i, o) \
1098 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1099 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1101 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1103 /** called before physics stats are set on a player, allows limited early customization */
1104 #define EV_PlayerPhysics_UpdateStats(i, o) \
1105 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1107 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1109 /** called after physics stats are set on a player, allows post-initialization modifications */
1110 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1111 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1112 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1114 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1116 /** return true to use your own aim target (or none at all) */
1117 #define EV_HavocBot_Aim(i, o) \
1118 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1120 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1122 /** return true to skip respawn time calculations */
1123 #define EV_CalculateRespawnTime(i, o) \
1124 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1126 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1128 /** called when parsing a vote command. */
1129 #define EV_VoteCommand_Parse(i, o) \
1130 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1131 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1132 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1133 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1134 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1136 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1139 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1140 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1141 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1142 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)