3 #include <common/mutators/base.qh>
5 // register all possible hooks here
7 // to use a hook, first register your mutator using REGISTER_MUTATOR
8 // then create your function using MUTATOR_HOOKFUNCTION
10 /** called when a player becomes observer, after shared setup */
11 #define EV_MakePlayerObserver(i, o) \
12 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
14 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
17 #define EV_PutClientInServer(i, o) \
18 /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
20 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
23 * return true to prevent a spectator/observer to spawn as player
25 #define EV_ForbidSpawn(i, o) \
26 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
28 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
30 /** returns true if client should be put as player on connection */
31 #define EV_AutoJoinOnConnection(i, o) \
32 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
34 MUTATOR_HOOKABLE(AutoJoinOnConnection, EV_AutoJoinOnConnection);
36 /** called when player spawns to determine whether to give them random start weapons. Return true to forbid giving them. */
37 #define EV_ForbidRandomStartWeapons(i, o) \
38 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
40 MUTATOR_HOOKABLE(ForbidRandomStartWeapons, EV_ForbidRandomStartWeapons);
42 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
43 #define EV_PlayerSpawn(i, o) \
44 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
45 /** spot that was used, or NULL */ i(entity, MUTATOR_ARGV_1_entity) \
47 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
49 /** called after a player's weapon is chosen so it can be overriden here */
50 #define EV_PlayerWeaponSelect(i, o) \
51 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
53 MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
55 /** called in reset_map */
56 #define EV_reset_map_global(i, o) \
58 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
60 /** called in reset_map */
61 #define EV_reset_map_players(i, o) \
63 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
65 /** returns 1 if clearing player score shall not be allowed */
66 #define EV_ForbidPlayerScore_Clear(i, o) \
68 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
70 /** called when a player disconnects */
71 #define EV_ClientDisconnect(i, o) \
72 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
74 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
76 /** called when a player dies to e.g. remove stuff he was carrying. */
77 #define EV_PlayerDies(i, o) \
78 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
79 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
80 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
81 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
82 /** damage */ i(float, MUTATOR_ARGV_4_float) \
83 /** damage */ o(float, MUTATOR_ARGV_4_float) \
85 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
87 /** called after a player died. */
88 #define EV_PlayerDied(i, o) \
89 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
91 MUTATOR_HOOKABLE(PlayerDied, EV_PlayerDied);
93 /** allows overriding the frag centerprint messages */
94 #define EV_FragCenterMessage(i, o) \
95 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
96 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
97 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
98 /** attacker kcount*/ i(int, MUTATOR_ARGV_3_int) \
99 /** targ killcount */ i(int, MUTATOR_ARGV_4_int) \
101 MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage);
103 /** called when a player dies to e.g. remove stuff he was carrying */
104 #define EV_PlayHitsound(i, o) \
105 /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
106 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
108 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
110 /** called when an item model is about to be set, allows custom paths etc. */
111 #define EV_ItemModel(i, o) \
112 /** model */ i(string, MUTATOR_ARGV_0_string) \
113 /** output */ i(string, MUTATOR_ARGV_1_string) \
114 /**/ o(string, MUTATOR_ARGV_1_string) \
116 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
118 /** called when an item sound is about to be played, allows custom paths etc. */
119 #define EV_ItemSound(i, o) \
120 /** sound */ i(string, MUTATOR_ARGV_0_string) \
121 /** output */ i(string, MUTATOR_ARGV_1_string) \
122 /**/ o(string, MUTATOR_ARGV_1_string) \
124 MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
126 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
127 #define EV_GiveFragsForKill(i, o) \
128 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
129 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
130 /** frag score */ i(float, MUTATOR_ARGV_2_float) \
131 /** */ o(float, MUTATOR_ARGV_2_float) \
132 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
133 /** wep entity */ i(entity, MUTATOR_ARGV_4_entity) \
135 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
137 /** called when the match ends */
138 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
140 /** allows adjusting allowed teams */
141 #define EV_CheckAllowedTeams(i, o) \
142 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
143 /**/ o(float, MUTATOR_ARGV_0_float) \
144 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
145 /**/ o(string, MUTATOR_ARGV_1_string) \
146 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
148 MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
150 /** return true to manually override team counts */
151 MUTATOR_HOOKABLE(GetTeamCounts, EV_NO_ARGS);
153 /** allow overriding of team counts */
154 #define EV_GetTeamCount(i, o) \
155 /** team to count */ i(float, MUTATOR_ARGV_0_float) \
156 /** player to ignore */ i(entity, MUTATOR_ARGV_1_entity) \
157 /** number of players in a team */ i(float, MUTATOR_ARGV_2_float) \
158 /**/ o(float, MUTATOR_ARGV_2_float) \
159 /** number of bots in a team */ i(float, MUTATOR_ARGV_3_float) \
160 /**/ o(float, MUTATOR_ARGV_3_float) \
161 /** lowest scoring human in a team */ i(entity, MUTATOR_ARGV_4_entity) \
162 /**/ o(entity, MUTATOR_ARGV_4_entity) \
163 /** lowest scoring bot in a team */ i(entity, MUTATOR_ARGV_5_entity) \
164 /**/ o(entity, MUTATOR_ARGV_5_entity) \
166 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
168 /** allows overriding best teams */
169 #define EV_FindBestTeams(i, o) \
170 /** player checked */ i(entity, MUTATOR_ARGV_0_entity) \
171 /** bitmask of teams */ o(float, MUTATOR_ARGV_1_float) \
173 MUTATOR_HOOKABLE(FindBestTeams, EV_FindBestTeams);
175 /** copies variables for spectating "spectatee" to "this" */
176 #define EV_SpectateCopy(i, o) \
177 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
178 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
180 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
182 /** called when formatting a chat message to replace fancy functions */
183 #define EV_FormatMessage(i, o) \
184 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
185 /** escape */ i(string, MUTATOR_ARGV_1_string) \
186 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
187 /**/ o(string, MUTATOR_ARGV_2_string) \
188 /** message */ i(string, MUTATOR_ARGV_3_string) \
190 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
192 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
193 #define EV_PreFormatMessage(i, o) \
194 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
195 /** message */ i(string, MUTATOR_ARGV_1_string) \
196 /**/ o(string, MUTATOR_ARGV_1_string) \
198 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
200 /** returns true if throwing the current weapon shall not be allowed */
201 #define EV_ForbidThrowCurrentWeapon(i, o) \
202 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
203 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
205 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
207 /** returns true if dropping the current weapon shall not be allowed at any time including death */
208 #define EV_ForbidDropCurrentWeapon(i, o) \
209 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
210 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
212 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
215 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
217 /** allows changing attack rate */
218 #define EV_WeaponRateFactor(i, o) \
219 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
220 /**/ o(float, MUTATOR_ARGV_0_float) \
221 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
223 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
225 /** allows changing weapon speed (projectiles mostly) */
226 #define EV_WeaponSpeedFactor(i, o) \
227 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
228 /**/ o(float, MUTATOR_ARGV_0_float) \
229 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
231 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
233 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
234 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
236 /** called every frame. customizes the waypoint for spectators */
237 #define EV_CustomizeWaypoint(i, o) \
238 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
239 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
241 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
243 /** Check if items having the given definition are allowed to spawn.
244 * Return true to disallow spawning.
246 #define EV_FilterItemDefinition(i, o) \
247 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
249 MUTATOR_HOOKABLE(FilterItemDefinition, EV_FilterItemDefinition);
252 * checks if the current item may be spawned (.items may be read and written to, as well as the ammo_ fields)
253 * return error to request removal
255 #define EV_FilterItem(i, o) \
256 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
258 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
260 /** return error to request removal */
261 #define EV_TurretSpawn(i, o) \
262 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
264 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
266 /** return error to not attack */
267 #define EV_TurretFire(i, o) \
268 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
270 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
272 /** return error to not attack */
273 #define EV_Turret_CheckFire(i, o) \
274 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
275 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
277 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
279 /** return error to prevent entity spawn, or modify the entity */
280 #define EV_OnEntityPreSpawn(i, o) \
281 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
283 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
285 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
286 #define EV_PlayerPreThink(i, o) \
287 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
289 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
291 /** TODO change this into a general PlayerPostThink hook? */
292 #define EV_GetPressedKeys(i, o) \
293 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
295 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
297 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
298 #define EV_GetCvars(i, o) \
299 /**/ i(float, get_cvars_f) \
300 /**/ i(string, get_cvars_s) \
304 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
306 /** can edit any "just fired" projectile */
307 #define EV_EditProjectile(i, o) \
308 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
309 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
311 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
313 /** called when a monster spawns */
314 #define EV_MonsterSpawn(i, o) \
315 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
317 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
319 /** called when a monster dies */
320 #define EV_MonsterDies(i, o) \
321 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
322 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
323 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
325 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
327 /** called when a monster dies */
328 #define EV_MonsterRemove(i, o) \
329 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
331 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
333 /** called when a monster wants to respawn */
334 #define EV_MonsterRespawn(i, o) \
335 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
337 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
339 /** called when a monster is dropping loot */
340 #define EV_MonsterDropItem(i, o) \
341 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
342 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
343 /**/ o(entity, MUTATOR_ARGV_1_entity) \
344 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
346 .entity monster_loot;
347 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
350 * called when a monster moves
351 * returning true makes the monster stop
353 #define EV_MonsterMove(i, o) \
354 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
355 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
356 /**/ o(float, MUTATOR_ARGV_1_float) \
357 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
358 /**/ o(float, MUTATOR_ARGV_2_float) \
359 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
360 /**/ o(entity, MUTATOR_ARGV_3_entity) \
362 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
364 /** called when a monster looks for another target */
365 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
368 * called when validating a monster's target
370 #define EV_MonsterValidTarget(i, o) \
371 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
372 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
374 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
376 /** called to change a random monster to a miniboss */
377 #define EV_MonsterCheckBossFlag(i, o) \
378 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
380 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
383 * called when a player tries to spawn a monster
384 * return 1 to prevent spawning
385 * NOTE: requires reason if disallowed
387 #define EV_AllowMobSpawning(i, o) \
388 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
389 /** reason */ o(string, MUTATOR_ARGV_1_string) \
391 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
393 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
394 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
395 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
396 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
397 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
398 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
399 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
400 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
401 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
402 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
403 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
404 /** damage */ i(float, MUTATOR_ARGV_7_float) \
406 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
409 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
410 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
412 #define EV_Damage_Calculate(i, o) \
413 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
414 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
415 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
416 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
417 /** damage */ i(float, MUTATOR_ARGV_4_float) \
418 /** damage */ o(float, MUTATOR_ARGV_4_float) \
419 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
420 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
421 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
422 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
423 /** weapon entity */ i(entity, MUTATOR_ARGV_7_entity) \
425 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
428 * Called when a player is damaged
430 #define EV_PlayerDamaged(i, o) \
431 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
432 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
433 /** health */ i(float, MUTATOR_ARGV_2_float) \
434 /** armor */ i(float, MUTATOR_ARGV_3_float) \
435 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
436 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
437 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
439 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
442 * Called by W_DecreaseAmmo
444 #define EV_W_DecreaseAmmo(i, o) \
445 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
446 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
447 /** ammo to take */ i(float, MUTATOR_ARGV_2_float) \
448 /**/ o(float, MUTATOR_ARGV_2_float) \
450 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
455 #define EV_W_Reload(i, o) \
456 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
458 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
460 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
461 #define EV_PlayerPowerups(i, o) \
462 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
463 /** old items */ i(int, MUTATOR_ARGV_1_int) \
465 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
468 * called every player think frame
469 * return 1 to disable regen
471 #define EV_PlayerRegen(i, o) \
472 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
473 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
474 /**/ o(float, MUTATOR_ARGV_1_float) \
475 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
476 /**/ o(float, MUTATOR_ARGV_2_float) \
477 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
478 /**/ o(float, MUTATOR_ARGV_3_float) \
479 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
480 /**/ o(float, MUTATOR_ARGV_4_float) \
481 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
482 /**/ o(float, MUTATOR_ARGV_5_float) \
483 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
484 /**/ o(float, MUTATOR_ARGV_6_float) \
485 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
486 /**/ o(float, MUTATOR_ARGV_7_float) \
487 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
488 /**/ o(float, MUTATOR_ARGV_8_float) \
489 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
490 /**/ o(float, MUTATOR_ARGV_9_float) \
491 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
492 /**/ o(float, MUTATOR_ARGV_10_float) \
494 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
497 * called when the use key is pressed
498 * if MUTATOR_RETURNVALUE is 1, don't do anything
499 * return 1 if the use key actually did something
501 #define EV_PlayerUseKey(i, o) \
502 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
504 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
507 * called when a client command is parsed
508 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
509 * NOTE: return true if you handled the command, return false to continue handling
510 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
512 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
514 * if (MUTATOR_RETURNVALUE) // command was already handled?
516 * if (cmd_name == "echocvar" && cmd_argc >= 2)
518 * print(cvar_string(argv(1)), "\n");
521 * if (cmd_name == "echostring" && cmd_argc >= 2)
523 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
529 #define EV_SV_ParseClientCommand(i, o) \
530 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
531 /** command name */ i(string, MUTATOR_ARGV_1_string) \
532 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
533 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
535 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
537 /** please read EV_SV_ParseClientCommand description before using */
538 #define EV_SV_ParseServerCommand(i, o) \
539 /** command name */ i(string, MUTATOR_ARGV_0_string) \
540 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
541 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
543 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
546 * called when a spawnpoint is being evaluated
547 * return 1 to make the spawnpoint unusable
549 #define EV_Spawn_Score(i, o) \
550 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
551 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
552 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
553 /**/ o(vector, MUTATOR_ARGV_2_vector) \
555 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
557 /** runs globally each server frame */
558 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
560 #define EV_SetModname(i, o) \
561 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
562 /**/ i(string, MUTATOR_ARGV_0_string) \
563 /**/ o(string, MUTATOR_ARGV_0_string) \
565 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
568 * called for each item being spawned on a map, including dropped weapons
569 * return 1 to remove an item
571 #define EV_Item_Spawn(i, o) \
572 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
574 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
576 #define EV_SetWeaponreplace(i, o) \
577 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
578 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
579 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
580 /**/ o(string, MUTATOR_ARGV_2_string) \
582 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
584 /** called when an item is about to respawn */
585 #define EV_Item_RespawnCountdown(i, o) \
586 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
588 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
590 /** called when a bot checks a target to attack */
591 #define EV_BotShouldAttack(i, o) \
592 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
593 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
595 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
598 * called whenever a player goes through a portal gun teleport
599 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
601 #define EV_PortalTeleport(i, o) \
602 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
604 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
607 * called whenever a player uses impulse 33 (help me) in impulse.qc
608 * normally help me ping uses .waypointsprite_attachedforcarrier,
609 * but if your mutator uses something different then you can handle it
610 * in a special manner using this hook
612 #define EV_HelpMePing(i, o) \
613 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
615 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
618 * called when a vehicle initializes
619 * return true to remove the vehicle
621 #define EV_VehicleInit(i, o) \
622 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
624 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
627 * called when a player enters a vehicle
628 * allows mutators to set special settings in this event
630 #define EV_VehicleEnter(i, o) \
631 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
632 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
634 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
637 * called when a player touches a vehicle
638 * return true to stop player from entering the vehicle
640 #define EV_VehicleTouch(i, o) \
641 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
642 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
644 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
647 * called when a player exits a vehicle
648 * allows mutators to set special settings in this event
650 #define EV_VehicleExit(i, o) \
651 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
652 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
654 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
656 /** called when a speedrun is aborted and the player is teleported back to start position */
657 #define EV_AbortSpeedrun(i, o) \
658 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
660 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
662 /** called at when a item is touched. Called early, can edit item properties. */
663 #define EV_ItemTouch(i, o) \
664 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
665 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
666 /**/ o(entity, MUTATOR_ARGV_1_entity) \
668 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
671 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
672 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
673 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
676 /** called after the item has been touched. */
677 #define EV_ItemTouched(i, o) \
678 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
679 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
681 MUTATOR_HOOKABLE(ItemTouched, EV_ItemTouched);
683 /** Called when the amount of entity resources changes. Can be used to override
685 #define EV_GetResourceLimit(i, o) \
686 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
687 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
688 /** limit */ i(float, MUTATOR_ARGV_2_float) \
689 /**/ o(float, MUTATOR_ARGV_2_float) \
691 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
693 /** Called when the amount of resource of an entity changes. See RESOURCE_*
694 constants for resource types. Return true to forbid the change. */
695 #define EV_SetResourceAmount(i, o) \
696 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
697 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
698 /**/ o(int, MUTATOR_ARGV_1_int) \
699 /** amount */ i(float, MUTATOR_ARGV_2_float) \
700 /**/ o(float, MUTATOR_ARGV_2_float) \
702 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
704 /** Called after the amount of resource of an entity has changed. See RESOURCE_*
705 constants for resource types. Amount wasted is the amount of resource that is
706 above resource limit so it was not given. */
707 #define EV_ResourceAmountChanged(i, o) \
708 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
709 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
710 /** amount */ i(float, MUTATOR_ARGV_2_float) \
712 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
714 /** Called when there was an attempt to set entity resources higher than their
715 limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
716 of resource that is above resource limit so it was not given. */
717 #define EV_ResourceWasted(i, o) \
718 /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
719 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
720 /** amount wasted */ i(float, MUTATOR_ARGV_2_float) \
722 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
724 /** Called when entity is being given some resource. See RESOURCE_* constants
725 for resource types. Return true to forbid giving. */
726 #define EV_GiveResource(i, o) \
727 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
728 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
729 /**/ o(int, MUTATOR_ARGV_1_int) \
730 /** amount */ i(float, MUTATOR_ARGV_2_float) \
731 /**/ o(float, MUTATOR_ARGV_2_float) \
733 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
735 /** Called when entity is being given some resource with specified limit. See
736 RESOURCE_* constants for resource types. Return true to forbid giving. */
737 #define EV_GiveResourceWithLimit(i, o) \
738 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
739 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
740 /**/ o(int, MUTATOR_ARGV_1_int) \
741 /** amount */ i(float, MUTATOR_ARGV_2_float) \
742 /**/ o(float, MUTATOR_ARGV_2_float) \
743 /** limit */ i(float, MUTATOR_ARGV_3_float) \
744 /**/ o(float, MUTATOR_ARGV_3_float) \
746 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
748 /** Called when some resource is being taken from an entity. See RESOURCE_* constants
749 for resource types. Return true to forbid giving. */
750 #define EV_TakeResource(i, o) \
751 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
752 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
753 /**/ o(int, MUTATOR_ARGV_1_int) \
754 /** amount */ i(float, MUTATOR_ARGV_2_float) \
755 /**/ o(float, MUTATOR_ARGV_2_float) \
757 MUTATOR_HOOKABLE(TakeResource, EV_TakeResource);
759 /** Called when some resource is being taken from an entity, with a limit. See
760 RESOURCE_* constants for resource types. Return true to forbid giving. */
761 #define EV_TakeResourceWithLimit(i, o) \
762 /** receiver */ i(entity, MUTATOR_ARGV_0_entity) \
763 /** resource type */ i(int, MUTATOR_ARGV_1_int) \
764 /**/ o(int, MUTATOR_ARGV_1_int) \
765 /** amount */ i(float, MUTATOR_ARGV_2_float) \
766 /**/ o(float, MUTATOR_ARGV_2_float) \
767 /** limit */ i(float, MUTATOR_ARGV_3_float) \
768 /**/ o(float, MUTATOR_ARGV_3_float) \
770 MUTATOR_HOOKABLE(TakeResourceWithLimit, EV_TakeResourceWithLimit);
772 /** called at when a player connect */
773 #define EV_ClientConnect(i, o) \
774 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
776 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
778 #define EV_HavocBot_ChooseRole(i, o) \
779 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
781 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
783 /** called when a target is checked for accuracy */
784 #define EV_AccuracyTargetValid(i, o) \
785 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
786 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
788 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
790 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
791 MUT_ACCADD_INVALID, // return this flag to make the function always continue
792 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
795 /** Called when clearing the global parameters for a model */
796 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
798 /** Called when getting the global parameters for a model */
799 #define EV_GetModelParams(i, o) \
800 /** input */ i(string, MUTATOR_ARGV_0_string) \
801 /** command */ i(string, MUTATOR_ARGV_1_string) \
803 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
805 /** called when a bullet has hit a target */
806 #define EV_FireBullet_Hit(i, o) \
807 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
808 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
809 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
810 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
811 /** damage */ i(float, MUTATOR_ARGV_4_float) \
812 /**/ o(float, MUTATOR_ARGV_4_float) \
813 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
815 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
817 #define EV_FixPlayermodel(i, o) \
818 /** model */ i(string, MUTATOR_ARGV_0_string) \
819 /**/ o(string, MUTATOR_ARGV_0_string) \
820 /** skin */ i(int, MUTATOR_ARGV_1_int) \
821 /**/ o(int, MUTATOR_ARGV_1_int) \
822 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
824 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
826 /** Return error to play frag remaining announcements */
827 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
829 #define EV_GrappleHookThink(i, o) \
830 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
831 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
832 /**/ o(int, MUTATOR_ARGV_1_int) \
833 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
834 /**/ o(entity, MUTATOR_ARGV_2_entity) \
835 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
836 /**/ o(float, MUTATOR_ARGV_3_float) \
838 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
840 #define EV_BuffModel_Customize(i, o) \
841 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
842 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
844 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
846 /** called at when a buff is touched. Called early, can edit buff properties. */
847 #define EV_BuffTouch(i, o) \
848 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
849 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
850 /**/ o(entity, MUTATOR_ARGV_1_entity) \
852 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
854 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
856 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
858 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
860 #define EV_GetRecords(i, o) \
861 /** page */ i(int, MUTATOR_ARGV_0_int) \
862 /** record list */ i(string, MUTATOR_ARGV_1_string) \
863 /**/ o(string, MUTATOR_ARGV_1_string) \
865 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
867 #define EV_Race_FinalCheckpoint(i, o) \
868 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
870 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
872 /** called when player triggered kill (or is changing teams), return error to not do anything */
873 #define EV_ClientKill(i, o) \
874 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
875 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
876 /**/ o(float, MUTATOR_ARGV_1_float) \
878 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
880 /** called when player is about to be killed during kill command or changing teams */
881 #define EV_ClientKill_Now(i, o) \
882 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
884 MUTATOR_HOOKABLE(ClientKill_Now, EV_ClientKill_Now);
886 #define EV_FixClientCvars(i, o) \
887 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
889 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
891 #define EV_SpectateSet(i, o) \
892 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
893 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
894 /**/ o(entity, MUTATOR_ARGV_1_entity) \
896 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
898 #define EV_SpectateNext(i, o) \
899 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
900 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
901 /**/ o(entity, MUTATOR_ARGV_1_entity) \
903 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
905 #define EV_SpectatePrev(i, o) \
906 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
907 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
908 /**/ o(entity, MUTATOR_ARGV_1_entity) \
909 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
911 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
914 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
915 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
916 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
919 /** called when player triggered kill (or is changing teams), return error to not do anything */
920 #define EV_Bot_FixCount(i, o) \
921 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
922 /**/ o(int, MUTATOR_ARGV_0_int) \
923 /** real players */ i(int, MUTATOR_ARGV_1_int) \
924 /**/ o(int, MUTATOR_ARGV_1_int) \
926 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
928 #define EV_ClientCommand_Spectate(i, o) \
929 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
931 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
934 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
935 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
936 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
939 #define EV_CheckRules_World(i, o) \
940 /** status */ i(float, MUTATOR_ARGV_0_float) \
941 /**/ o(float, MUTATOR_ARGV_0_float) \
942 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
943 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
945 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
947 #define EV_WantWeapon(i, o) \
948 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
949 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
950 /**/ o(float, MUTATOR_ARGV_1_float) \
951 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
952 /**/ o(bool, MUTATOR_ARGV_2_bool) \
953 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
954 /**/ o(bool, MUTATOR_ARGV_3_bool) \
956 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
958 #define EV_AddPlayerScore(i, o) \
959 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
960 /** score */ i(float, MUTATOR_ARGV_1_float) \
961 /**/ o(float, MUTATOR_ARGV_1_float) \
962 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
964 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
966 #define EV_AddedPlayerScore(i, o) \
967 /** score field */ i(entity, MUTATOR_ARGV_0_entity) \
968 /** score */ i(float, MUTATOR_ARGV_1_float) \
969 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
971 MUTATOR_HOOKABLE(AddedPlayerScore, EV_AddPlayerScore);
973 #define EV_GetPlayerStatus(i, o) \
974 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
976 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
978 #define EV_SetWeaponArena(i, o) \
979 /** arena */ i(string, MUTATOR_ARGV_0_string) \
980 /**/ o(string, MUTATOR_ARGV_0_string) \
982 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
984 #define EV_DropSpecialItems(i, o) \
985 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
987 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
990 * called when an admin tries to kill all monsters
991 * return 1 to prevent spawning
993 #define EV_AllowMobButcher(i, o) \
994 /** reason */ o(string, MUTATOR_ARGV_0_string) \
996 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
998 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
1000 #define EV_SendWaypoint(i, o) \
1001 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
1002 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
1003 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
1004 /**/ o(int, MUTATOR_ARGV_2_int) \
1005 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
1006 /**/ o(int, MUTATOR_ARGV_3_int) \
1008 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
1010 #define EV_TurretValidateTarget(i, o) \
1011 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1012 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1013 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
1014 /** target score */ o(float, MUTATOR_ARGV_3_float) \
1016 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
1018 #define EV_TurretThink(i, o) \
1019 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1021 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
1023 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
1026 #define EV_PrepareExplosionByDamage(i, o) \
1027 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
1028 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
1030 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
1032 /** called when a monster model is about to be set, allows custom paths etc. */
1033 #define EV_MonsterModel(i, o) \
1034 /** model */ i(string, MUTATOR_ARGV_0_string) \
1035 /** output */ i(string, MUTATOR_ARGV_1_string) \
1036 /**/ o(string, MUTATOR_ARGV_1_string) \
1038 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
1041 * Called before player changes their team. Return true to block team change.
1043 #define EV_Player_ChangeTeam(i, o) \
1044 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1045 /** current team */ i(float, MUTATOR_ARGV_1_float) \
1046 /** new team */ i(float, MUTATOR_ARGV_2_float) \
1048 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
1051 * Called after player has changed their team.
1053 #define EV_Player_ChangedTeam(i, o) \
1054 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1055 /** old team */ i(float, MUTATOR_ARGV_1_float) \
1056 /** current team */ i(float, MUTATOR_ARGV_2_float) \
1058 MUTATOR_HOOKABLE(Player_ChangedTeam, EV_Player_ChangedTeam);
1061 * Called when player is about to be killed when changing teams. Return true to block killing.
1063 #define EV_Player_ChangeTeamKill(i, o) \
1064 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1066 MUTATOR_HOOKABLE(Player_ChangeTeamKill, EV_Player_ChangeTeamKill);
1069 #define EV_URI_GetCallback(i, o) \
1070 /** id */ i(float, MUTATOR_ARGV_0_float) \
1071 /** status */ i(float, MUTATOR_ARGV_1_float) \
1072 /** data */ i(string, MUTATOR_ARGV_2_string) \
1074 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
1077 * return true to prevent weapon use for a player
1079 #define EV_ForbidWeaponUse(i, o) \
1080 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1082 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
1084 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
1085 #define EV_CopyBody(i, o) \
1086 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1087 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
1088 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
1090 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
1092 /** called when sending a chat message, ret argument can be changed to prevent the message */
1093 #define EV_ChatMessage(i, o) \
1094 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
1095 /** ret */ i(int, MUTATOR_ARGV_1_int) \
1096 /**/ o(int, MUTATOR_ARGV_1_int) \
1098 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
1100 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
1101 #define EV_ChatMessageTo(i, o) \
1102 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
1103 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
1105 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
1107 /** return true to just restart the match, for modes that don't support readyrestart */
1108 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
1110 /** called when a fusion reactor is validating its target */
1111 #define EV_FusionReactor_ValidTarget(i, o) \
1112 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
1113 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
1115 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
1118 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
1119 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
1120 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
1123 /** return true to hide the 'teamnumbers are imbalanced' message */
1124 #define EV_HideTeamNagger(i, o) \
1125 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1127 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
1129 /** return true to show a waypoint while the item is spawning */
1130 #define EV_Item_ScheduleRespawn(i, o) \
1131 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
1132 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
1134 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
1136 /** called before physics stats are set on a player, allows limited early customization */
1137 #define EV_PlayerPhysics_UpdateStats(i, o) \
1138 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1140 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
1142 /** called after physics stats are set on a player, allows post-initialization modifications */
1143 #define EV_PlayerPhysics_PostUpdateStats(i, o) \
1144 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1145 /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
1147 MUTATOR_HOOKABLE(PlayerPhysics_PostUpdateStats, EV_PlayerPhysics_PostUpdateStats);
1149 /** return true to use your own aim target (or none at all) */
1150 #define EV_HavocBot_Aim(i, o) \
1151 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
1153 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);
1155 /** return true to skip respawn time calculations */
1156 #define EV_CalculateRespawnTime(i, o) \
1157 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
1159 MUTATOR_HOOKABLE(CalculateRespawnTime, EV_CalculateRespawnTime);
1161 /** called when parsing a vote command. */
1162 #define EV_VoteCommand_Parse(i, o) \
1163 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
1164 /** first command */ i(string, MUTATOR_ARGV_1_string) \
1165 /** vote command */ i(string, MUTATOR_ARGV_2_string) \
1166 /** start position of vote command */ i(float, MUTATOR_ARGV_3_float) \
1167 /** argument count */ i(float, MUTATOR_ARGV_4_float) \
1169 MUTATOR_HOOKABLE(VoteCommand_Parse, EV_VoteCommand_Parse);
1172 MUT_VOTEPARSE_CONTINUE, // return this flag to make the function continue as normal
1173 MUT_VOTEPARSE_SUCCESS, // return 1 (vote parsed)
1174 MUT_VOTEPARSE_INVALID, // return -1 (vote parsed but counted as invalid, no action or vote)
1175 MUT_VOTEPARSE_UNACCEPTABLE // return 0 (vote parameter counted as unacceptable, warns caller)