3 #include <common/mutators/base.qh>
5 // register all possible hooks here
7 /** called when a player becomes observer, after shared setup */
8 #define EV_MakePlayerObserver(i, o) \
9 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
11 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
14 #define EV_PutClientInServer(i, o) \
15 /** client wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
17 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
20 * return true to prevent a spectator/observer to spawn as player
22 #define EV_ForbidSpawn(i, o) \
23 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
25 MUTATOR_HOOKABLE(ForbidSpawn, EV_ForbidSpawn);
27 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
28 #define EV_PlayerSpawn(i, o) \
29 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
30 /** spot that was used, or NULL */ i(entity, MUTATOR_ARGV_1_entity) \
32 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
34 /** called after a player's weapon is chosen so it can be overriden here */
35 #define EV_PlayerWeaponSelect(i, o) \
36 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
38 MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
40 /** called in reset_map */
41 #define EV_reset_map_global(i, o) \
43 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
45 /** called in reset_map */
46 #define EV_reset_map_players(i, o) \
48 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
50 /** returns 1 if clearing player score shall not be allowed */
51 #define EV_ForbidPlayerScore_Clear(i, o) \
53 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
55 /** called when a player disconnects */
56 #define EV_ClientDisconnect(i, o) \
57 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
59 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
61 /** called when a player dies to e.g. remove stuff he was carrying. */
62 #define EV_PlayerDies(i, o) \
63 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
64 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
65 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
66 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
67 /** damage */ i(float, MUTATOR_ARGV_4_float) \
68 /** damage */ o(float, MUTATOR_ARGV_4_float) \
70 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
72 /** called after a player died. */
73 #define EV_PlayerDied(i, o) \
74 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
76 MUTATOR_HOOKABLE(PlayerDied, EV_PlayerDied);
78 /** allows overriding the frag centerprint messages */
79 #define EV_FragCenterMessage(i, o) \
80 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
81 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
82 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
83 /** attacker kcount*/ i(int, MUTATOR_ARGV_3_int) \
84 /** targ killcount */ i(int, MUTATOR_ARGV_4_int) \
86 MUTATOR_HOOKABLE(FragCenterMessage, EV_FragCenterMessage);
88 /** called when a player dies to e.g. remove stuff he was carrying */
89 #define EV_PlayHitsound(i, o) \
90 /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
91 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
93 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
95 /** called when a weapon sound is about to be played, allows custom paths etc. */
96 #define EV_WeaponSound(i, o) \
97 /** sound */ i(string, MUTATOR_ARGV_0_string) \
98 /** output */ i(string, MUTATOR_ARGV_1_string) \
99 /**/ o(string, MUTATOR_ARGV_1_string) \
101 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
103 /** called when an item model is about to be set, allows custom paths etc. */
104 #define EV_ItemModel(i, o) \
105 /** model */ i(string, MUTATOR_ARGV_0_string) \
106 /** output */ i(string, MUTATOR_ARGV_1_string) \
107 /**/ o(string, MUTATOR_ARGV_1_string) \
109 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
111 /** called when an item sound is about to be played, allows custom paths etc. */
112 #define EV_ItemSound(i, o) \
113 /** sound */ i(string, MUTATOR_ARGV_0_string) \
114 /** output */ i(string, MUTATOR_ARGV_1_string) \
115 /**/ o(string, MUTATOR_ARGV_1_string) \
117 MUTATOR_HOOKABLE(ItemSound, EV_ItemSound);
119 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
120 #define EV_GiveFragsForKill(i, o) \
121 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
122 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
123 /** frag score */ i(float, MUTATOR_ARGV_2_float) \
124 /** */ o(float, MUTATOR_ARGV_2_float) \
126 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
128 /** called when the match ends */
129 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
131 /** allows adjusting allowed teams */
132 #define EV_CheckAllowedTeams(i, o) \
133 /** mask of teams */ i(float, MUTATOR_ARGV_0_float) \
134 /**/ o(float, MUTATOR_ARGV_0_float) \
135 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
136 /**/ o(string, MUTATOR_ARGV_1_string) \
137 /** player checked */ i(entity, MUTATOR_ARGV_2_entity) \
139 MUTATOR_HOOKABLE(CheckAllowedTeams, EV_CheckAllowedTeams);
141 /** copies variables for spectating "spectatee" to "this" */
142 #define EV_SpectateCopy(i, o) \
143 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
144 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
146 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
148 /** called when formatting a chat message to replace fancy functions */
149 #define EV_FormatMessage(i, o) \
150 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
151 /** escape */ i(string, MUTATOR_ARGV_1_string) \
152 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
153 /**/ o(string, MUTATOR_ARGV_2_string) \
154 /** message */ i(string, MUTATOR_ARGV_3_string) \
156 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
158 /** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
159 #define EV_PreFormatMessage(i, o) \
160 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
161 /** message */ i(string, MUTATOR_ARGV_1_string) \
162 /**/ o(string, MUTATOR_ARGV_1_string) \
164 MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
166 /** returns true if throwing the current weapon shall not be allowed */
167 #define EV_ForbidThrowCurrentWeapon(i, o) \
168 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
169 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
171 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
173 /** returns true if dropping the current weapon shall not be allowed at any time including death */
174 #define EV_ForbidDropCurrentWeapon(i, o) \
175 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
176 /** weapon id */ i(int, MUTATOR_ARGV_1_int) \
178 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
181 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
183 /** allows changing attack rate */
184 #define EV_WeaponRateFactor(i, o) \
185 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
186 /**/ o(float, MUTATOR_ARGV_0_float) \
187 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
189 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
191 /** allows changing weapon speed (projectiles mostly) */
192 #define EV_WeaponSpeedFactor(i, o) \
193 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
194 /**/ o(float, MUTATOR_ARGV_0_float) \
195 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
197 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
199 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
200 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
202 /** called every frame. customizes the waypoint for spectators */
203 #define EV_CustomizeWaypoint(i, o) \
204 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
205 /** player; other.enemy = spectator */ i(entity, MUTATOR_ARGV_1_entity) \
207 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
210 * checks if the current item may be spawned (.items and .weapons may be read and written to, as well as the ammo_ fields)
211 * return error to request removal
213 #define EV_FilterItem(i, o) \
214 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
216 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
218 /** return error to request removal */
219 #define EV_TurretSpawn(i, o) \
220 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
222 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
224 /** return error to not attack */
225 #define EV_TurretFire(i, o) \
226 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
228 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
230 /** return error to not attack */
231 #define EV_Turret_CheckFire(i, o) \
232 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
233 /** to fire or not to fire */ o(bool, MUTATOR_ARGV_1_bool) \
235 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
237 /** return error to prevent entity spawn, or modify the entity */
238 #define EV_OnEntityPreSpawn(i, o) \
239 /** entity */ i(entity, MUTATOR_ARGV_0_entity) \
241 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
243 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
244 #define EV_PlayerPreThink(i, o) \
245 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
247 MUTATOR_HOOKABLE(PlayerPreThink, EV_PlayerPreThink);
249 /** TODO change this into a general PlayerPostThink hook? */
250 #define EV_GetPressedKeys(i, o) \
251 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
253 MUTATOR_HOOKABLE(GetPressedKeys, EV_GetPressedKeys);
255 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
256 #define EV_GetCvars(i, o) \
257 /**/ i(float, get_cvars_f) \
258 /**/ i(string, get_cvars_s) \
262 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
264 /** can edit any "just fired" projectile */
265 #define EV_EditProjectile(i, o) \
266 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
267 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
269 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
271 /** called when a monster spawns */
272 #define EV_MonsterSpawn(i, o) \
273 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
275 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
277 /** called when a monster dies */
278 #define EV_MonsterDies(i, o) \
279 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
280 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
281 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
283 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
285 /** called when a monster dies */
286 #define EV_MonsterRemove(i, o) \
287 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
289 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
291 /** called when a monster wants to respawn */
292 #define EV_MonsterRespawn(i, o) \
293 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
295 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
297 /** called when a monster is dropping loot */
298 #define EV_MonsterDropItem(i, o) \
299 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
300 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
301 /**/ o(entity, MUTATOR_ARGV_1_entity) \
302 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
304 .entity monster_loot;
305 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
308 * called when a monster moves
309 * returning true makes the monster stop
311 #define EV_MonsterMove(i, o) \
312 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
313 /** run speed */ i(float, MUTATOR_ARGV_1_float) \
314 /**/ o(float, MUTATOR_ARGV_1_float) \
315 /** walk speed */ i(float, MUTATOR_ARGV_2_float) \
316 /**/ o(float, MUTATOR_ARGV_2_float) \
317 /** move target */ i(entity, MUTATOR_ARGV_3_entity) \
318 /**/ o(entity, MUTATOR_ARGV_3_entity) \
320 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
322 /** called when a monster looks for another target */
323 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
326 * called when validating a monster's target
328 #define EV_MonsterValidTarget(i, o) \
329 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
330 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
332 MUTATOR_HOOKABLE(MonsterValidTarget, EV_MonsterValidTarget);
334 /** called to change a random monster to a miniboss */
335 #define EV_MonsterCheckBossFlag(i, o) \
336 /** monster */ i(entity, MUTATOR_ARGV_0_entity) \
338 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
341 * called when a player tries to spawn a monster
342 * return 1 to prevent spawning
343 * NOTE: requires reason if disallowed
345 #define EV_AllowMobSpawning(i, o) \
346 /** caller */ i(entity, MUTATOR_ARGV_0_entity) \
347 /** reason */ o(string, MUTATOR_ARGV_1_string) \
349 MUTATOR_HOOKABLE(AllowMobSpawning, EV_AllowMobSpawning);
351 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
352 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
353 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
354 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
355 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
356 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
357 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
358 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
359 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
360 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
361 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
362 /** damage */ i(float, MUTATOR_ARGV_7_float) \
364 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
367 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
368 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
370 #define EV_Damage_Calculate(i, o) \
371 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
372 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
373 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
374 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
375 /** damage */ i(float, MUTATOR_ARGV_4_float) \
376 /** damage */ o(float, MUTATOR_ARGV_4_float) \
377 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
378 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
379 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
380 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
382 MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
385 * Called when a player is damaged
387 #define EV_PlayerDamaged(i, o) \
388 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
389 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
390 /** health */ i(float, MUTATOR_ARGV_2_float) \
391 /** armor */ i(float, MUTATOR_ARGV_3_float) \
392 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
393 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
394 /** potential_damage */ i(float, MUTATOR_ARGV_6_float) \
396 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
399 * Called by W_DecreaseAmmo
401 #define EV_W_DecreaseAmmo(i, o) \
402 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
403 /** weapon entity */ i(entity, MUTATOR_ARGV_1_entity) \
405 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
410 #define EV_W_Reload(i, o) \
411 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
413 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
415 /** called at the end of player_powerups() in client.qc, used for manipulating the values which are set by powerup items. */
416 #define EV_PlayerPowerups(i, o) \
417 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
418 /** old items */ i(int, MUTATOR_ARGV_1_int) \
420 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
423 * called every player think frame
424 * return 1 to disable regen
426 #define EV_PlayerRegen(i, o) \
427 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
428 /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
429 /**/ o(float, MUTATOR_ARGV_1_float) \
430 /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
431 /**/ o(float, MUTATOR_ARGV_2_float) \
432 /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
433 /**/ o(float, MUTATOR_ARGV_3_float) \
434 /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
435 /**/ o(float, MUTATOR_ARGV_4_float) \
436 /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
437 /**/ o(float, MUTATOR_ARGV_5_float) \
438 /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
439 /**/ o(float, MUTATOR_ARGV_6_float) \
440 /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
441 /**/ o(float, MUTATOR_ARGV_7_float) \
442 /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
443 /**/ o(float, MUTATOR_ARGV_8_float) \
444 /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
445 /**/ o(float, MUTATOR_ARGV_9_float) \
446 /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
447 /**/ o(float, MUTATOR_ARGV_10_float) \
449 MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
452 * called when the use key is pressed
453 * if MUTATOR_RETURNVALUE is 1, don't do anything
454 * return 1 if the use key actually did something
456 #define EV_PlayerUseKey(i, o) \
457 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
459 MUTATOR_HOOKABLE(PlayerUseKey, EV_PlayerUseKey);
462 * called when a client command is parsed
463 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
464 * NOTE: return true if you handled the command, return false to continue handling
465 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
467 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
469 * if (MUTATOR_RETURNVALUE) // command was already handled?
471 * if (cmd_name == "echocvar" && cmd_argc >= 2)
473 * print(cvar_string(argv(1)), "\n");
476 * if (cmd_name == "echostring" && cmd_argc >= 2)
478 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
484 #define EV_SV_ParseClientCommand(i, o) \
485 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
486 /** command name */ i(string, MUTATOR_ARGV_1_string) \
487 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
488 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
490 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
492 /** please read EV_SV_ParseClientCommand description before using */
493 #define EV_SV_ParseServerCommand(i, o) \
494 /** command name */ i(string, MUTATOR_ARGV_0_string) \
495 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
496 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
498 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
501 * called when a spawnpoint is being evaluated
502 * return 1 to make the spawnpoint unusable
504 #define EV_Spawn_Score(i, o) \
505 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
506 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
507 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_2_vector) \
508 /**/ o(vector, MUTATOR_ARGV_2_vector) \
510 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
512 /** runs globally each server frame */
513 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
515 #define EV_SetModname(i, o) \
516 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
517 /**/ i(string, MUTATOR_ARGV_0_string) \
518 /**/ o(string, MUTATOR_ARGV_0_string) \
520 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
523 * called for each item being spawned on a map, including dropped weapons
524 * return 1 to remove an item
526 #define EV_Item_Spawn(i, o) \
527 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
529 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
531 #define EV_SetWeaponreplace(i, o) \
532 /** map entity */ i(entity, MUTATOR_ARGV_0_entity) \
533 /** weapon info */ i(entity, MUTATOR_ARGV_1_entity) \
534 /** replacement */ i(string, MUTATOR_ARGV_2_string) \
535 /**/ o(string, MUTATOR_ARGV_2_string) \
537 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
539 /** called when an item is about to respawn */
540 #define EV_Item_RespawnCountdown(i, o) \
541 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
543 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
545 /** called when a bot checks a target to attack */
546 #define EV_BotShouldAttack(i, o) \
547 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
548 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
550 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
553 * called whenever a player goes through a portal gun teleport
554 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
556 #define EV_PortalTeleport(i, o) \
557 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
559 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
562 * called whenever a player uses impulse 33 (help me) in impulse.qc
563 * normally help me ping uses .waypointsprite_attachedforcarrier,
564 * but if your mutator uses something different then you can handle it
565 * in a special manner using this hook
567 #define EV_HelpMePing(i, o) \
568 /** the player who pressed impulse 33 */ i(entity, MUTATOR_ARGV_0_entity) \
570 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
573 * called when a vehicle initializes
574 * return true to remove the vehicle
576 #define EV_VehicleInit(i, o) \
577 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
579 MUTATOR_HOOKABLE(VehicleInit, EV_VehicleInit);
582 * called when a player enters a vehicle
583 * allows mutators to set special settings in this event
585 #define EV_VehicleEnter(i, o) \
586 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
587 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
589 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
592 * called when a player touches a vehicle
593 * return true to stop player from entering the vehicle
595 #define EV_VehicleTouch(i, o) \
596 /** vehicle */ i(entity, MUTATOR_ARGV_0_entity) \
597 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
599 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
602 * called when a player exits a vehicle
603 * allows mutators to set special settings in this event
605 #define EV_VehicleExit(i, o) \
606 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
607 /** vehicle */ i(entity, MUTATOR_ARGV_1_entity) \
609 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
611 /** called when a speedrun is aborted and the player is teleported back to start position */
612 #define EV_AbortSpeedrun(i, o) \
613 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
615 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
617 /** called at when a item is touched. Called early, can edit item properties. */
618 #define EV_ItemTouch(i, o) \
619 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
620 /** toucher */ i(entity, MUTATOR_ARGV_1_entity) \
621 /**/ o(entity, MUTATOR_ARGV_1_entity) \
623 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
626 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
627 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
628 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
631 /** called at when a player connect */
632 #define EV_ClientConnect(i, o) \
633 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
635 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
637 #define EV_HavocBot_ChooseRole(i, o) \
638 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
640 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
642 /** called when a target is checked for accuracy */
643 #define EV_AccuracyTargetValid(i, o) \
644 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
645 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
647 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
649 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
650 MUT_ACCADD_INVALID, // return this flag to make the function always continue
651 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
654 /** Called when clearing the global parameters for a model */
655 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
657 /** Called when getting the global parameters for a model */
658 #define EV_GetModelParams(i, o) \
659 /** input */ i(string, MUTATOR_ARGV_0_string) \
660 /** command */ i(string, MUTATOR_ARGV_1_string) \
662 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
664 /** called when a bullet has hit a target */
665 #define EV_FireBullet_Hit(i, o) \
666 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
667 /** targ */ i(entity, MUTATOR_ARGV_1_entity) \
668 /** start pos */ i(vector, MUTATOR_ARGV_2_vector) \
669 /** end pos */ i(vector, MUTATOR_ARGV_3_vector) \
670 /** damage */ i(float, MUTATOR_ARGV_4_float) \
671 /**/ o(float, MUTATOR_ARGV_4_float) \
672 /** wep entity */ i(entity, MUTATOR_ARGV_5_entity) \
674 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
676 #define EV_FixPlayermodel(i, o) \
677 /** model */ i(string, MUTATOR_ARGV_0_string) \
678 /**/ o(string, MUTATOR_ARGV_0_string) \
679 /** skin */ i(int, MUTATOR_ARGV_1_int) \
680 /**/ o(int, MUTATOR_ARGV_1_int) \
681 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
683 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
685 /** Return error to play frag remaining announcements */
686 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
688 #define EV_GrappleHookThink(i, o) \
689 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
690 /** tarzan */ i(int, MUTATOR_ARGV_1_int) \
691 /**/ o(int, MUTATOR_ARGV_1_int) \
692 /** pulling entity */ i(entity, MUTATOR_ARGV_2_entity) \
693 /**/ o(entity, MUTATOR_ARGV_2_entity) \
694 /** velocity multiplier */ i(float, MUTATOR_ARGV_3_float) \
695 /**/ o(float, MUTATOR_ARGV_3_float) \
697 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
699 #define EV_BuffModel_Customize(i, o) \
700 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
701 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
703 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
705 /** called at when a buff is touched. Called early, can edit buff properties. */
706 #define EV_BuffTouch(i, o) \
707 /** buff */ i(entity, MUTATOR_ARGV_0_entity) \
708 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
709 /**/ o(entity, MUTATOR_ARGV_1_entity) \
711 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
713 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
715 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
717 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
719 #define EV_GetRecords(i, o) \
720 /** page */ i(int, MUTATOR_ARGV_0_int) \
721 /** record list */ i(string, MUTATOR_ARGV_1_string) \
722 /**/ o(string, MUTATOR_ARGV_1_string) \
724 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
726 #define EV_Race_FinalCheckpoint(i, o) \
727 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
729 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
731 /** called when player triggered kill (or is changing teams), return error to not do anything */
732 #define EV_ClientKill(i, o) \
733 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
734 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
735 /**/ o(float, MUTATOR_ARGV_1_float) \
737 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
739 #define EV_FixClientCvars(i, o) \
740 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
742 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
744 #define EV_SpectateSet(i, o) \
745 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
746 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
747 /**/ o(entity, MUTATOR_ARGV_1_entity) \
749 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
751 #define EV_SpectateNext(i, o) \
752 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
753 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
754 /**/ o(entity, MUTATOR_ARGV_1_entity) \
756 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
758 #define EV_SpectatePrev(i, o) \
759 /** client */ i(entity, MUTATOR_ARGV_0_entity) \
760 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
761 /**/ o(entity, MUTATOR_ARGV_1_entity) \
762 /** first */ i(entity, MUTATOR_ARGV_2_entity) \
764 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
767 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
768 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
769 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
772 /** called when player triggered kill (or is changing teams), return error to not do anything */
773 #define EV_Bot_FixCount(i, o) \
774 /** active real players */ i(int, MUTATOR_ARGV_0_int) \
775 /**/ o(int, MUTATOR_ARGV_0_int) \
776 /** real players */ i(int, MUTATOR_ARGV_1_int) \
777 /**/ o(int, MUTATOR_ARGV_1_int) \
779 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
781 #define EV_ClientCommand_Spectate(i, o) \
782 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
784 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
787 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
788 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
789 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
792 #define EV_CheckRules_World(i, o) \
793 /** status */ i(float, MUTATOR_ARGV_0_float) \
794 /**/ o(float, MUTATOR_ARGV_0_float) \
795 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
796 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
798 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
800 #define EV_WantWeapon(i, o) \
801 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
802 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
803 /**/ o(float, MUTATOR_ARGV_1_float) \
804 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
805 /**/ o(bool, MUTATOR_ARGV_2_bool) \
806 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
807 /**/ o(bool, MUTATOR_ARGV_3_bool) \
809 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
811 #define EV_AddPlayerScore(i, o) \
812 /** score field */ i(PlayerScoreField, MUTATOR_ARGV_0_entity) \
813 /** score */ i(float, MUTATOR_ARGV_1_float) \
814 /**/ o(float, MUTATOR_ARGV_1_float) \
815 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
817 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
819 #define EV_GetPlayerStatus(i, o) \
820 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
822 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
824 #define EV_SetWeaponArena(i, o) \
825 /** arena */ i(string, MUTATOR_ARGV_0_string) \
826 /**/ o(string, MUTATOR_ARGV_0_string) \
828 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
830 #define EV_DropSpecialItems(i, o) \
831 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
833 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
836 * called when an admin tries to kill all monsters
837 * return 1 to prevent spawning
839 #define EV_AllowMobButcher(i, o) \
840 /** reason */ o(string, MUTATOR_ARGV_0_string) \
842 MUTATOR_HOOKABLE(AllowMobButcher, EV_AllowMobButcher);
844 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
846 #define EV_SendWaypoint(i, o) \
847 /** waypoint */ i(entity, MUTATOR_ARGV_0_entity) \
848 /** to */ i(entity, MUTATOR_ARGV_1_entity) \
849 /** send flags */ i(int, MUTATOR_ARGV_2_int) \
850 /**/ o(int, MUTATOR_ARGV_2_int) \
851 /** wp flag */ i(int, MUTATOR_ARGV_3_int) \
852 /**/ o(int, MUTATOR_ARGV_3_int) \
854 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
856 #define EV_TurretValidateTarget(i, o) \
857 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
858 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
859 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
860 /** target score */ o(float, MUTATOR_ARGV_3_float) \
862 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
864 #define EV_TurretThink(i, o) \
865 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
867 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
869 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
872 #define EV_PrepareExplosionByDamage(i, o) \
873 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
874 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
876 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
878 /** called when a monster model is about to be set, allows custom paths etc. */
879 #define EV_MonsterModel(i, o) \
880 /** model */ i(string, MUTATOR_ARGV_0_string) \
881 /** output */ i(string, MUTATOR_ARGV_1_string) \
882 /**/ o(string, MUTATOR_ARGV_1_string) \
884 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
887 #define EV_Player_ChangeTeam(i, o) \
888 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
889 /** current team */ i(float, MUTATOR_ARGV_1_float) \
890 /** new team */ i(float, MUTATOR_ARGV_2_float) \
892 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
895 #define EV_URI_GetCallback(i, o) \
896 /** id */ i(float, MUTATOR_ARGV_0_float) \
897 /** status */ i(float, MUTATOR_ARGV_1_float) \
898 /** data */ i(string, MUTATOR_ARGV_2_string) \
900 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
903 * return true to prevent weapon use for a player
905 #define EV_ForbidWeaponUse(i, o) \
906 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
908 MUTATOR_HOOKABLE(ForbidWeaponUse, EV_ForbidWeaponUse);
910 /** called when creating a clone of the player (usually for corpses that stay after the player has re-spawned) */
911 #define EV_CopyBody(i, o) \
912 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
913 /** newly created clone */ i(entity, MUTATOR_ARGV_1_entity) \
914 /** keepvelocity? */ i(bool, MUTATOR_ARGV_2_bool) \
916 MUTATOR_HOOKABLE(CopyBody, EV_CopyBody);
918 /** called when sending a chat message, ret argument can be changed to prevent the message */
919 #define EV_ChatMessage(i, o) \
920 /** sender */ i(entity, MUTATOR_ARGV_0_entity) \
921 /** ret */ i(int, MUTATOR_ARGV_1_int) \
922 /**/ o(int, MUTATOR_ARGV_1_int) \
924 MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage);
926 /** return true to prevent sending a chat (private, team or regular) message from reaching a certain player */
927 #define EV_ChatMessageTo(i, o) \
928 /** destination player */ i(entity, MUTATOR_ARGV_0_entity) \
929 /** sender */ i(entity, MUTATOR_ARGV_1_entity) \
931 MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo);
933 /** return true to just restart the match, for modes that don't support readyrestart */
934 MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS);
936 /** called when a fusion reactor is validating its target */
937 #define EV_FusionReactor_ValidTarget(i, o) \
938 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
939 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
941 MUTATOR_HOOKABLE(FusionReactor_ValidTarget, EV_FusionReactor_ValidTarget);
944 MUT_FUSREAC_TARG_CONTINUE, // return this flag to make the function continue as normal
945 MUT_FUSREAC_TARG_VALID, // return this flag to make the function return true (valid target)
946 MUT_FUSREAC_TARG_INVALID // return this flag to make the function return false (invalid target)
949 /** return true to hide the 'teamnumbers are imbalanced' message */
950 #define EV_HideTeamNagger(i, o) \
951 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
953 MUTATOR_HOOKABLE(HideTeamNagger, EV_HideTeamNagger);
955 /** return true to show a waypoint while the item is spawning */
956 #define EV_Item_ScheduleRespawn(i, o) \
957 /** item */ i(entity, MUTATOR_ARGV_0_entity) \
958 /** respawn time */ i(float, MUTATOR_ARGV_1_float) \
960 MUTATOR_HOOKABLE(Item_ScheduleRespawn, EV_Item_ScheduleRespawn);
962 /** called before physics stats are set on a player, allows limited early customization */
963 #define EV_PlayerPhysics_UpdateStats(i, o) \
964 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
966 MUTATOR_HOOKABLE(PlayerPhysics_UpdateStats, EV_PlayerPhysics_UpdateStats);
968 /** return true to use your own aim target (or none at all) */
969 #define EV_HavocBot_Aim(i, o) \
970 /** bot */ i(entity, MUTATOR_ARGV_0_entity) \
972 MUTATOR_HOOKABLE(HavocBot_Aim, EV_HavocBot_Aim);