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 their 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 they were 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 they were 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 they were 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);
625 * called when a bot checks a target to attack
626 * return false to allow the bot to attack the target (inverted logic)
628 #define EV_BotShouldAttack(i, o) \
629 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
630 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
632 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
635 * called whenever a player goes through a portal gun teleport
636 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
638 #define EV_PortalTeleport(i, o) \
639 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
641 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
644 * called whenever a player uses impulse 33 (help me) in impulse.qc
645 * normally help me ping uses .waypointsprite_attachedforcarrier,
646 * but if your mutator uses something different then you can handle it
647 * in a special manner using this hook
649 #define EV_HelpMePing(i, o) \
650 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
652 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
655 * called when a vehicle initializes
656 * return true to remove the vehicle
658 #define EV_VehicleInit(i, o) \
659 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
661 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
664 * called when a player enters a vehicle
665 * allows mutators to set special settings in this event
667 #define EV_VehicleEnter(i, o) \
668 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
669 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
671 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
674 * called when a player touches a vehicle
675 * return true to stop player from entering the vehicle
677 #define EV_VehicleTouch(i, o) \
678 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
679 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
681 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
684 * called when a player exits a vehicle
685 * allows mutators to set special settings in this event
687 #define EV_VehicleExit(i, o) \
688 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
689 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
691 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
693 /** called when a speedrun is aborted and the player is teleported back to start position */
694 #define EV_AbortSpeedrun(i, o) \
695 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
697 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
699 /** called at when a item is touched. Called early, can edit item properties. */
700 #define EV_ItemTouch(i, o) \
701 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
702 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
703 /**/ o(entity, MUTATOR_ARGV_1_entity) \
705 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
708 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
709 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
710 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
713 /** called after the item has been touched. */
714 #define EV_ItemTouched(i, o) \
715 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
716 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
718 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
720 // The Resource hooks are often called by other hooks and to avoid conflicts
721 // as much as possible their args start from ARGV_7
723 /** Called when the amount of entity resources changes. Can be used to override
725 #define EV_GetResourceLimit(i, o) \
726 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
727 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
728 /** limit */ i(float, MUTATOR_ARGV_9_float) \
729 /**/ o(float, MUTATOR_ARGV_9_float) \
731 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
733 /** Called when the amount of resource of an entity changes. See RES_*
734 constants for resource types. Return true to forbid the change. */
735 #define EV_SetResource(i, o) \
736 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
737 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
738 /**/ o(entity, MUTATOR_ARGV_8_entity) \
739 /** amount */ i(float, MUTATOR_ARGV_9_float) \
740 /**/ o(float, MUTATOR_ARGV_9_float) \
742 MUTATOR_HOOKABLE(SetResource, EV_SetResource);
744 /** Called after the amount of resource of an entity has changed. See RES_*
745 constants for resource types. Amount wasted is the amount of resource that is
746 above resource limit so it was not given. */
747 #define EV_ResourceAmountChanged(i, o) \
748 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
749 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
750 /** amount */ i(float, MUTATOR_ARGV_9_float) \
752 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
754 /** Called when there was an attempt to set entity resources higher than their
755 limit. See RES_* constants for resource types. Amount wasted is the amount
756 of resource that is above resource limit so it was not given. */
757 #define EV_ResourceWasted(i, o) \
758 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
759 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
760 /** amount wasted */ i(float, MUTATOR_ARGV_9_float) \
762 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
764 /** Called when entity is being given some resource. See RES_* constants
765 for resource types. Return true to forbid giving.
766 NOTE: This hook is also called by GiveResourceWithLimit */
767 #define EV_GiveResource(i, o) \
768 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
769 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
770 /**/ o(entity, MUTATOR_ARGV_8_entity) \
771 /** amount */ i(float, MUTATOR_ARGV_9_float) \
772 /**/ o(float, MUTATOR_ARGV_9_float) \
774 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
776 /** Called when entity is being given some resource with specified limit. See
777 RES_* constants for resource types. Return true to forbid giving. */
778 #define EV_GiveResourceWithLimit(i, o) \
779 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
780 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
781 /**/ o(entity, MUTATOR_ARGV_8_entity) \
782 /** amount */ i(float, MUTATOR_ARGV_9_float) \
783 /**/ o(float, MUTATOR_ARGV_9_float) \
784 /** limit */ i(float, MUTATOR_ARGV_10_float) \
785 /**/ o(float, MUTATOR_ARGV_10_float) \
787 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
789 /** Called when some resource is being taken from an entity. See RES_* constants
790 for resource types. Return true to forbid giving.
791 NOTE: This hook is also called by TakeResourceWithLimit */
792 #define EV_TakeResource(i, o) \
793 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
794 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
795 /**/ o(entity, MUTATOR_ARGV_8_entity) \
796 /** amount */ i(float, MUTATOR_ARGV_9_float) \
797 /**/ o(float, MUTATOR_ARGV_9_float) \
799 MUTATOR_HOOKABLE(TakeResource, EV_TakeResource);
801 /** Called when some resource is being taken from an entity, with a limit. See
802 RES_* constants for resource types. Return true to forbid giving. */
803 #define EV_TakeResourceWithLimit(i, o) \
804 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
805 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
806 /**/ o(entity, MUTATOR_ARGV_8_entity) \
807 /** amount */ i(float, MUTATOR_ARGV_9_float) \
808 /**/ o(float, MUTATOR_ARGV_9_float) \
809 /** limit */ i(float, MUTATOR_ARGV_10_float) \
810 /**/ o(float, MUTATOR_ARGV_10_float) \
812 MUTATOR_HOOKABLE(TakeResourceWithLimit, EV_TakeResourceWithLimit);
814 // END Resource hooks
816 /** called at when a player connect */
817 #define EV_ClientConnect(i, o) \
818 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
820 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
822 #define EV_HavocBot_ChooseRole(i, o) \
823 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
825 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
827 /** called when a target is checked for accuracy */
828 #define EV_AccuracyTargetValid(i, o) \
829 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
830 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
832 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
834 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
835 MUT_ACCADD_INVALID, // return this flag to make the function always continue
836 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
839 /** Called when clearing the global parameters for a model */
840 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
842 /** Called when getting the global parameters for a model */
843 #define EV_GetModelParams(i, o) \
844 /** input */ i(string, MUTATOR_ARGV_0_string) \
845 /** command */ i(string, MUTATOR_ARGV_1_string) \
847 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
849 /** called when a bullet has hit a target */
850 #define EV_FireBullet_Hit(i, o) \
851 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
852 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
853 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
854 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
855 /** damage */ i(float, MUTATOR_ARGV_4_float) \
856 /**/ o(float, MUTATOR_ARGV_4_float) \
857 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
859 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
861 #define EV_FixPlayermodel(i, o) \
862 /** model */ i(string, MUTATOR_ARGV_0_string) \
863 /**/ o(string, MUTATOR_ARGV_0_string) \
864 /** skin */ i(int, MUTATOR_ARGV_1_int) \
865 /**/ o(int, MUTATOR_ARGV_1_int) \
866 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
868 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
870 /** Return error to play frag remaining announcements */
871 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
873 #define EV_GrappleHookThink(i, o) \
874 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
875 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
876 /**/ o(int, MUTATOR_ARGV_1_int) \
877 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
878 /**/ o(entity, MUTATOR_ARGV_2_entity) \
879 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
880 /**/ o(float, MUTATOR_ARGV_3_float) \
882 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
884 #define EV_BuffModel_Customize(i, o) \
885 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
886 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
888 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
890 /** called at when a buff is touched. Called early, can edit buff properties. */
891 #define EV_BuffTouch(i, o) \
892 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
893 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
894 /**/ o(entity, MUTATOR_ARGV_1_entity) \
896 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
898 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
900 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
902 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
904 #define EV_GetRecords(i, o) \
905 /** page */ i(int, MUTATOR_ARGV_0_int) \
906 /** record list */ i(string, MUTATOR_ARGV_1_string) \
907 /**/ o(string, MUTATOR_ARGV_1_string) \
909 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
911 #define EV_Race_FinalCheckpoint(i, o) \
912 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
914 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
916 /** called when player triggered kill (or is changing teams), return error to not do anything */
917 #define EV_ClientKill(i, o) \
918 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
919 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
920 /**/ o(float, MUTATOR_ARGV_1_float) \
922 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
924 /** called when player is about to be killed during kill command or changing teams */
925 #define EV_ClientKill_Now(i, o) \
926 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
928 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
930 #define EV_FixClientCvars(i, o) \
931 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
933 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
935 #define EV_SpectateSet(i, o) \
936 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
937 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
938 /**/ o(entity, MUTATOR_ARGV_1_entity) \
940 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
942 #define EV_SpectateNext(i, o) \
943 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
944 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
945 /**/ o(entity, MUTATOR_ARGV_1_entity) \
947 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
949 #define EV_SpectatePrev(i, o) \
950 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
951 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
952 /**/ o(entity, MUTATOR_ARGV_1_entity) \
953 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
955 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
958 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
959 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
960 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
963 /** called when player triggered kill (or is changing teams), return error to not do anything */
964 #define EV_Bot_FixCount(i, o) \
965 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
966 /**/ o(int, MUTATOR_ARGV_0_int) \
967 /** real players */ i(int, MUTATOR_ARGV_1_int) \
968 /**/ o(int, MUTATOR_ARGV_1_int) \
970 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
972 #define EV_ClientCommand_Spectate(i, o) \
973 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
975 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
978 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
979 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
980 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
983 #define EV_CheckRules_World(i, o) \
984 /** status */ i(float, MUTATOR_ARGV_0_float) \
985 /**/ o(float, MUTATOR_ARGV_0_float) \
986 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
987 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
989 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
991 #define EV_WantWeapon(i, o) \
992 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
993 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
994 /**/ o(float, MUTATOR_ARGV_1_float) \
995 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
996 /**/ o(bool, MUTATOR_ARGV_2_bool) \
997 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
998 /**/ o(bool, MUTATOR_ARGV_3_bool) \
1000 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
1002 #define EV_AddPlayerScore(i, o) \
1003 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1004 /** score */ i(float, MUTATOR_ARGV_1_float) \
1005 /**/ o(float, MUTATOR_ARGV_1_float) \
1006 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1008 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
1010 #define EV_AddedPlayerScore(i, o) \
1011 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1012 /** score */ i(float, MUTATOR_ARGV_1_float) \
1013 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1015 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
1017 #define EV_GetPlayerStatus(i, o) \
1018 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1020 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
1022 #define EV_SetWeaponArena(i, o) \
1023 /** arena */ i(string, MUTATOR_ARGV_0_string) \
1024 /**/ o(string, MUTATOR_ARGV_0_string) \
1026 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
1028 #define EV_DropSpecialItems(i, o) \
1029 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
1031 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
1034 * called when an admin tries to kill all monsters
1035 * return 1 to prevent spawning
1037 #define EV_AllowMobButcher(i, o) \
1038 /** reason */ o(string, MUTATOR_ARGV_0_string) \
1040 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
1042 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
1044 #define EV_SendWaypoint(i, o) \
1045 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
1046 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
1047 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
1048 /**/ o(int, MUTATOR_ARGV_2_int) \
1049 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
1050 /**/ o(int, MUTATOR_ARGV_3_int) \
1052 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
1054 #define EV_TurretValidateTarget(i, o) \
1055 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1056 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1057 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
1058 /** target score */ o(float, MUTATOR_ARGV_3_float) \
1060 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
1062 #define EV_TurretThink(i, o) \
1063 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1065 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
1067 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
1070 #define EV_PrepareExplosionByDamage(i, o) \
1071 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
1072 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1074 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1076 /** called when a monster model is about to be set, allows custom paths etc. */
1077 #define EV_MonsterModel(i, o) \
1078 /** model */ i(string, MUTATOR_ARGV_0_string) \
1079 /** output */ i(string, MUTATOR_ARGV_1_string) \
1080 /**/ o(string, MUTATOR_ARGV_1_string) \
1082 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1085 * Called before player changes their team. Return true to block team change.
1087 #define EV_Player_ChangeTeam(i, o) \
1088 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1089 /** current team index */ i(float, MUTATOR_ARGV_1_float) \
1090 /** new team index */ i(float, MUTATOR_ARGV_2_float) \
1092 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1095 * Called after player has changed their team.
1097 #define EV_Player_ChangedTeam(i, o) \
1098 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1099 /** old team index */ i(float, MUTATOR_ARGV_1_float) \
1100 /** current team index */ i(float, MUTATOR_ARGV_2_float) \
1102 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1105 * Called when player is about to be killed when changing teams. Return true to block killing.
1107 #define EV_Player_ChangeTeamKill(i, o) \
1108 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1110 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1113 #define EV_URI_GetCallback(i, o) \
1114 /** id */ i(float, MUTATOR_ARGV_0_float) \
1115 /** status */ i(float, MUTATOR_ARGV_1_float) \
1116 /** data */ i(string, MUTATOR_ARGV_2_string) \
1118 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1121 * return true to lock weapon (can't be used nor changed) for a player
1123 #define EV_LockWeapon(i, o) \
1124 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1126 MUTATOR_HOOKABLE(LockWeapon, EV_LockWeapon);
1129 * return true to prevent weapon use for a player
1131 #define EV_ForbidWeaponUse(i, o) \
1132 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1134 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1136 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1137 #define EV_CopyBody(i, o) \
1138 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1139 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1140 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1142 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1144 /** called when sending a chat message, ret argument can be changed to prevent the message */
1145 #define EV_ChatMessage(i, o) \
1146 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1147 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1148 /**/ o(int, MUTATOR_ARGV_1_int) \
1150 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1152 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1153 #define EV_ChatMessageTo(i, o) \
1154 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1155 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1157 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1160 * return true to restart the server instead of restarting the match, for modes that don't support readyrestart.
1161 * NOTE: ReadyRestart support is mandatory in campaign
1163 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1165 /** called when a fusion reactor is validating its target */
1166 #define EV_FusionReactor_ValidTarget(i, o) \
1167 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1168 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1170 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1173 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1174 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1175 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1178 /** return true to hide the 'teamnumbers are imbalanced' message */
1179 #define EV_HideTeamNagger(i, o) \
1180 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1182 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1184 /** return true to show a waypoint while the item is spawning */
1185 #define EV_Item_ScheduleRespawn(i, o) \
1186 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1187 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1189 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1191 /** called before physics stats are set on a player, allows limited early customization */
1192 #define EV_PlayerPhysics_UpdateStats(i, o) \
1193 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1195 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1197 /** called after physics stats are set on a player, allows post-initialization modifications */
1198 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1199 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1200 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1202 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1204 /** return true to use your own aim target (or none at all) */
1205 #define EV_HavocBot_Aim(i, o) \
1206 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1208 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1210 /** return true to skip respawn time calculations */
1211 #define EV_CalculateRespawnTime(i, o) \
1212 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1214 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1216 /** called when parsing a vote command. */
1217 #define EV_VoteCommand_Parse(i, o) \
1218 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1219 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1220 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1221 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1222 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1224 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1227 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1228 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1229 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1230 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)
1234 * Called when freezing an entity (monster or player), return true to force showing a waypoint
1236 #define EV_Freeze(i, o) \
1237 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1238 /** revive speed */ i(float, MUTATOR_ARGV_1_float) \
1239 /** frozen type */ i(int, MUTATOR_ARGV_2_int) \
1241 MUTATOR_HOOKABLE(Freeze, EV_Freeze);
1244 * Called when an entity (monster or player) is defrosted
1246 #define EV_Unfreeze(i, o) \
1247 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1249 MUTATOR_HOOKABLE(Unfreeze, EV_Unfreeze);
1252 * Called when a player is trying to join, argument is the number of players allowed to join the match
1254 #define EV_GetPlayerLimit(i, o) \
1255 /** g_maxplayers */ i(int, MUTATOR_ARGV_0_int) \
1256 /**/ o(int, MUTATOR_ARGV_0_int) \
1258 MUTATOR_HOOKABLE(GetPlayerLimit, EV_GetPlayerLimit);
1260 /** include special item codes for a death to the game log */
1261 #define EV_LogDeath_AppendItemCodes(i, o) \
1262 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1263 /** item codes */ i(string, MUTATOR_ARGV_1_string) \
1264 /**/ o(string, MUTATOR_ARGV_1_string) \
1266 MUTATOR_HOOKABLE(LogDeath_AppendItemCodes, EV_LogDeath_AppendItemCodes);
1268 /** Allows disabling or enabling rocket jumping independently of balance, use the parameter to force a preferred setting */
1269 #define EV_AllowRocketJumping(i, o) \
1270 /** allow_rocketjump */ i(bool, MUTATOR_ARGV_0_bool) \
1271 /**/ o(bool, MUTATOR_ARGV_0_bool) \
1273 MUTATOR_HOOKABLE(AllowRocketJumping, EV_AllowRocketJumping);
1275 /** Called when weapons are performing their attack, useful for applying bonus attack sounds */
1276 #define EV_W_PlayStrengthSound(i, o) \
1277 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1279 MUTATOR_HOOKABLE(W_PlayStrengthSound, EV_W_PlayStrengthSound);