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, before recording scores */
150 MUTATOR_HOOKABLE(MatchEnd_BeforeScores, EV_NO_ARGS);
152 /** called when the match ends */
153 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
155 /** Allows adjusting allowed teams. Return true to use the bitmask value and set
156 * non-empty string to use team entity name. Both behaviors can be active at the
157 * same time and will stack allowed teams.
159 #define EV_TeamBalance_CheckAllowedTeams(i, o) \
160 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
161 /**/ o(float, MUTATOR_ARGV_0_float) \
162 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
163 /**/ o(string, MUTATOR_ARGV_1_string) \
164 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
166 MUTATOR_HOOKABLE(TeamBalance_CheckAllowedTeams,
167 EV_TeamBalance_CheckAllowedTeams);
169 /** return true to manually override team counts */
170 MUTATOR_HOOKABLE(TeamBalance_GetTeamCounts, EV_NO_ARGS);
172 /** allows overriding of team counts */
173 #define EV_TeamBalance_GetTeamCount(i, o) \
174 /** team index to count */ i(float, MUTATOR_ARGV_0_float) \
175 /** player to ignore */ i(entity, MUTATOR_ARGV_1_entity) \
176 /** number of players in a team */ o(float, MUTATOR_ARGV_2_float) \
177 /** number of bots in a team */ o(float, MUTATOR_ARGV_3_float) \
179 MUTATOR_HOOKABLE(TeamBalance_GetTeamCount, EV_TeamBalance_GetTeamCount);
181 /** allows overriding the teams that will make the game most balanced if the
182 * player joins any of them.
184 #define EV_TeamBalance_FindBestTeams(i, o) \
185 /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
186 /** bitmask of teams */ o(float, MUTATOR_ARGV_1_float) \
188 MUTATOR_HOOKABLE(TeamBalance_FindBestTeams, EV_TeamBalance_FindBestTeams);
190 /** Called during autobalance. Return true to override the player that will be
192 #define EV_TeamBalance_GetPlayerForTeamSwitch(i, o) \
193 /** source team index */ i(int, MUTATOR_ARGV_0_int) \
194 /** destination team index */ i(int, MUTATOR_ARGV_1_int) \
195 /** is looking for bot */ i(bool, MUTATOR_ARGV_2_bool) \
196 /** player to switch */ o(entity, MUTATOR_ARGV_3_entity) \
198 MUTATOR_HOOKABLE(TeamBalance_GetPlayerForTeamSwitch,
199 EV_TeamBalance_GetPlayerForTeamSwitch);
201 /** copies variables for spectating "spectatee" to "this" */
202 #define EV_SpectateCopy(i, o) \
203 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
204 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
206 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
208 /** called when formatting a chat message to replace fancy functions */
209 #define EV_FormatMessage(i, o) \
210 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
211 /** escape */ i(string, MUTATOR_ARGV_1_string) \
212 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
213 /**/ o(string, MUTATOR_ARGV_2_string) \
214 /** message */ i(string, MUTATOR_ARGV_3_string) \
216 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
218 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
219 #define EV_PreFormatMessage(i, o) \
220 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
221 /** message */ i(string, MUTATOR_ARGV_1_string) \
222 /**/ o(string, MUTATOR_ARGV_1_string) \
224 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
226 /** returns true if throwing the current weapon shall not be allowed */
227 #define EV_ForbidThrowCurrentWeapon(i, o) \
228 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
229 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
231 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
233 /** returns true if dropping the current weapon shall not be allowed at any time including death */
234 #define EV_ForbidDropCurrentWeapon(i, o) \
235 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
236 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
238 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
241 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
243 /** allows changing attack rate */
244 #define EV_WeaponRateFactor(i, o) \
245 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
246 /**/ o(float, MUTATOR_ARGV_0_float) \
247 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
249 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
251 /** allows changing weapon speed (projectiles mostly) */
252 #define EV_WeaponSpeedFactor(i, o) \
253 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
254 /**/ o(float, MUTATOR_ARGV_0_float) \
255 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
257 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
259 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
260 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
262 /** called every frame. customizes the waypoint for spectators */
263 #define EV_CustomizeWaypoint(i, o) \
264 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
265 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
267 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
269 /** Check if items having the given definition are allowed to spawn.
270 * Return true to disallow spawning.
272 #define EV_FilterItemDefinition(i, o) \
273 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
275 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
278 * checks if the current item may be spawned (.items may be read and written to, as well as the ammo_ fields)
279 * return error to request removal
281 #define EV_FilterItem(i, o) \
282 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
284 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
286 /** return error to request removal */
287 #define EV_TurretSpawn(i, o) \
288 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
290 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
292 /** return error to not attack */
293 #define EV_TurretFire(i, o) \
294 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
296 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
298 /** return error to not attack */
299 #define EV_Turret_CheckFire(i, o) \
300 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
301 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
303 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
305 /** return error to prevent entity spawn, or modify the entity */
306 #define EV_OnEntityPreSpawn(i, o) \
307 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
309 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
311 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
312 #define EV_PlayerPreThink(i, o) \
313 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
315 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
317 /** TODO change this into a general PlayerPostThink hook? */
318 #define EV_GetPressedKeys(i, o) \
319 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
321 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
324 * is meant to call GetCvars_handle* for cvars this mutator needs from the client, e.g.:
325 MUTATOR_HOOKFUNCTION(mymutator, GetCvars)
327 GetCvars_handleFloat(this, store, s, f, cvar_mycvar, "mycvar");
330 * Usually you can just use REPLICATE instead of this hook, e.g.:
331 REPLICATE(cvar_mycvar, int, "mycvar");
332 * NOTE: requesting cvar values (get_cvars_f 0) is deprecated
334 #define EV_GetCvars(i, o) \
335 /**/ i(float, get_cvars_f) \
336 /**/ i(string, get_cvars_s) \
340 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
342 /** can edit any "just fired" projectile */
343 #define EV_EditProjectile(i, o) \
344 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
345 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
347 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
349 /** called when a monster spawns */
350 #define EV_MonsterSpawn(i, o) \
351 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
353 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
355 /** called when a monster dies */
356 #define EV_MonsterDies(i, o) \
357 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
358 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
359 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
361 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
363 /** called when a monster dies */
364 #define EV_MonsterRemove(i, o) \
365 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
367 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
369 /** called when a monster wants to respawn */
370 #define EV_MonsterRespawn(i, o) \
371 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
373 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
375 /** called when a monster is dropping loot */
376 #define EV_MonsterDropItem(i, o) \
377 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
378 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
379 /**/ o(entity, MUTATOR_ARGV_1_entity) \
380 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
382 .entity monster_loot;
383 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
386 * called when a monster moves
387 * returning true makes the monster stop
389 #define EV_MonsterMove(i, o) \
390 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
391 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
392 /**/ o(float, MUTATOR_ARGV_1_float) \
393 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
394 /**/ o(float, MUTATOR_ARGV_2_float) \
395 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
396 /**/ o(entity, MUTATOR_ARGV_3_entity) \
398 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
400 /** called when a monster looks for another target */
401 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
404 * called when validating a monster's target
406 #define EV_MonsterValidTarget(i, o) \
407 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
408 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
410 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
412 /** called to change a random monster to a miniboss */
413 #define EV_MonsterCheckBossFlag(i, o) \
414 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
416 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
419 * called when a player tries to spawn a monster
420 * return 1 to prevent spawning
421 * NOTE: requires reason if disallowed
423 #define EV_AllowMobSpawning(i, o) \
424 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
425 /** reason */ o(string, MUTATOR_ARGV_1_string) \
427 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
429 /** called when a player gets damaged to e.g. remove stuff they were carrying. */
430 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
431 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
432 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
433 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
434 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
435 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
436 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
437 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
438 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
439 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
440 /** damage */ i(float, MUTATOR_ARGV_7_float) \
442 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
445 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
446 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
448 #define EV_Damage_Calculate(i, o) \
449 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
450 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
451 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
452 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
453 /** damage */ i(float, MUTATOR_ARGV_4_float) \
454 /** damage */ o(float, MUTATOR_ARGV_4_float) \
455 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
456 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
457 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
458 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
459 /** weapon entity */ i(entity, MUTATOR_ARGV_7_entity) \
461 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
464 * Called when a player is damaged
465 * Returns true if damage shouldn't be logged
467 #define EV_PlayerDamaged(i, o) \
468 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
469 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
470 /** health */ i(float, MUTATOR_ARGV_2_float) \
471 /** armor */ i(float, MUTATOR_ARGV_3_float) \
472 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
473 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
474 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
476 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
479 * Called by W_DecreaseAmmo
481 #define EV_W_DecreaseAmmo(i, o) \
482 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
483 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
484 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
485 /**/ o(float, MUTATOR_ARGV_2_float) \
487 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
492 #define EV_W_Reload(i, o) \
493 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
495 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
497 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
498 #define EV_PlayerPowerups(i, o) \
499 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
500 /** old items */ i(int, MUTATOR_ARGV_1_int) \
502 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
505 * called every player think frame
506 * return 1 to disable regen
508 #define EV_PlayerRegen(i, o) \
509 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
510 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
511 /**/ o(float, MUTATOR_ARGV_1_float) \
512 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
513 /**/ o(float, MUTATOR_ARGV_2_float) \
514 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
515 /**/ o(float, MUTATOR_ARGV_3_float) \
516 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
517 /**/ o(float, MUTATOR_ARGV_4_float) \
518 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
519 /**/ o(float, MUTATOR_ARGV_5_float) \
520 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
521 /**/ o(float, MUTATOR_ARGV_6_float) \
522 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
523 /**/ o(float, MUTATOR_ARGV_7_float) \
524 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
525 /**/ o(float, MUTATOR_ARGV_8_float) \
526 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
527 /**/ o(float, MUTATOR_ARGV_9_float) \
528 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
529 /**/ o(float, MUTATOR_ARGV_10_float) \
531 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
534 * called when the use key is pressed
535 * if MUTATOR_RETURNVALUE is 1, don't do anything
536 * return 1 if the use key actually did something
538 #define EV_PlayerUseKey(i, o) \
539 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
541 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
544 * called when a client command is parsed
545 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
546 * NOTE: return true if you handled the command, return false to continue handling
547 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
549 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
551 * if (MUTATOR_RETURNVALUE) // command was already handled?
553 * if (cmd_name == "echocvar" && cmd_argc >= 2)
555 * print(cvar_string(argv(1)), "\n");
558 * if (cmd_name == "echostring" && cmd_argc >= 2)
560 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
566 #define EV_SV_ParseClientCommand(i, o) \
567 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
568 /** command name */ i(string, MUTATOR_ARGV_1_string) \
569 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
570 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
572 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
574 /** please read EV_SV_ParseClientCommand description before using */
575 #define EV_SV_ParseServerCommand(i, o) \
576 /** command name */ i(string, MUTATOR_ARGV_0_string) \
577 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
578 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
580 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
583 * called when a spawnpoint is being evaluated
584 * return 1 to make the spawnpoint unusable
586 #define EV_Spawn_Score(i, o) \
587 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
588 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
589 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
590 /**/ o(vector, MUTATOR_ARGV_2_vector) \
592 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
594 /** runs globally each server frame */
595 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
597 #define EV_SetModname(i, o) \
598 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
599 /**/ i(string, MUTATOR_ARGV_0_string) \
600 /**/ o(string, MUTATOR_ARGV_0_string) \
602 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
605 * called for each item being spawned on a map, including dropped weapons
606 * return 1 to remove an item
608 #define EV_Item_Spawn(i, o) \
609 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
611 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
613 #define EV_SetWeaponreplace(i, o) \
614 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
615 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
616 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
617 /**/ o(string, MUTATOR_ARGV_2_string) \
619 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
621 /** called when an item is about to respawn */
622 #define EV_Item_RespawnCountdown(i, o) \
623 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
625 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
628 * called when a bot checks a target to attack
629 * return false to allow the bot to attack the target (inverted logic)
631 #define EV_BotShouldAttack(i, o) \
632 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
633 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
635 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
638 * called whenever a player goes through a portal gun teleport
639 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
641 #define EV_PortalTeleport(i, o) \
642 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
644 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
647 * called whenever a player uses impulse 33 (help me) in impulse.qc
648 * normally help me ping uses .waypointsprite_attachedforcarrier,
649 * but if your mutator uses something different then you can handle it
650 * in a special manner using this hook
652 #define EV_HelpMePing(i, o) \
653 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
655 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
658 * called when a vehicle initializes
659 * return true to remove the vehicle
661 #define EV_VehicleInit(i, o) \
662 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
664 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
667 * called when a player enters a vehicle
668 * allows mutators to set special settings in this event
670 #define EV_VehicleEnter(i, o) \
671 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
672 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
674 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
677 * called when a player touches a vehicle
678 * return true to stop player from entering the vehicle
680 #define EV_VehicleTouch(i, o) \
681 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
682 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
684 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
687 * called when a player exits a vehicle
688 * allows mutators to set special settings in this event
690 #define EV_VehicleExit(i, o) \
691 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
692 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
694 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
696 /** called when a speedrun is aborted and the player is teleported back to start position */
697 #define EV_AbortSpeedrun(i, o) \
698 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
700 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
702 /** called at when a item is touched. Called early, can edit item properties. */
703 #define EV_ItemTouch(i, o) \
704 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
705 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
706 /**/ o(entity, MUTATOR_ARGV_1_entity) \
708 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
711 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
712 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
713 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
716 /** called after the item has been touched. */
717 #define EV_ItemTouched(i, o) \
718 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
719 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
721 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
723 // The Resource hooks are often called by other hooks and to avoid conflicts
724 // as much as possible their args start from ARGV_7
726 /** Called when the amount of entity resources changes. Can be used to override
728 #define EV_GetResourceLimit(i, o) \
729 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
730 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
731 /** limit */ i(float, MUTATOR_ARGV_9_float) \
732 /**/ o(float, MUTATOR_ARGV_9_float) \
734 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
736 /** Called when the amount of resource of an entity changes. See RES_*
737 constants for resource types. Return true to forbid the change. */
738 #define EV_SetResource(i, o) \
739 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
740 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
741 /**/ o(entity, MUTATOR_ARGV_8_entity) \
742 /** amount */ i(float, MUTATOR_ARGV_9_float) \
743 /**/ o(float, MUTATOR_ARGV_9_float) \
745 MUTATOR_HOOKABLE(SetResource, EV_SetResource);
747 /** Called after the amount of resource of an entity has changed. See RES_*
748 constants for resource types. Amount wasted is the amount of resource that is
749 above resource limit so it was not given. */
750 #define EV_ResourceAmountChanged(i, o) \
751 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
752 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
753 /** amount */ i(float, MUTATOR_ARGV_9_float) \
755 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
757 /** Called when there was an attempt to set entity resources higher than their
758 limit. See RES_* constants for resource types. Amount wasted is the amount
759 of resource that is above resource limit so it was not given. */
760 #define EV_ResourceWasted(i, o) \
761 /** checked entity */ i(entity, MUTATOR_ARGV_7_entity) \
762 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
763 /** amount wasted */ i(float, MUTATOR_ARGV_9_float) \
765 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
767 /** Called when entity is being given some resource. See RES_* constants
768 for resource types. Return true to forbid giving.
769 NOTE: This hook is also called by GiveResourceWithLimit */
770 #define EV_GiveResource(i, o) \
771 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
772 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
773 /**/ o(entity, MUTATOR_ARGV_8_entity) \
774 /** amount */ i(float, MUTATOR_ARGV_9_float) \
775 /**/ o(float, MUTATOR_ARGV_9_float) \
777 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
779 /** Called when entity is being given some resource with specified limit. See
780 RES_* constants for resource types. Return true to forbid giving. */
781 #define EV_GiveResourceWithLimit(i, o) \
782 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
783 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
784 /**/ o(entity, MUTATOR_ARGV_8_entity) \
785 /** amount */ i(float, MUTATOR_ARGV_9_float) \
786 /**/ o(float, MUTATOR_ARGV_9_float) \
787 /** limit */ i(float, MUTATOR_ARGV_10_float) \
788 /**/ o(float, MUTATOR_ARGV_10_float) \
790 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
792 /** Called when some resource is being taken from an entity. See RES_* constants
793 for resource types. Return true to forbid giving.
794 NOTE: This hook is also called by TakeResourceWithLimit */
795 #define EV_TakeResource(i, o) \
796 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
797 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
798 /**/ o(entity, MUTATOR_ARGV_8_entity) \
799 /** amount */ i(float, MUTATOR_ARGV_9_float) \
800 /**/ o(float, MUTATOR_ARGV_9_float) \
802 MUTATOR_HOOKABLE(TakeResource, EV_TakeResource);
804 /** Called when some resource is being taken from an entity, with a limit. See
805 RES_* constants for resource types. Return true to forbid giving. */
806 #define EV_TakeResourceWithLimit(i, o) \
807 /** receiver */ i(entity, MUTATOR_ARGV_7_entity) \
808 /** resource type */ i(entity, MUTATOR_ARGV_8_entity) \
809 /**/ o(entity, MUTATOR_ARGV_8_entity) \
810 /** amount */ i(float, MUTATOR_ARGV_9_float) \
811 /**/ o(float, MUTATOR_ARGV_9_float) \
812 /** limit */ i(float, MUTATOR_ARGV_10_float) \
813 /**/ o(float, MUTATOR_ARGV_10_float) \
815 MUTATOR_HOOKABLE(TakeResourceWithLimit, EV_TakeResourceWithLimit);
817 // END Resource hooks
819 /** called at when a player connect */
820 #define EV_ClientConnect(i, o) \
821 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
823 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
825 #define EV_HavocBot_ChooseRole(i, o) \
826 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
828 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
830 /** called when a target is checked for accuracy */
831 #define EV_AccuracyTargetValid(i, o) \
832 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
833 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
835 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
837 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
838 MUT_ACCADD_INVALID, // return this flag to make the function always continue
839 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
842 /** Called when clearing the global parameters for a model */
843 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
845 /** Called when getting the global parameters for a model */
846 #define EV_GetModelParams(i, o) \
847 /** input */ i(string, MUTATOR_ARGV_0_string) \
848 /** command */ i(string, MUTATOR_ARGV_1_string) \
850 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
852 /** called when a bullet has hit a target */
853 #define EV_FireBullet_Hit(i, o) \
854 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
855 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
856 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
857 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
858 /** damage */ i(float, MUTATOR_ARGV_4_float) \
859 /**/ o(float, MUTATOR_ARGV_4_float) \
860 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
862 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
864 #define EV_FixPlayermodel(i, o) \
865 /** model */ i(string, MUTATOR_ARGV_0_string) \
866 /**/ o(string, MUTATOR_ARGV_0_string) \
867 /** skin */ i(int, MUTATOR_ARGV_1_int) \
868 /**/ o(int, MUTATOR_ARGV_1_int) \
869 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
871 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
873 /** Return error to play frag remaining announcements */
874 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
876 #define EV_GrappleHookThink(i, o) \
877 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
878 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
879 /**/ o(int, MUTATOR_ARGV_1_int) \
880 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
881 /**/ o(entity, MUTATOR_ARGV_2_entity) \
882 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
883 /**/ o(float, MUTATOR_ARGV_3_float) \
885 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
887 #define EV_BuffModel_Customize(i, o) \
888 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
889 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
891 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
893 /** called at when a buff is touched. Called early, can edit buff properties. */
894 #define EV_BuffTouch(i, o) \
895 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
896 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
897 /**/ o(entity, MUTATOR_ARGV_1_entity) \
899 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
901 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
903 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
905 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
907 #define EV_GetRecords(i, o) \
908 /** page */ i(int, MUTATOR_ARGV_0_int) \
909 /** record list */ i(string, MUTATOR_ARGV_1_string) \
910 /**/ o(string, MUTATOR_ARGV_1_string) \
912 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
914 #define EV_Race_FinalCheckpoint(i, o) \
915 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
917 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
919 /** called when player triggered kill (or is changing teams), return error to not do anything */
920 #define EV_ClientKill(i, o) \
921 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
922 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
923 /**/ o(float, MUTATOR_ARGV_1_float) \
925 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
927 /** called when player is about to be killed during kill command or changing teams */
928 #define EV_ClientKill_Now(i, o) \
929 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
931 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
933 #define EV_FixClientCvars(i, o) \
934 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
936 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
938 #define EV_SpectateSet(i, o) \
939 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
940 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
941 /**/ o(entity, MUTATOR_ARGV_1_entity) \
943 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
945 #define EV_SpectateNext(i, o) \
946 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
947 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
948 /**/ o(entity, MUTATOR_ARGV_1_entity) \
950 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
952 #define EV_SpectatePrev(i, o) \
953 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
954 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
955 /**/ o(entity, MUTATOR_ARGV_1_entity) \
956 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
958 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
961 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
962 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
963 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
966 /** called when player triggered kill (or is changing teams), return error to not do anything */
967 #define EV_Bot_FixCount(i, o) \
968 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
969 /**/ o(int, MUTATOR_ARGV_0_int) \
970 /** real players */ i(int, MUTATOR_ARGV_1_int) \
971 /**/ o(int, MUTATOR_ARGV_1_int) \
973 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
975 #define EV_ClientCommand_Spectate(i, o) \
976 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
978 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
981 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
982 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
983 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
986 #define EV_CheckRules_World(i, o) \
987 /** status */ i(float, MUTATOR_ARGV_0_float) \
988 /**/ o(float, MUTATOR_ARGV_0_float) \
989 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
990 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
992 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
994 #define EV_WantWeapon(i, o) \
995 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
996 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
997 /**/ o(float, MUTATOR_ARGV_1_float) \
998 /** want all guns */ i(int, MUTATOR_ARGV_2_int) \
999 /**/ o(int, MUTATOR_ARGV_2_int) \
1000 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
1001 /**/ o(bool, MUTATOR_ARGV_3_bool) \
1003 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
1005 #define EV_AddPlayerScore(i, o) \
1006 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1007 /** score */ i(float, MUTATOR_ARGV_1_float) \
1008 /**/ o(float, MUTATOR_ARGV_1_float) \
1009 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1011 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
1013 #define EV_AddedPlayerScore(i, o) \
1014 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
1015 /** score */ i(float, MUTATOR_ARGV_1_float) \
1016 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
1018 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
1020 #define EV_GetPlayerStatus(i, o) \
1021 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1023 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
1025 #define EV_SetWeaponArena(i, o) \
1026 /** arena */ i(string, MUTATOR_ARGV_0_string) \
1027 /**/ o(string, MUTATOR_ARGV_0_string) \
1029 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
1031 #define EV_DropSpecialItems(i, o) \
1032 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
1034 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
1037 * called when an admin tries to kill all monsters
1038 * return 1 to prevent spawning
1040 #define EV_AllowMobButcher(i, o) \
1041 /** reason */ o(string, MUTATOR_ARGV_0_string) \
1043 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
1045 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
1047 #define EV_SendWaypoint(i, o) \
1048 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
1049 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
1050 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
1051 /**/ o(int, MUTATOR_ARGV_2_int) \
1052 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
1053 /**/ o(int, MUTATOR_ARGV_3_int) \
1055 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
1057 #define EV_TurretValidateTarget(i, o) \
1058 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1059 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1060 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
1061 /** target score */ o(float, MUTATOR_ARGV_3_float) \
1063 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
1065 #define EV_TurretThink(i, o) \
1066 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1068 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
1070 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
1073 #define EV_PrepareExplosionByDamage(i, o) \
1074 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
1075 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1077 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1079 /** called when a monster model is about to be set, allows custom paths etc. */
1080 #define EV_MonsterModel(i, o) \
1081 /** model */ i(string, MUTATOR_ARGV_0_string) \
1082 /** output */ i(string, MUTATOR_ARGV_1_string) \
1083 /**/ o(string, MUTATOR_ARGV_1_string) \
1085 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1088 * Called before player changes their team. Return true to block team change.
1090 #define EV_Player_ChangeTeam(i, o) \
1091 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1092 /** current team index */ i(float, MUTATOR_ARGV_1_float) \
1093 /** new team index */ i(float, MUTATOR_ARGV_2_float) \
1095 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1098 * Called after player has changed their team.
1100 #define EV_Player_ChangedTeam(i, o) \
1101 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1102 /** old team index */ i(float, MUTATOR_ARGV_1_float) \
1103 /** current team index */ i(float, MUTATOR_ARGV_2_float) \
1105 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1108 * Called when player is about to be killed when changing teams. Return true to block killing.
1110 #define EV_Player_ChangeTeamKill(i, o) \
1111 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1113 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1116 #define EV_URI_GetCallback(i, o) \
1117 /** id */ i(float, MUTATOR_ARGV_0_float) \
1118 /** status */ i(float, MUTATOR_ARGV_1_float) \
1119 /** data */ i(string, MUTATOR_ARGV_2_string) \
1121 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1124 * return true to lock weapon (can't be used nor changed) for a player
1126 #define EV_LockWeapon(i, o) \
1127 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1129 MUTATOR_HOOKABLE(LockWeapon, EV_LockWeapon);
1132 * return true to prevent weapon use for a player
1134 #define EV_ForbidWeaponUse(i, o) \
1135 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1137 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1139 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1140 #define EV_CopyBody(i, o) \
1141 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1142 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1143 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1145 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1147 /** called when sending a chat message, ret argument can be changed to prevent the message */
1148 #define EV_ChatMessage(i, o) \
1149 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1150 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1151 /**/ o(int, MUTATOR_ARGV_1_int) \
1153 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1155 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1156 #define EV_ChatMessageTo(i, o) \
1157 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1158 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1160 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1163 * return true to restart the server instead of restarting the match, for modes that don't support readyrestart.
1164 * NOTE: ReadyRestart support is mandatory in campaign
1166 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1168 /** called when a fusion reactor is validating its target */
1169 #define EV_FusionReactor_ValidTarget(i, o) \
1170 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1171 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1173 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1176 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1177 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1178 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1181 /** return true to hide the 'teamnumbers are imbalanced' message */
1182 #define EV_HideTeamNagger(i, o) \
1183 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1185 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1187 /** return true to show a waypoint while the item is spawning */
1188 #define EV_Item_ScheduleRespawn(i, o) \
1189 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1190 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1192 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1194 /** called before physics stats are set on a player, allows limited early customization */
1195 #define EV_PlayerPhysics_UpdateStats(i, o) \
1196 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1198 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1200 /** called after physics stats are set on a player, allows post-initialization modifications */
1201 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1202 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1203 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1205 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1207 /** return true to use your own aim target (or none at all) */
1208 #define EV_HavocBot_Aim(i, o) \
1209 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1211 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1213 /** return true to skip respawn time calculations */
1214 #define EV_CalculateRespawnTime(i, o) \
1215 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1217 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1219 /** called when parsing a vote command. */
1220 #define EV_VoteCommand_Parse(i, o) \
1221 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1222 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1223 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1224 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1225 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1227 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1230 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1231 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1232 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1233 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)
1237 * Called when freezing an entity (monster or player), return true to force showing a waypoint
1239 #define EV_Freeze(i, o) \
1240 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1241 /** revive speed */ i(float, MUTATOR_ARGV_1_float) \
1242 /** frozen type */ i(int, MUTATOR_ARGV_2_int) \
1244 MUTATOR_HOOKABLE(Freeze, EV_Freeze);
1247 * Called when an entity (monster or player) is defrosted
1249 #define EV_Unfreeze(i, o) \
1250 /** targ */ i(entity, MUTATOR_ARGV_0_entity) \
1252 MUTATOR_HOOKABLE(Unfreeze, EV_Unfreeze);
1255 * Called when a player is trying to join, argument is the number of players allowed to join the match
1257 #define EV_GetPlayerLimit(i, o) \
1258 /** g_maxplayers */ i(int, MUTATOR_ARGV_0_int) \
1259 /**/ o(int, MUTATOR_ARGV_0_int) \
1261 MUTATOR_HOOKABLE(GetPlayerLimit, EV_GetPlayerLimit);
1263 /** include special item codes for a death to the game log */
1264 #define EV_LogDeath_AppendItemCodes(i, o) \
1265 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1266 /** item codes */ i(string, MUTATOR_ARGV_1_string) \
1267 /**/ o(string, MUTATOR_ARGV_1_string) \
1269 MUTATOR_HOOKABLE(LogDeath_AppendItemCodes, EV_LogDeath_AppendItemCodes);
1271 /** Allows disabling or enabling rocket jumping independently of balance, use the parameter to force a preferred setting */
1272 #define EV_AllowRocketJumping(i, o) \
1273 /** allow_rocketjump */ i(bool, MUTATOR_ARGV_0_bool) \
1274 /**/ o(bool, MUTATOR_ARGV_0_bool) \
1276 MUTATOR_HOOKABLE(AllowRocketJumping, EV_AllowRocketJumping);
1278 /** Called when weapons are performing their attack, useful for applying bonus attack sounds */
1279 #define EV_W_PlayStrengthSound(i, o) \
1280 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1282 MUTATOR_HOOKABLE(W_PlayStrengthSound, EV_W_PlayStrengthSound);