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) \
13 /** is_forced */ i(bool, MUTATOR_ARGV_1_bool) \
15 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
18 #define EV_PutClientInServer(i, o) \
19 /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
21 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
24 * return true to prevent a spectator/observer to spawn as player
26 #define EV_ForbidSpawn(i, o) \
27 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
29 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
31 /** returns true if client should be put as player on connection */
32 #define EV_AutoJoinOnConnection(i, o) \
33 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
35 MUTATOR_HOOKABLE(AutoJoinOnConnection, EV_AutoJoinOnConnection);
37 /** called when player spawns to determine whether to give them random start weapons. Return true to forbid giving them. */
38 #define EV_ForbidRandomStartWeapons(i, o) \
39 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
41 MUTATOR_HOOKABLE(ForbidRandomStartWeapons, EV_ForbidRandomStartWeapons);
43 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
44 #define EV_PlayerSpawn(i, o) \
45 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
46 /** spot that was used, or NULL */ i(entity, MUTATOR_ARGV_1_entity) \
48 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
50 /** called after a player's weapon is chosen so it can be overriden here */
51 #define EV_PlayerWeaponSelect(i, o) \
52 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
54 MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
56 /** called in reset_map */
57 #define EV_reset_map_global(i, o) \
59 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
61 /** called in reset_map */
62 #define EV_reset_map_players(i, o) \
64 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
66 /** returns 1 if clearing player score shall not be allowed */
67 #define EV_ForbidPlayerScore_Clear(i, o) \
69 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
71 /** called when a player disconnects */
72 #define EV_ClientDisconnect(i, o) \
73 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
75 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
77 /** called when a player dies to e.g. remove stuff he was carrying. */
78 #define EV_PlayerDies(i, o) \
79 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
80 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
81 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
82 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
83 /** damage */ i(float, MUTATOR_ARGV_4_float) \
84 /** damage */ o(float, MUTATOR_ARGV_4_float) \
86 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
88 /** called after a player died. */
89 #define EV_PlayerDied(i, o) \
90 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
92 MUTATOR_HOOKABLE(PlayerDied, EV_PlayerDied);
94 /** called when showing an obituary for the player. return true to show nothing (workarounds may be needed) */
95 #define EV_ClientObituary(i, o) \
96 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
97 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
98 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
99 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
100 /** wep entity */ i(entity, MUTATOR_ARGV_4_entity) \
101 /** anonymous killer*/ o(bool, MUTATOR_ARGV_5_bool) \
103 MUTATOR_HOOKABLE(ClientObituary, EV_ClientObituary);
105 /** allows overriding the frag centerprint messages */
106 #define EV_FragCenterMessage(i, o) \
107 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
108 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
109 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
110 /** attacker kcount*/ i(int, MUTATOR_ARGV_3_int) \
111 /** targ killcount */ i(int, MUTATOR_ARGV_4_int) \
113 MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage);
115 /** called when a player dies to e.g. remove stuff he was carrying */
116 #define EV_PlayHitsound(i, o) \
117 /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
118 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
120 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
122 /** called when an item model is about to be set, allows custom paths etc. */
123 #define EV_ItemModel(i, o) \
124 /** model */ i(string, MUTATOR_ARGV_0_string) \
125 /** output */ i(string, MUTATOR_ARGV_1_string) \
126 /**/ o(string, MUTATOR_ARGV_1_string) \
128 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
130 /** called when an item sound is about to be played, allows custom paths etc. */
131 #define EV_ItemSound(i, o) \
132 /** sound */ i(string, MUTATOR_ARGV_0_string) \
133 /** output */ i(string, MUTATOR_ARGV_1_string) \
134 /**/ o(string, MUTATOR_ARGV_1_string) \
136 MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
138 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
139 #define EV_GiveFragsForKill(i, o) \
140 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
141 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
142 /** frag score */ i(float, MUTATOR_ARGV_2_float) \
143 /** */ o(float, MUTATOR_ARGV_2_float) \
144 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
145 /** wep entity */ i(entity, MUTATOR_ARGV_4_entity) \
147 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
149 /** called when the match ends */
150 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
152 /** Allows adjusting allowed teams. Return true to use the bitmask value and set
153 * non-empty string to use team entity name. Both behaviors can be active at the
154 * same time and will stack allowed teams.
156 #define EV_TeamBalance_CheckAllowedTeams(i, o) \
157 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
158 /**/ o(float, MUTATOR_ARGV_0_float) \
159 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
160 /**/ o(string, MUTATOR_ARGV_1_string) \
161 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
163 MUTATOR_HOOKABLE(TeamBalance_CheckAllowedTeams,
164 EV_TeamBalance_CheckAllowedTeams);
166 /** return true to manually override team counts */
167 MUTATOR_HOOKABLE(TeamBalance_GetTeamCounts, EV_NO_ARGS);
169 /** allows overriding of team counts */
170 #define EV_TeamBalance_GetTeamCount(i, o) \
171 /** team index to count */ i(float, MUTATOR_ARGV_0_float) \
172 /** player to ignore */ i(entity, MUTATOR_ARGV_1_entity) \
173 /** number of players in a team */ o(float, MUTATOR_ARGV_2_float) \
174 /** number of bots in a team */ o(float, MUTATOR_ARGV_3_float) \
176 MUTATOR_HOOKABLE(TeamBalance_GetTeamCount, EV_TeamBalance_GetTeamCount);
178 /** allows overriding the teams that will make the game most balanced if the
179 * player joins any of them.
181 #define EV_TeamBalance_FindBestTeams(i, o) \
182 /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
183 /** bitmask of teams */ o(float, MUTATOR_ARGV_1_float) \
185 MUTATOR_HOOKABLE(TeamBalance_FindBestTeams, EV_TeamBalance_FindBestTeams);
187 /** Called during autobalance. Return true to override the player that will be
189 #define EV_TeamBalance_GetPlayerForTeamSwitch(i, o) \
190 /** source team index */ i(int, MUTATOR_ARGV_0_int) \
191 /** destination team index */ i(int, MUTATOR_ARGV_1_int) \
192 /** is looking for bot */ i(bool, MUTATOR_ARGV_2_bool) \
193 /** player to switch */ o(entity, MUTATOR_ARGV_3_entity) \
195 MUTATOR_HOOKABLE(TeamBalance_GetPlayerForTeamSwitch,
196 EV_TeamBalance_GetPlayerForTeamSwitch);
198 /** copies variables for spectating "spectatee" to "this" */
199 #define EV_SpectateCopy(i, o) \
200 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
201 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
203 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
205 /** called when formatting a chat message to replace fancy functions */
206 #define EV_FormatMessage(i, o) \
207 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
208 /** escape */ i(string, MUTATOR_ARGV_1_string) \
209 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
210 /**/ o(string, MUTATOR_ARGV_2_string) \
211 /** message */ i(string, MUTATOR_ARGV_3_string) \
213 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
215 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
216 #define EV_PreFormatMessage(i, o) \
217 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
218 /** message */ i(string, MUTATOR_ARGV_1_string) \
219 /**/ o(string, MUTATOR_ARGV_1_string) \
221 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
223 /** returns true if throwing the current weapon shall not be allowed */
224 #define EV_ForbidThrowCurrentWeapon(i, o) \
225 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
226 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
228 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
230 /** returns true if dropping the current weapon shall not be allowed at any time including death */
231 #define EV_ForbidDropCurrentWeapon(i, o) \
232 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
233 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
235 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
238 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
240 /** allows changing attack rate */
241 #define EV_WeaponRateFactor(i, o) \
242 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
243 /**/ o(float, MUTATOR_ARGV_0_float) \
244 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
246 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
248 /** allows changing weapon speed (projectiles mostly) */
249 #define EV_WeaponSpeedFactor(i, o) \
250 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
251 /**/ o(float, MUTATOR_ARGV_0_float) \
252 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
254 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
256 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
257 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
259 /** called every frame. customizes the waypoint for spectators */
260 #define EV_CustomizeWaypoint(i, o) \
261 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
262 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
264 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
266 /** Check if items having the given definition are allowed to spawn.
267 * Return true to disallow spawning.
269 #define EV_FilterItemDefinition(i, o) \
270 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
272 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
275 * checks if the current item may be spawned (.items may be read and written to, as well as the ammo_ fields)
276 * return error to request removal
278 #define EV_FilterItem(i, o) \
279 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
281 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
283 /** return error to request removal */
284 #define EV_TurretSpawn(i, o) \
285 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
287 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
289 /** return error to not attack */
290 #define EV_TurretFire(i, o) \
291 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
293 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
295 /** return error to not attack */
296 #define EV_Turret_CheckFire(i, o) \
297 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
298 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
300 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
302 /** return error to prevent entity spawn, or modify the entity */
303 #define EV_OnEntityPreSpawn(i, o) \
304 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
306 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
308 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
309 #define EV_PlayerPreThink(i, o) \
310 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
312 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
314 /** TODO change this into a general PlayerPostThink hook? */
315 #define EV_GetPressedKeys(i, o) \
316 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
318 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
321 * is meant to call GetCvars_handle* for cvars this mutator needs from the client, e.g.:
322 MUTATOR_HOOKFUNCTION(mymutator, GetCvars)
324 GetCvars_handleFloat(this, store, s, f, cvar_mycvar, "mycvar");
327 * Usually you can just use REPLICATE instead of this hook, e.g.:
328 REPLICATE(cvar_mycvar, int, "mycvar");
329 * NOTE: requesting cvar values (get_cvars_f 0) is deprecated
331 #define EV_GetCvars(i, o) \
332 /**/ i(float, get_cvars_f) \
333 /**/ i(string, get_cvars_s) \
337 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
339 /** can edit any "just fired" projectile */
340 #define EV_EditProjectile(i, o) \
341 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
342 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
344 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
346 /** called when a monster spawns */
347 #define EV_MonsterSpawn(i, o) \
348 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
350 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
352 /** called when a monster dies */
353 #define EV_MonsterDies(i, o) \
354 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
355 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
356 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
358 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
360 /** called when a monster dies */
361 #define EV_MonsterRemove(i, o) \
362 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
364 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
366 /** called when a monster wants to respawn */
367 #define EV_MonsterRespawn(i, o) \
368 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
370 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
372 /** called when a monster is dropping loot */
373 #define EV_MonsterDropItem(i, o) \
374 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
375 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
376 /**/ o(entity, MUTATOR_ARGV_1_entity) \
377 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
379 .entity monster_loot;
380 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
383 * called when a monster moves
384 * returning true makes the monster stop
386 #define EV_MonsterMove(i, o) \
387 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
388 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
389 /**/ o(float, MUTATOR_ARGV_1_float) \
390 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
391 /**/ o(float, MUTATOR_ARGV_2_float) \
392 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
393 /**/ o(entity, MUTATOR_ARGV_3_entity) \
395 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
397 /** called when a monster looks for another target */
398 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
401 * called when validating a monster's target
403 #define EV_MonsterValidTarget(i, o) \
404 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
405 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
407 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
409 /** called to change a random monster to a miniboss */
410 #define EV_MonsterCheckBossFlag(i, o) \
411 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
413 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
416 * called when a player tries to spawn a monster
417 * return 1 to prevent spawning
418 * NOTE: requires reason if disallowed
420 #define EV_AllowMobSpawning(i, o) \
421 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
422 /** reason */ o(string, MUTATOR_ARGV_1_string) \
424 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
426 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
427 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
428 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
429 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
430 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
431 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
432 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
433 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
434 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
435 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
436 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
437 /** damage */ i(float, MUTATOR_ARGV_7_float) \
439 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
442 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
443 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
445 #define EV_Damage_Calculate(i, o) \
446 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
447 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
448 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
449 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
450 /** damage */ i(float, MUTATOR_ARGV_4_float) \
451 /** damage */ o(float, MUTATOR_ARGV_4_float) \
452 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
453 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
454 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
455 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
456 /** weapon entity */ i(entity, MUTATOR_ARGV_7_entity) \
458 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
461 * Called when a player is damaged
462 * Returns true if damage shouldn't be logged
464 #define EV_PlayerDamaged(i, o) \
465 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
466 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
467 /** health */ i(float, MUTATOR_ARGV_2_float) \
468 /** armor */ i(float, MUTATOR_ARGV_3_float) \
469 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
470 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
471 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
473 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
476 * Called by W_DecreaseAmmo
478 #define EV_W_DecreaseAmmo(i, o) \
479 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
480 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
481 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
482 /**/ o(float, MUTATOR_ARGV_2_float) \
484 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
489 #define EV_W_Reload(i, o) \
490 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
492 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
494 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
495 #define EV_PlayerPowerups(i, o) \
496 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
497 /** old items */ i(int, MUTATOR_ARGV_1_int) \
499 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
502 * called every player think frame
503 * return 1 to disable regen
505 #define EV_PlayerRegen(i, o) \
506 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
507 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
508 /**/ o(float, MUTATOR_ARGV_1_float) \
509 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
510 /**/ o(float, MUTATOR_ARGV_2_float) \
511 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
512 /**/ o(float, MUTATOR_ARGV_3_float) \
513 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
514 /**/ o(float, MUTATOR_ARGV_4_float) \
515 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
516 /**/ o(float, MUTATOR_ARGV_5_float) \
517 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
518 /**/ o(float, MUTATOR_ARGV_6_float) \
519 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
520 /**/ o(float, MUTATOR_ARGV_7_float) \
521 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
522 /**/ o(float, MUTATOR_ARGV_8_float) \
523 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
524 /**/ o(float, MUTATOR_ARGV_9_float) \
525 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
526 /**/ o(float, MUTATOR_ARGV_10_float) \
528 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
531 * called when the use key is pressed
532 * if MUTATOR_RETURNVALUE is 1, don't do anything
533 * return 1 if the use key actually did something
535 #define EV_PlayerUseKey(i, o) \
536 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
538 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
541 * called when a client command is parsed
542 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
543 * NOTE: return true if you handled the command, return false to continue handling
544 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
546 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
548 * if (MUTATOR_RETURNVALUE) // command was already handled?
550 * if (cmd_name == "echocvar" && cmd_argc >= 2)
552 * print(cvar_string(argv(1)), "\n");
555 * if (cmd_name == "echostring" && cmd_argc >= 2)
557 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
563 #define EV_SV_ParseClientCommand(i, o) \
564 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
565 /** command name */ i(string, MUTATOR_ARGV_1_string) \
566 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
567 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
569 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
571 /** please read EV_SV_ParseClientCommand description before using */
572 #define EV_SV_ParseServerCommand(i, o) \
573 /** command name */ i(string, MUTATOR_ARGV_0_string) \
574 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
575 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
577 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
580 * called when a spawnpoint is being evaluated
581 * return 1 to make the spawnpoint unusable
583 #define EV_Spawn_Score(i, o) \
584 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
585 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
586 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
587 /**/ o(vector, MUTATOR_ARGV_2_vector) \
589 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
591 /** runs globally each server frame */
592 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
594 #define EV_SetModname(i, o) \
595 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
596 /**/ i(string, MUTATOR_ARGV_0_string) \
597 /**/ o(string, MUTATOR_ARGV_0_string) \
599 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
602 * called for each item being spawned on a map, including dropped weapons
603 * return 1 to remove an item
605 #define EV_Item_Spawn(i, o) \
606 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
608 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
610 #define EV_SetWeaponreplace(i, o) \
611 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
612 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
613 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
614 /**/ o(string, MUTATOR_ARGV_2_string) \
616 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
618 /** called when an item is about to respawn */
619 #define EV_Item_RespawnCountdown(i, o) \
620 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
622 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
624 /** called when a bot checks a target to attack */
625 #define EV_BotShouldAttack(i, o) \
626 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
627 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
629 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
632 * called whenever a player goes through a portal gun teleport
633 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
635 #define EV_PortalTeleport(i, o) \
636 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
638 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
641 * called whenever a player uses impulse 33 (help me) in impulse.qc
642 * normally help me ping uses .waypointsprite_attachedforcarrier,
643 * but if your mutator uses something different then you can handle it
644 * in a special manner using this hook
646 #define EV_HelpMePing(i, o) \
647 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
649 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
652 * called when a vehicle initializes
653 * return true to remove the vehicle
655 #define EV_VehicleInit(i, o) \
656 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
658 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
661 * called when a player enters a vehicle
662 * allows mutators to set special settings in this event
664 #define EV_VehicleEnter(i, o) \
665 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
666 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
668 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
671 * called when a player touches a vehicle
672 * return true to stop player from entering the vehicle
674 #define EV_VehicleTouch(i, o) \
675 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
676 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
678 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
681 * called when a player exits a vehicle
682 * allows mutators to set special settings in this event
684 #define EV_VehicleExit(i, o) \
685 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
686 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
688 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
690 /** called when a speedrun is aborted and the player is teleported back to start position */
691 #define EV_AbortSpeedrun(i, o) \
692 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
694 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
696 /** called at when a item is touched. Called early, can edit item properties. */
697 #define EV_ItemTouch(i, o) \
698 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
699 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
700 /**/ o(entity, MUTATOR_ARGV_1_entity) \
702 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
705 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
706 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
707 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
710 /** called after the item has been touched. */
711 #define EV_ItemTouched(i, o) \
712 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
713 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
715 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
717 // The Resource hooks are often called by other hooks and to avoid conflicts
718 // as much as possible their args start from ARGV_7
720 /** Called when the amount of entity resources changes. Can be used to override
722 #define EV_GetResourceLimit(i, o) \
723 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
724 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
725 /** limit */ i(float, MUTATOR_ARGV_9_float) \
726 /**/ o(float, MUTATOR_ARGV_9_float) \
728 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
730 /** Called when the amount of resource of an entity changes. See RES_*
731 constants for resource types. Return true to forbid the change. */
732 #define EV_SetResource(i, o) \
733 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
734 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
735 /**/ o(entity, MUTATOR_ARGV_8_entity) \
736 /** amount */ i(float, MUTATOR_ARGV_9_float) \
737 /**/ o(float, MUTATOR_ARGV_9_float) \
739 MUTATOR_HOOKABLE(SetResource, EV_SetResource);
741 /** Called after the amount of resource of an entity has changed. See RES_*
742 constants for resource types. Amount wasted is the amount of resource that is
743 above resource limit so it was not given. */
744 #define EV_ResourceAmountChanged(i, o) \
745 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
746 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
747 /** amount */ i(float, MUTATOR_ARGV_9_float) \
749 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
751 /** Called when there was an attempt to set entity resources higher than their
752 limit. See RES_* constants for resource types. Amount wasted is the amount
753 of resource that is above resource limit so it was not given. */
754 #define EV_ResourceWasted(i, o) \
755 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
756 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
757 /** amount wasted */ i(float, MUTATOR_ARGV_9_float) \
759 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
761 /** Called when entity is being given some resource. See RES_* constants
762 for resource types. Return true to forbid giving.
763 NOTE: This hook is also called by GiveResourceWithLimit */
764 #define EV_GiveResource(i, o) \
765 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
766 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
767 /**/ o(entity, MUTATOR_ARGV_8_entity) \
768 /** amount */ i(float, MUTATOR_ARGV_9_float) \
769 /**/ o(float, MUTATOR_ARGV_9_float) \
771 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
773 /** Called when entity is being given some resource with specified limit. See
774 RES_* constants for resource types. Return true to forbid giving. */
775 #define EV_GiveResourceWithLimit(i, o) \
776 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
777 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
778 /**/ o(entity, MUTATOR_ARGV_8_entity) \
779 /** amount */ i(float, MUTATOR_ARGV_9_float) \
780 /**/ o(float, MUTATOR_ARGV_9_float) \
781 /** limit */ i(float, MUTATOR_ARGV_10_float) \
782 /**/ o(float, MUTATOR_ARGV_10_float) \
784 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
786 /** Called when some resource is being taken from an entity. See RES_* constants
787 for resource types. Return true to forbid giving.
788 NOTE: This hook is also called by TakeResourceWithLimit */
789 #define EV_TakeResource(i, o) \
790 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
791 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
792 /**/ o(entity, MUTATOR_ARGV_8_entity) \
793 /** amount */ i(float, MUTATOR_ARGV_9_float) \
794 /**/ o(float, MUTATOR_ARGV_9_float) \
796 MUTATOR_HOOKABLE(TakeResource, EV_TakeResource);
798 /** Called when some resource is being taken from an entity, with a limit. See
799 RES_* constants for resource types. Return true to forbid giving. */
800 #define EV_TakeResourceWithLimit(i, o) \
801 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
802 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
803 /**/ o(entity, MUTATOR_ARGV_8_entity) \
804 /** amount */ i(float, MUTATOR_ARGV_9_float) \
805 /**/ o(float, MUTATOR_ARGV_9_float) \
806 /** limit */ i(float, MUTATOR_ARGV_10_float) \
807 /**/ o(float, MUTATOR_ARGV_10_float) \
809 MUTATOR_HOOKABLE(TakeResourceWithLimit, EV_TakeResourceWithLimit);
811 // END Resource hooks
813 /** called at when a player connect */
814 #define EV_ClientConnect(i, o) \
815 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
817 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
819 #define EV_HavocBot_ChooseRole(i, o) \
820 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
822 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
824 /** called when a target is checked for accuracy */
825 #define EV_AccuracyTargetValid(i, o) \
826 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
827 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
829 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
831 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
832 MUT_ACCADD_INVALID, // return this flag to make the function always continue
833 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
836 /** Called when clearing the global parameters for a model */
837 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
839 /** Called when getting the global parameters for a model */
840 #define EV_GetModelParams(i, o) \
841 /** input */ i(string, MUTATOR_ARGV_0_string) \
842 /** command */ i(string, MUTATOR_ARGV_1_string) \
844 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
846 /** called when a bullet has hit a target */
847 #define EV_FireBullet_Hit(i, o) \
848 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
849 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
850 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
851 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
852 /** damage */ i(float, MUTATOR_ARGV_4_float) \
853 /**/ o(float, MUTATOR_ARGV_4_float) \
854 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
856 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
858 #define EV_FixPlayermodel(i, o) \
859 /** model */ i(string, MUTATOR_ARGV_0_string) \
860 /**/ o(string, MUTATOR_ARGV_0_string) \
861 /** skin */ i(int, MUTATOR_ARGV_1_int) \
862 /**/ o(int, MUTATOR_ARGV_1_int) \
863 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
865 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
867 /** Return error to play frag remaining announcements */
868 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
870 #define EV_GrappleHookThink(i, o) \
871 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
872 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
873 /**/ o(int, MUTATOR_ARGV_1_int) \
874 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
875 /**/ o(entity, MUTATOR_ARGV_2_entity) \
876 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
877 /**/ o(float, MUTATOR_ARGV_3_float) \
879 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
881 #define EV_BuffModel_Customize(i, o) \
882 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
883 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
885 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
887 /** called at when a buff is touched. Called early, can edit buff properties. */
888 #define EV_BuffTouch(i, o) \
889 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
890 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
891 /**/ o(entity, MUTATOR_ARGV_1_entity) \
893 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
895 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
897 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
899 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
901 #define EV_GetRecords(i, o) \
902 /** page */ i(int, MUTATOR_ARGV_0_int) \
903 /** record list */ i(string, MUTATOR_ARGV_1_string) \
904 /**/ o(string, MUTATOR_ARGV_1_string) \
906 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
908 #define EV_Race_FinalCheckpoint(i, o) \
909 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
911 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
913 /** called when player triggered kill (or is changing teams), return error to not do anything */
914 #define EV_ClientKill(i, o) \
915 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
916 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
917 /**/ o(float, MUTATOR_ARGV_1_float) \
919 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
921 /** called when player is about to be killed during kill command or changing teams */
922 #define EV_ClientKill_Now(i, o) \
923 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
925 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
927 #define EV_FixClientCvars(i, o) \
928 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
930 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
932 #define EV_SpectateSet(i, o) \
933 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
934 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
935 /**/ o(entity, MUTATOR_ARGV_1_entity) \
937 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
939 #define EV_SpectateNext(i, o) \
940 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
941 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
942 /**/ o(entity, MUTATOR_ARGV_1_entity) \
944 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
946 #define EV_SpectatePrev(i, o) \
947 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
948 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
949 /**/ o(entity, MUTATOR_ARGV_1_entity) \
950 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
952 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
955 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
956 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
957 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
960 /** called when player triggered kill (or is changing teams), return error to not do anything */
961 #define EV_Bot_FixCount(i, o) \
962 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
963 /**/ o(int, MUTATOR_ARGV_0_int) \
964 /** real players */ i(int, MUTATOR_ARGV_1_int) \
965 /**/ o(int, MUTATOR_ARGV_1_int) \
967 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
969 #define EV_ClientCommand_Spectate(i, o) \
970 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
972 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
975 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
976 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
977 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
980 #define EV_CheckRules_World(i, o) \
981 /** status */ i(float, MUTATOR_ARGV_0_float) \
982 /**/ o(float, MUTATOR_ARGV_0_float) \
983 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
984 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
986 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
988 #define EV_WantWeapon(i, o) \
989 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
990 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
991 /**/ o(float, MUTATOR_ARGV_1_float) \
992 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
993 /**/ o(bool, MUTATOR_ARGV_2_bool) \
994 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
995 /**/ o(bool, MUTATOR_ARGV_3_bool) \
997 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
999 #define EV_AddPlayerScore(i, o) \
1000 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1001 /** score */ i(float, MUTATOR_ARGV_1_float) \
1002 /**/ o(float, MUTATOR_ARGV_1_float) \
1003 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1005 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
1007 #define EV_AddedPlayerScore(i, o) \
1008 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1009 /** score */ i(float, MUTATOR_ARGV_1_float) \
1010 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1012 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
1014 #define EV_SetWeaponArena(i, o) \
1015 /** arena */ i(string, MUTATOR_ARGV_0_string) \
1016 /**/ o(string, MUTATOR_ARGV_0_string) \
1018 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
1020 #define EV_DropSpecialItems(i, o) \
1021 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
1023 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
1026 * called when an admin tries to kill all monsters
1027 * return 1 to prevent spawning
1029 #define EV_AllowMobButcher(i, o) \
1030 /** reason */ o(string, MUTATOR_ARGV_0_string) \
1032 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
1034 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
1036 #define EV_SendWaypoint(i, o) \
1037 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
1038 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
1039 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
1040 /**/ o(int, MUTATOR_ARGV_2_int) \
1041 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
1042 /**/ o(int, MUTATOR_ARGV_3_int) \
1044 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
1046 #define EV_TurretValidateTarget(i, o) \
1047 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1048 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1049 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
1050 /** target score */ o(float, MUTATOR_ARGV_3_float) \
1052 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
1054 #define EV_TurretThink(i, o) \
1055 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1057 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
1059 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
1062 #define EV_PrepareExplosionByDamage(i, o) \
1063 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
1064 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1066 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1068 /** called when a monster model is about to be set, allows custom paths etc. */
1069 #define EV_MonsterModel(i, o) \
1070 /** model */ i(string, MUTATOR_ARGV_0_string) \
1071 /** output */ i(string, MUTATOR_ARGV_1_string) \
1072 /**/ o(string, MUTATOR_ARGV_1_string) \
1074 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1077 * Called before player changes their team. Return true to block team change.
1079 #define EV_Player_ChangeTeam(i, o) \
1080 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1081 /** current team index */ i(float, MUTATOR_ARGV_1_float) \
1082 /** new team index */ i(float, MUTATOR_ARGV_2_float) \
1084 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1087 * Called after player has changed their team.
1089 #define EV_Player_ChangedTeam(i, o) \
1090 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1091 /** old team index */ i(float, MUTATOR_ARGV_1_float) \
1092 /** current team index */ i(float, MUTATOR_ARGV_2_float) \
1094 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1097 * Called when player is about to be killed when changing teams. Return true to block killing.
1099 #define EV_Player_ChangeTeamKill(i, o) \
1100 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1102 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1105 #define EV_URI_GetCallback(i, o) \
1106 /** id */ i(float, MUTATOR_ARGV_0_float) \
1107 /** status */ i(float, MUTATOR_ARGV_1_float) \
1108 /** data */ i(string, MUTATOR_ARGV_2_string) \
1110 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1113 * return true to lock weapon (can't be used nor changed) for a player
1115 #define EV_LockWeapon(i, o) \
1116 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1118 MUTATOR_HOOKABLE(LockWeapon, EV_LockWeapon);
1121 * return true to prevent weapon use for a player
1123 #define EV_ForbidWeaponUse(i, o) \
1124 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1126 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1128 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1129 #define EV_CopyBody(i, o) \
1130 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1131 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1132 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1134 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1136 /** called when sending a chat message, ret argument can be changed to prevent the message */
1137 #define EV_ChatMessage(i, o) \
1138 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1139 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1140 /**/ o(int, MUTATOR_ARGV_1_int) \
1142 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1144 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1145 #define EV_ChatMessageTo(i, o) \
1146 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1147 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1149 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1152 * return true to restart the server instead of restarting the match, for modes that don't support readyrestart.
1153 * NOTE: ReadyRestart support is mandatory in campaign
1155 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1157 /** called when a fusion reactor is validating its target */
1158 #define EV_FusionReactor_ValidTarget(i, o) \
1159 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1160 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1162 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1165 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1166 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1167 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1170 /** return true to hide the 'teamnumbers are imbalanced' message */
1171 #define EV_HideTeamNagger(i, o) \
1172 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1174 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1176 /** return true to show a waypoint while the item is spawning */
1177 #define EV_Item_ScheduleRespawn(i, o) \
1178 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1179 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1181 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1183 /** called before physics stats are set on a player, allows limited early customization */
1184 #define EV_PlayerPhysics_UpdateStats(i, o) \
1185 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1187 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1189 /** called after physics stats are set on a player, allows post-initialization modifications */
1190 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1191 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1192 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1194 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1196 /** return true to use your own aim target (or none at all) */
1197 #define EV_HavocBot_Aim(i, o) \
1198 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1200 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1202 /** return true to skip respawn time calculations */
1203 #define EV_CalculateRespawnTime(i, o) \
1204 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1206 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1208 /** called when parsing a vote command. */
1209 #define EV_VoteCommand_Parse(i, o) \
1210 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1211 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1212 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1213 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1214 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1216 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1219 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1220 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1221 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1222 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)
1226 * Called when freezing an entity (monster or player), return true to force showing a waypoint
1228 #define EV_Freeze(i, o) \
1229 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1230 /** revive speed */ i(float, MUTATOR_ARGV_1_float) \
1231 /** frozen type */ i(int, MUTATOR_ARGV_2_int) \
1233 MUTATOR_HOOKABLE(Freeze, EV_Freeze);
1236 * Called when an entity (monster or player) is defrosted
1238 #define EV_Unfreeze(i, o) \
1239 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1241 MUTATOR_HOOKABLE(Unfreeze, EV_Unfreeze);
1244 * Called when a player is trying to join, argument is the number of players allowed to join the match
1246 #define EV_GetPlayerLimit(i, o) \
1247 /** g_maxplayers */ i(int, MUTATOR_ARGV_0_int) \
1248 /**/ o(int, MUTATOR_ARGV_0_int) \
1250 MUTATOR_HOOKABLE(GetPlayerLimit, EV_GetPlayerLimit);
1252 /** include special item codes for a death to the game log */
1253 #define EV_LogDeath_AppendItemCodes(i, o) \
1254 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1255 /** item codes */ i(string, MUTATOR_ARGV_1_string) \
1256 /**/ o(string, MUTATOR_ARGV_1_string) \
1258 MUTATOR_HOOKABLE(LogDeath_AppendItemCodes, EV_LogDeath_AppendItemCodes);
1260 /** Allows disabling or enabling rocket jumping independently of balance, use the parameter to force a preferred setting */
1261 #define EV_AllowRocketJumping(i, o) \
1262 /** allow_rocketjump */ i(bool, MUTATOR_ARGV_0_bool) \
1263 /**/ o(bool, MUTATOR_ARGV_0_bool) \
1265 MUTATOR_HOOKABLE(AllowRocketJumping, EV_AllowRocketJumping);
1267 /** Called when weapons are performing their attack, useful for applying bonus attack sounds */
1268 #define EV_W_PlayStrengthSound(i, o) \
1269 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1271 MUTATOR_HOOKABLE(W_PlayStrengthSound, EV_W_PlayStrengthSound);