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. Return true to use the bitmask value and set
135 * non-empty string to use team entity name. Both behaviors can be active at the
136 * same time and will stack allowed teams.
138 #define EV_TeamBalance_CheckAllowedTeams(i, o) \
139 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
140 /**/ o(float, MUTATOR_ARGV_0_float) \
141 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
142 /**/ o(string, MUTATOR_ARGV_1_string) \
143 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
145 MUTATOR_HOOKABLE(TeamBalance_CheckAllowedTeams,
146 EV_TeamBalance_CheckAllowedTeams);
148 /** return true to manually override team counts */
149 MUTATOR_HOOKABLE(TeamBalance_GetTeamCounts, EV_NO_ARGS);
151 /** allows overriding of team counts */
152 #define EV_TeamBalance_GetTeamCount(i, o) \
153 /** team index 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 */ o(float, MUTATOR_ARGV_2_float) \
156 /** number of bots in a team */ o(float, MUTATOR_ARGV_3_float) \
158 MUTATOR_HOOKABLE(TeamBalance_GetTeamCount, EV_TeamBalance_GetTeamCount);
160 /** allows overriding the teams that will make the game most balanced if the
161 * player joins any of them.
163 #define EV_TeamBalance_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(TeamBalance_FindBestTeams, EV_TeamBalance_FindBestTeams);
169 /** Called during autobalance. Return true to override the player that will be
171 #define EV_TeamBalance_GetPlayerForTeamSwitch(i, o) \
172 /** source team index */ i(int, MUTATOR_ARGV_0_int) \
173 /** destination team index */ i(int, MUTATOR_ARGV_1_int) \
174 /** is looking for bot */ i(bool, MUTATOR_ARGV_2_bool) \
175 /** player to switch */ o(entity, MUTATOR_ARGV_3_entity) \
177 MUTATOR_HOOKABLE(TeamBalance_GetPlayerForTeamSwitch,
178 EV_TeamBalance_GetPlayerForTeamSwitch);
180 /** copies variables for spectating "spectatee" to "this" */
181 #define EV_SpectateCopy(i, o) \
182 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
183 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
185 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
187 /** called when formatting a chat message to replace fancy functions */
188 #define EV_FormatMessage(i, o) \
189 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
190 /** escape */ i(string, MUTATOR_ARGV_1_string) \
191 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
192 /**/ o(string, MUTATOR_ARGV_2_string) \
193 /** message */ i(string, MUTATOR_ARGV_3_string) \
195 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
197 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
198 #define EV_PreFormatMessage(i, o) \
199 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
200 /** message */ i(string, MUTATOR_ARGV_1_string) \
201 /**/ o(string, MUTATOR_ARGV_1_string) \
203 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
205 /** returns true if throwing the current weapon shall not be allowed */
206 #define EV_ForbidThrowCurrentWeapon(i, o) \
207 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
208 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
210 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
212 /** returns true if dropping the current weapon shall not be allowed at any time including death */
213 #define EV_ForbidDropCurrentWeapon(i, o) \
214 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
215 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
217 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
220 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
222 /** allows changing attack rate */
223 #define EV_WeaponRateFactor(i, o) \
224 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
225 /**/ o(float, MUTATOR_ARGV_0_float) \
226 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
228 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
230 /** allows changing weapon speed (projectiles mostly) */
231 #define EV_WeaponSpeedFactor(i, o) \
232 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
233 /**/ o(float, MUTATOR_ARGV_0_float) \
234 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
236 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
238 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
239 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
241 /** called every frame. customizes the waypoint for spectators */
242 #define EV_CustomizeWaypoint(i, o) \
243 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
244 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
246 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
248 /** Check if items having the given definition are allowed to spawn.
249 * Return true to disallow spawning.
251 #define EV_FilterItemDefinition(i, o) \
252 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
254 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
257 * checks if the current item may be spawned (.items may be read and written to, as well as the ammo_ fields)
258 * return error to request removal
260 #define EV_FilterItem(i, o) \
261 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
263 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
265 /** return error to request removal */
266 #define EV_TurretSpawn(i, o) \
267 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
269 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
271 /** return error to not attack */
272 #define EV_TurretFire(i, o) \
273 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
275 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
277 /** return error to not attack */
278 #define EV_Turret_CheckFire(i, o) \
279 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
280 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
282 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
284 /** return error to prevent entity spawn, or modify the entity */
285 #define EV_OnEntityPreSpawn(i, o) \
286 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
288 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
290 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
291 #define EV_PlayerPreThink(i, o) \
292 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
294 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
296 /** TODO change this into a general PlayerPostThink hook? */
297 #define EV_GetPressedKeys(i, o) \
298 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
300 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
302 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
303 #define EV_GetCvars(i, o) \
304 /**/ i(float, get_cvars_f) \
305 /**/ i(string, get_cvars_s) \
309 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
311 /** can edit any "just fired" projectile */
312 #define EV_EditProjectile(i, o) \
313 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
314 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
316 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
318 /** called when a monster spawns */
319 #define EV_MonsterSpawn(i, o) \
320 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
322 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
324 /** called when a monster dies */
325 #define EV_MonsterDies(i, o) \
326 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
327 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
328 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
330 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
332 /** called when a monster dies */
333 #define EV_MonsterRemove(i, o) \
334 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
336 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
338 /** called when a monster wants to respawn */
339 #define EV_MonsterRespawn(i, o) \
340 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
342 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
344 /** called when a monster is dropping loot */
345 #define EV_MonsterDropItem(i, o) \
346 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
347 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
348 /**/ o(entity, MUTATOR_ARGV_1_entity) \
349 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
351 .entity monster_loot;
352 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
355 * called when a monster moves
356 * returning true makes the monster stop
358 #define EV_MonsterMove(i, o) \
359 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
360 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
361 /**/ o(float, MUTATOR_ARGV_1_float) \
362 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
363 /**/ o(float, MUTATOR_ARGV_2_float) \
364 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
365 /**/ o(entity, MUTATOR_ARGV_3_entity) \
367 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
369 /** called when a monster looks for another target */
370 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
373 * called when validating a monster's target
375 #define EV_MonsterValidTarget(i, o) \
376 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
377 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
379 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
381 /** called to change a random monster to a miniboss */
382 #define EV_MonsterCheckBossFlag(i, o) \
383 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
385 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
388 * called when a player tries to spawn a monster
389 * return 1 to prevent spawning
390 * NOTE: requires reason if disallowed
392 #define EV_AllowMobSpawning(i, o) \
393 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
394 /** reason */ o(string, MUTATOR_ARGV_1_string) \
396 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
398 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
399 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
400 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
401 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
402 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
403 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
404 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
405 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
406 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
407 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
408 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
409 /** damage */ i(float, MUTATOR_ARGV_7_float) \
411 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
414 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
415 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
417 #define EV_Damage_Calculate(i, o) \
418 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
419 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
420 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
421 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
422 /** damage */ i(float, MUTATOR_ARGV_4_float) \
423 /** damage */ o(float, MUTATOR_ARGV_4_float) \
424 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
425 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
426 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
427 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
428 /** weapon entity */ i(entity, MUTATOR_ARGV_7_entity) \
430 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
433 * Called when a player is damaged
435 #define EV_PlayerDamaged(i, o) \
436 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
437 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
438 /** health */ i(float, MUTATOR_ARGV_2_float) \
439 /** armor */ i(float, MUTATOR_ARGV_3_float) \
440 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
441 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
442 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
444 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
447 * Called by W_DecreaseAmmo
449 #define EV_W_DecreaseAmmo(i, o) \
450 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
451 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
452 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
453 /**/ o(float, MUTATOR_ARGV_2_float) \
455 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
460 #define EV_W_Reload(i, o) \
461 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
463 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
465 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
466 #define EV_PlayerPowerups(i, o) \
467 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
468 /** old items */ i(int, MUTATOR_ARGV_1_int) \
470 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
473 * called every player think frame
474 * return 1 to disable regen
476 #define EV_PlayerRegen(i, o) \
477 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
478 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
479 /**/ o(float, MUTATOR_ARGV_1_float) \
480 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
481 /**/ o(float, MUTATOR_ARGV_2_float) \
482 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
483 /**/ o(float, MUTATOR_ARGV_3_float) \
484 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
485 /**/ o(float, MUTATOR_ARGV_4_float) \
486 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
487 /**/ o(float, MUTATOR_ARGV_5_float) \
488 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
489 /**/ o(float, MUTATOR_ARGV_6_float) \
490 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
491 /**/ o(float, MUTATOR_ARGV_7_float) \
492 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
493 /**/ o(float, MUTATOR_ARGV_8_float) \
494 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
495 /**/ o(float, MUTATOR_ARGV_9_float) \
496 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
497 /**/ o(float, MUTATOR_ARGV_10_float) \
499 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
502 * called when the use key is pressed
503 * if MUTATOR_RETURNVALUE is 1, don't do anything
504 * return 1 if the use key actually did something
506 #define EV_PlayerUseKey(i, o) \
507 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
509 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
512 * called when a client command is parsed
513 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
514 * NOTE: return true if you handled the command, return false to continue handling
515 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
517 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
519 * if (MUTATOR_RETURNVALUE) // command was already handled?
521 * if (cmd_name == "echocvar" && cmd_argc >= 2)
523 * print(cvar_string(argv(1)), "\n");
526 * if (cmd_name == "echostring" && cmd_argc >= 2)
528 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
534 #define EV_SV_ParseClientCommand(i, o) \
535 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
536 /** command name */ i(string, MUTATOR_ARGV_1_string) \
537 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
538 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
540 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
542 /** please read EV_SV_ParseClientCommand description before using */
543 #define EV_SV_ParseServerCommand(i, o) \
544 /** command name */ i(string, MUTATOR_ARGV_0_string) \
545 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
546 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
548 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
551 * called when a spawnpoint is being evaluated
552 * return 1 to make the spawnpoint unusable
554 #define EV_Spawn_Score(i, o) \
555 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
556 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
557 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
558 /**/ o(vector, MUTATOR_ARGV_2_vector) \
560 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
562 /** runs globally each server frame */
563 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
565 #define EV_SetModname(i, o) \
566 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
567 /**/ i(string, MUTATOR_ARGV_0_string) \
568 /**/ o(string, MUTATOR_ARGV_0_string) \
570 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
573 * called for each item being spawned on a map, including dropped weapons
574 * return 1 to remove an item
576 #define EV_Item_Spawn(i, o) \
577 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
579 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
581 #define EV_SetWeaponreplace(i, o) \
582 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
583 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
584 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
585 /**/ o(string, MUTATOR_ARGV_2_string) \
587 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
589 /** called when an item is about to respawn */
590 #define EV_Item_RespawnCountdown(i, o) \
591 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
593 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
595 /** called when a bot checks a target to attack */
596 #define EV_BotShouldAttack(i, o) \
597 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
598 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
600 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
603 * called whenever a player goes through a portal gun teleport
604 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
606 #define EV_PortalTeleport(i, o) \
607 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
609 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
612 * called whenever a player uses impulse 33 (help me) in impulse.qc
613 * normally help me ping uses .waypointsprite_attachedforcarrier,
614 * but if your mutator uses something different then you can handle it
615 * in a special manner using this hook
617 #define EV_HelpMePing(i, o) \
618 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
620 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
623 * called when a vehicle initializes
624 * return true to remove the vehicle
626 #define EV_VehicleInit(i, o) \
627 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
629 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
632 * called when a player enters a vehicle
633 * allows mutators to set special settings in this event
635 #define EV_VehicleEnter(i, o) \
636 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
637 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
639 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
642 * called when a player touches a vehicle
643 * return true to stop player from entering the vehicle
645 #define EV_VehicleTouch(i, o) \
646 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
647 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
649 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
652 * called when a player exits a vehicle
653 * allows mutators to set special settings in this event
655 #define EV_VehicleExit(i, o) \
656 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
657 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
659 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
661 /** called when a speedrun is aborted and the player is teleported back to start position */
662 #define EV_AbortSpeedrun(i, o) \
663 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
665 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
667 /** called at when a item is touched. Called early, can edit item properties. */
668 #define EV_ItemTouch(i, o) \
669 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
670 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
671 /**/ o(entity, MUTATOR_ARGV_1_entity) \
673 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
676 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
677 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
678 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
681 /** called after the item has been touched. */
682 #define EV_ItemTouched(i, o) \
683 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
684 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
686 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
688 /** Called when the amount of entity resources changes. Can be used to override
690 #define EV_GetResourceLimit(i, o) \
691 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
692 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
693 /** limit */ i(float, MUTATOR_ARGV_2_float) \
694 /**/ o(float, MUTATOR_ARGV_2_float) \
696 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
698 /** Called when the amount of resource of an entity changes. See RESOURCE_*
699 constants for resource types. Return true to forbid the change. */
700 #define EV_SetResourceAmount(i, o) \
701 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
702 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
703 /**/ o(int, MUTATOR_ARGV_1_int) \
704 /** amount */ i(float, MUTATOR_ARGV_2_float) \
705 /**/ o(float, MUTATOR_ARGV_2_float) \
707 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
709 /** Called after the amount of resource of an entity has changed. See RESOURCE_*
710 constants for resource types. Amount wasted is the amount of resource that is
711 above resource limit so it was not given. */
712 #define EV_ResourceAmountChanged(i, o) \
713 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
714 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
715 /** amount */ i(float, MUTATOR_ARGV_2_float) \
717 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
719 /** Called when there was an attempt to set entity resources higher than their
720 limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
721 of resource that is above resource limit so it was not given. */
722 #define EV_ResourceWasted(i, o) \
723 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
724 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
725 /** amount wasted */ i(float, MUTATOR_ARGV_2_float) \
727 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
729 /** Called when entity is being given some resource. See RESOURCE_* constants
730 for resource types. Return true to forbid giving. */
731 #define EV_GiveResource(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) \
738 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
740 /** Called when entity is being given some resource with specified limit. See
741 RESOURCE_* constants for resource types. Return true to forbid giving. */
742 #define EV_GiveResourceWithLimit(i, o) \
743 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
744 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
745 /**/ o(int, MUTATOR_ARGV_1_int) \
746 /** amount */ i(float, MUTATOR_ARGV_2_float) \
747 /**/ o(float, MUTATOR_ARGV_2_float) \
748 /** limit */ i(float, MUTATOR_ARGV_3_float) \
749 /**/ o(float, MUTATOR_ARGV_3_float) \
751 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
753 /** called at when a player connect */
754 #define EV_ClientConnect(i, o) \
755 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
757 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
759 #define EV_HavocBot_ChooseRole(i, o) \
760 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
762 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
764 /** called when a target is checked for accuracy */
765 #define EV_AccuracyTargetValid(i, o) \
766 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
767 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
769 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
771 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
772 MUT_ACCADD_INVALID, // return this flag to make the function always continue
773 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
776 /** Called when clearing the global parameters for a model */
777 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
779 /** Called when getting the global parameters for a model */
780 #define EV_GetModelParams(i, o) \
781 /** input */ i(string, MUTATOR_ARGV_0_string) \
782 /** command */ i(string, MUTATOR_ARGV_1_string) \
784 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
786 /** called when a bullet has hit a target */
787 #define EV_FireBullet_Hit(i, o) \
788 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
789 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
790 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
791 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
792 /** damage */ i(float, MUTATOR_ARGV_4_float) \
793 /**/ o(float, MUTATOR_ARGV_4_float) \
794 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
796 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
798 #define EV_FixPlayermodel(i, o) \
799 /** model */ i(string, MUTATOR_ARGV_0_string) \
800 /**/ o(string, MUTATOR_ARGV_0_string) \
801 /** skin */ i(int, MUTATOR_ARGV_1_int) \
802 /**/ o(int, MUTATOR_ARGV_1_int) \
803 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
805 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
807 /** Return error to play frag remaining announcements */
808 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
810 #define EV_GrappleHookThink(i, o) \
811 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
812 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
813 /**/ o(int, MUTATOR_ARGV_1_int) \
814 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
815 /**/ o(entity, MUTATOR_ARGV_2_entity) \
816 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
817 /**/ o(float, MUTATOR_ARGV_3_float) \
819 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
821 #define EV_BuffModel_Customize(i, o) \
822 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
823 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
825 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
827 /** called at when a buff is touched. Called early, can edit buff properties. */
828 #define EV_BuffTouch(i, o) \
829 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
830 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
831 /**/ o(entity, MUTATOR_ARGV_1_entity) \
833 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
835 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
837 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
839 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
841 #define EV_GetRecords(i, o) \
842 /** page */ i(int, MUTATOR_ARGV_0_int) \
843 /** record list */ i(string, MUTATOR_ARGV_1_string) \
844 /**/ o(string, MUTATOR_ARGV_1_string) \
846 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
848 #define EV_Race_FinalCheckpoint(i, o) \
849 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
851 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
853 /** called when player triggered kill (or is changing teams), return error to not do anything */
854 #define EV_ClientKill(i, o) \
855 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
856 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
857 /**/ o(float, MUTATOR_ARGV_1_float) \
859 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
861 /** called when player is about to be killed during kill command or changing teams */
862 #define EV_ClientKill_Now(i, o) \
863 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
865 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
867 #define EV_FixClientCvars(i, o) \
868 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
870 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
872 #define EV_SpectateSet(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) \
877 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
879 #define EV_SpectateNext(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) \
884 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
886 #define EV_SpectatePrev(i, o) \
887 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
888 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
889 /**/ o(entity, MUTATOR_ARGV_1_entity) \
890 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
892 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
895 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
896 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
897 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
900 /** called when player triggered kill (or is changing teams), return error to not do anything */
901 #define EV_Bot_FixCount(i, o) \
902 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
903 /**/ o(int, MUTATOR_ARGV_0_int) \
904 /** real players */ i(int, MUTATOR_ARGV_1_int) \
905 /**/ o(int, MUTATOR_ARGV_1_int) \
907 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
909 #define EV_ClientCommand_Spectate(i, o) \
910 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
912 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
915 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
916 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
917 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
920 #define EV_CheckRules_World(i, o) \
921 /** status */ i(float, MUTATOR_ARGV_0_float) \
922 /**/ o(float, MUTATOR_ARGV_0_float) \
923 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
924 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
926 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
928 #define EV_WantWeapon(i, o) \
929 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
930 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
931 /**/ o(float, MUTATOR_ARGV_1_float) \
932 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
933 /**/ o(bool, MUTATOR_ARGV_2_bool) \
934 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
935 /**/ o(bool, MUTATOR_ARGV_3_bool) \
937 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
939 #define EV_AddPlayerScore(i, o) \
940 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
941 /** score */ i(float, MUTATOR_ARGV_1_float) \
942 /**/ o(float, MUTATOR_ARGV_1_float) \
943 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
945 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
947 #define EV_AddedPlayerScore(i, o) \
948 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
949 /** score */ i(float, MUTATOR_ARGV_1_float) \
950 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
952 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
954 #define EV_GetPlayerStatus(i, o) \
955 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
957 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
959 #define EV_SetWeaponArena(i, o) \
960 /** arena */ i(string, MUTATOR_ARGV_0_string) \
961 /**/ o(string, MUTATOR_ARGV_0_string) \
963 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
965 #define EV_DropSpecialItems(i, o) \
966 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
968 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
971 * called when an admin tries to kill all monsters
972 * return 1 to prevent spawning
974 #define EV_AllowMobButcher(i, o) \
975 /** reason */ o(string, MUTATOR_ARGV_0_string) \
977 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
979 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
981 #define EV_SendWaypoint(i, o) \
982 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
983 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
984 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
985 /**/ o(int, MUTATOR_ARGV_2_int) \
986 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
987 /**/ o(int, MUTATOR_ARGV_3_int) \
989 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
991 #define EV_TurretValidateTarget(i, o) \
992 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
993 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
994 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
995 /** target score */ o(float, MUTATOR_ARGV_3_float) \
997 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
999 #define EV_TurretThink(i, o) \
1000 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1002 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
1004 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
1007 #define EV_PrepareExplosionByDamage(i, o) \
1008 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
1009 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1011 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1013 /** called when a monster model is about to be set, allows custom paths etc. */
1014 #define EV_MonsterModel(i, o) \
1015 /** model */ i(string, MUTATOR_ARGV_0_string) \
1016 /** output */ i(string, MUTATOR_ARGV_1_string) \
1017 /**/ o(string, MUTATOR_ARGV_1_string) \
1019 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1022 * Called before player changes their team. Return true to block team change.
1024 #define EV_Player_ChangeTeam(i, o) \
1025 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1026 /** current team index */ i(float, MUTATOR_ARGV_1_float) \
1027 /** new team index */ i(float, MUTATOR_ARGV_2_float) \
1029 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1032 * Called after player has changed their team.
1034 #define EV_Player_ChangedTeam(i, o) \
1035 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1036 /** old team index */ i(float, MUTATOR_ARGV_1_float) \
1037 /** current team index */ i(float, MUTATOR_ARGV_2_float) \
1039 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1042 * Called when player is about to be killed when changing teams. Return true to block killing.
1044 #define EV_Player_ChangeTeamKill(i, o) \
1045 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1047 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1050 #define EV_URI_GetCallback(i, o) \
1051 /** id */ i(float, MUTATOR_ARGV_0_float) \
1052 /** status */ i(float, MUTATOR_ARGV_1_float) \
1053 /** data */ i(string, MUTATOR_ARGV_2_string) \
1055 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1058 * return true to prevent weapon use for a player
1060 #define EV_ForbidWeaponUse(i, o) \
1061 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1063 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1065 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1066 #define EV_CopyBody(i, o) \
1067 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1068 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1069 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1071 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1073 /** called when sending a chat message, ret argument can be changed to prevent the message */
1074 #define EV_ChatMessage(i, o) \
1075 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1076 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1077 /**/ o(int, MUTATOR_ARGV_1_int) \
1079 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1081 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1082 #define EV_ChatMessageTo(i, o) \
1083 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1084 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1086 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1088 /** return true to just restart the match, for modes that don't support readyrestart */
1089 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1091 /** called when a fusion reactor is validating its target */
1092 #define EV_FusionReactor_ValidTarget(i, o) \
1093 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1094 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1096 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1099 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1100 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1101 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1104 /** return true to hide the 'teamnumbers are imbalanced' message */
1105 #define EV_HideTeamNagger(i, o) \
1106 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1108 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1110 /** return true to show a waypoint while the item is spawning */
1111 #define EV_Item_ScheduleRespawn(i, o) \
1112 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1113 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1115 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1117 /** called before physics stats are set on a player, allows limited early customization */
1118 #define EV_PlayerPhysics_UpdateStats(i, o) \
1119 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1121 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1123 /** called after physics stats are set on a player, allows post-initialization modifications */
1124 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1125 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1126 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1128 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1130 /** return true to use your own aim target (or none at all) */
1131 #define EV_HavocBot_Aim(i, o) \
1132 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1134 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1136 /** return true to skip respawn time calculations */
1137 #define EV_CalculateRespawnTime(i, o) \
1138 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1140 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1142 /** called when parsing a vote command. */
1143 #define EV_VoteCommand_Parse(i, o) \
1144 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1145 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1146 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1147 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1148 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1150 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1153 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1154 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1155 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1156 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)