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);
19 /** called when a player spawns as player, after shared setup, before his weapon is chosen (so items may be changed in here) */
20 #define EV_PlayerSpawn(i, o) \
21 /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
22 /** spot that was used, or world */ i(entity, MUTATOR_ARGV_1_entity) \
24 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
26 /** called in reset_map */
27 #define EV_reset_map_global(i, o) \
29 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
31 /** called in reset_map */
32 #define EV_reset_map_players(i, o) \
34 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
36 /** returns 1 if clearing player score shall not be allowed */
37 #define EV_ForbidPlayerScore_Clear(i, o) \
39 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
41 /** called when a player disconnects */
42 #define EV_ClientDisconnect(i, o) \
43 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
45 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
47 /** called when a player dies to e.g. remove stuff he was carrying. */
48 #define EV_PlayerDies(i, o) \
49 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
50 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
51 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
52 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
53 /** damage */ i(float, MUTATOR_ARGV_4_float) \
54 /** damage */ o(float, MUTATOR_ARGV_4_float) \
56 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
58 /** called when a player dies to e.g. remove stuff he was carrying */
59 #define EV_PlayHitsound(i, o) \
60 /** victim */ i(entity, MUTATOR_ARGV_0_entity) \
62 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
64 /** called when a weapon sound is about to be played, allows custom paths etc. */
65 #define EV_WeaponSound(i, o) \
66 /** sound */ i(string, MUTATOR_ARGV_0_string) \
67 /** output */ i(string, MUTATOR_ARGV_1_string) \
68 /**/ o(string, MUTATOR_ARGV_1_string) \
70 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
72 /** called when an item model is about to be set, allows custom paths etc. */
73 #define EV_ItemModel(i, o) \
74 /** model */ i(string, MUTATOR_ARGV_0_string) \
75 /** output */ i(string, MUTATOR_ARGV_1_string) \
76 /**/ o(string, MUTATOR_ARGV_1_string) \
78 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
80 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
81 #define EV_GiveFragsForKill(i, o) \
82 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
83 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
84 /** frag score */ i(float, MUTATOR_ARGV_2_float) \
85 /** */ o(float, MUTATOR_ARGV_2_float) \
87 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
89 /** called when the match ends */
90 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
92 /** should adjust number to contain the team count */
93 #define EV_GetTeamCount(i, o) \
94 /** number of teams */ i(float, MUTATOR_ARGV_0_float) \
95 /**/ o(float, MUTATOR_ARGV_0_float) \
96 /** team entity name */ i(string, MUTATOR_ARGV_1_string) \
97 /**/ o(string, MUTATOR_ARGV_1_string) \
99 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
101 /** copies variables for spectating "other" to "self" */
102 #define EV_SpectateCopy(i, o) \
103 /** spectatee */ i(entity, MUTATOR_ARGV_0_entity) \
104 /** client */ i(entity, MUTATOR_ARGV_1_entity) \
106 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
108 /** called when formatting a chat message to replace fancy functions */
109 #define EV_FormatMessage(i, o) \
110 /**/ i(entity, __self) \
111 /**/ i(string, format_escape) \
112 /**/ i(string, format_replacement) \
113 /**/ o(string, format_replacement) \
114 /**/ i(string, format_message) \
116 string format_escape;
117 string format_replacement;
118 string format_message;
119 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
121 /** returns true if throwing the current weapon shall not be allowed */
122 #define EV_ForbidThrowCurrentWeapon(i, o) \
123 /**/ i(entity, __self) \
125 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_ForbidThrowCurrentWeapon);
127 /** returns true if dropping the current weapon shall not be allowed at any time including death */
128 #define EV_ForbidDropCurrentWeapon(i, o) \
129 /**/ i(entity, __self) \
131 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_ForbidDropCurrentWeapon);
134 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
136 /** allows changing attack rate */
137 #define EV_WeaponRateFactor(i, o) \
138 /** weapon rate */ i(float, MUTATOR_ARGV_0_float) \
139 /**/ o(float, MUTATOR_ARGV_0_float) \
140 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
142 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
144 /** allows changing weapon speed (projectiles mostly) */
145 #define EV_WeaponSpeedFactor(i, o) \
146 /** weapon speed */ i(float, MUTATOR_ARGV_0_float) \
147 /**/ o(float, MUTATOR_ARGV_0_float) \
148 /** player */ i(entity, MUTATOR_ARGV_1_entity) \
150 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
152 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
153 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
155 /** called every frame. customizes the waypoint for spectators */
156 #define EV_CustomizeWaypoint(i, o) \
157 /** waypoint */ i(entity, __self) \
158 /** player; other.enemy = spectator */ i(entity, other) \
160 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
163 * checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields)
164 * return error to request removal
166 #define EV_FilterItem(i, o) \
167 /** the current item */ i(entity, __self) \
169 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
171 /** return error to request removal */
172 #define EV_TurretSpawn(i, o) \
173 /** turret */ i(entity, __self) \
175 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
177 /** return error to not attack */
178 #define EV_TurretFire(i, o) \
179 /** turret */ i(entity, __self) \
181 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
183 /** return error to not attack */
184 #define EV_Turret_CheckFire(i, o) \
185 /**/ i(bool, ret_bool) \
186 /**/ o(bool, ret_bool) \
189 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
191 /** return error to prevent entity spawn, or modify the entity */
192 #define EV_OnEntityPreSpawn(i, o) \
193 /** turret */ i(entity, __self) \
195 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_OnEntityPreSpawn);
197 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
198 MUTATOR_HOOKABLE(PlayerPreThink, EV_NO_ARGS);
200 /** TODO change this into a general PlayerPostThink hook? */
201 MUTATOR_HOOKABLE(GetPressedKeys, EV_NO_ARGS);
203 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
204 #define EV_GetCvars(i, o) \
205 /**/ i(float, get_cvars_f) \
206 /**/ i(string, get_cvars_s) \
210 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
212 /** can edit any "just fired" projectile */
213 #define EV_EditProjectile(i, o) \
214 /** projectile owner */ i(entity, MUTATOR_ARGV_0_entity) \
215 /** projectile */ i(entity, MUTATOR_ARGV_1_entity) \
217 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
219 /** called when a monster spawns */
220 #define EV_MonsterSpawn(i, o) \
221 /**/ i(entity, __self) \
223 MUTATOR_HOOKABLE(MonsterSpawn, EV_MonsterSpawn);
225 /** called when a monster dies */
226 #define EV_MonsterDies(i, o) \
227 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
228 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
229 /** deathtype */ i(float, MUTATOR_ARGV_2_float) \
231 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
233 /** called when a monster dies */
234 #define EV_MonsterRemove(i, o) \
235 /**/ i(entity, rem_mon) \
237 entity rem_mon; // avoiding ovewriting self & other
238 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
240 /** called when a monster wants to respawn */
241 #define EV_MonsterRespawn(i, o) \
242 /**/ i(entity, other) \
244 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
246 /** called when a monster is dropping loot */
247 #define EV_MonsterDropItem(i, o) \
248 /* monster */ i(entity, MUTATOR_ARGV_0_entity) \
249 /* item (can be removed or changed) */ i(entity, MUTATOR_ARGV_1_entity) \
250 /**/ o(entity, MUTATOR_ARGV_1_entity) \
251 /* attacker */ i(entity, MUTATOR_ARGV_2_entity) \
253 .void(entity this) monster_loot;
254 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
257 * called when a monster moves
258 * returning true makes the monster stop
260 #define EV_MonsterMove(i, o) \
261 /**/ i(entity, __self) \
262 /**/ i(float, monster_speed_run) \
263 /**/ o(float, monster_speed_run) \
264 /**/ i(float, monster_speed_walk) \
265 /**/ o(float, monster_speed_walk) \
266 /**/ i(entity, monster_target) \
268 float monster_speed_run;
269 float monster_speed_walk;
270 entity monster_target;
271 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
273 /** called when a monster looks for another target */
274 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
276 /** called to change a random monster to a miniboss */
277 #define EV_MonsterCheckBossFlag(i, o) \
278 /**/ i(entity, __self) \
280 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_MonsterCheckBossFlag);
283 * called when a player tries to spawn a monster
284 * return 1 to prevent spawning
286 MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
288 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
289 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
290 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
291 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
292 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
293 /** force (no out) */ i(vector, MUTATOR_ARGV_3_vector) \
294 /** damage take */ i(float, MUTATOR_ARGV_4_float) \
295 /** damage take */ o(float, MUTATOR_ARGV_4_float) \
296 /** damage save */ i(float, MUTATOR_ARGV_5_float) \
297 /** damage save */ o(float, MUTATOR_ARGV_5_float) \
298 /** deathtype */ i(float, MUTATOR_ARGV_6_float) \
299 /** damage */ i(float, MUTATOR_ARGV_7_float) \
301 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
304 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
305 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
307 #define EV_PlayerDamage_Calculate(i, o) \
308 /** inflictor */ i(entity, MUTATOR_ARGV_0_entity) \
309 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
310 /** target */ i(entity, MUTATOR_ARGV_2_entity) \
311 /** deathtype */ i(float, MUTATOR_ARGV_3_float) \
312 /** damage */ i(float, MUTATOR_ARGV_4_float) \
313 /** damage */ o(float, MUTATOR_ARGV_4_float) \
314 /** mirrordamage */ i(float, MUTATOR_ARGV_5_float) \
315 /** mirrordamage */ o(float, MUTATOR_ARGV_5_float) \
316 /** force */ i(vector, MUTATOR_ARGV_6_vector) \
317 /** force */ o(vector, MUTATOR_ARGV_6_vector) \
319 MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
322 * Called when a player is damaged
324 #define EV_PlayerDamaged(i, o) \
325 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
326 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
327 /** health */ i(int, MUTATOR_ARGV_2_int) \
328 /** armor */ i(int, MUTATOR_ARGV_3_int) \
329 /** location */ i(vector, MUTATOR_ARGV_4_vector) \
330 /** deathtype */ i(int, MUTATOR_ARGV_5_int) \
332 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
335 * Called by W_DecreaseAmmo
337 #define EV_W_DecreaseAmmo(i, o) \
338 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
340 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
345 #define EV_W_Reload(i, o) \
346 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
348 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
350 /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
351 #define EV_PlayerPowerups(i, o) \
352 /**/ i(entity, __self) \
353 /**/ i(int, olditems) \
356 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
359 * called every player think frame
360 * return 1 to disable regen
363 float regen_mod_regen;
365 float regen_mod_limit;
367 float regen_health_linear;
368 float regen_health_rot;
369 float regen_health_rotlinear;
370 float regen_health_stable;
371 float regen_health_rotstable;
372 MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
375 * called when the use key is pressed
376 * if MUTATOR_RETURNVALUE is 1, don't do anything
377 * return 1 if the use key actually did something
379 MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
382 * called when a client command is parsed
383 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
384 * NOTE: return true if you handled the command, return false to continue handling
385 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
387 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
389 * if (MUTATOR_RETURNVALUE) // command was already handled?
391 * if (cmd_name == "echocvar" && cmd_argc >= 2)
393 * print(cvar_string(argv(1)), "\n");
396 * if (cmd_name == "echostring" && cmd_argc >= 2)
398 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
404 #define EV_SV_ParseClientCommand(i, o) \
405 /** client sending the command */ i(entity, MUTATOR_ARGV_0_entity) \
406 /** command name */ i(string, MUTATOR_ARGV_1_string) \
407 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_2_int) \
408 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_3_string) \
410 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
412 /** please read EV_SV_ParseClientCommand description before using */
413 #define EV_SV_ParseServerCommand(i, o) \
414 /** command name */ i(string, MUTATOR_ARGV_0_string) \
415 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
416 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
418 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
421 * called when a spawnpoint is being evaluated
422 * return 1 to make the spawnpoint unusable
424 #define EV_Spawn_Score(i, o) \
425 /** player wanting to spawn */ i(entity, MUTATOR_ARGV_0_entity) \
426 /** spot to be evaluated */ i(entity, MUTATOR_ARGV_1_entity) \
427 /** spot score, _x is priority, _y is "distance" */ i(vector, MUTATOR_ARGV_0_vector) \
428 /**/ o(vector, MUTATOR_ARGV_0_vector) \
430 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
432 /** runs globally each server frame */
433 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
435 #define EV_SetModname(i, o) \
436 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
439 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
442 * called for each item being spawned on a map, including dropped weapons
443 * return 1 to remove an item
445 #define EV_Item_Spawn(i, o) \
446 /** the item */ i(entity, __self) \
448 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
450 #define EV_SetWeaponreplace(i, o) \
451 /** map entity */ i(entity, __self) \
452 /** weapon info */ i(entity, other) \
453 /**/ i(string, ret_string) \
454 /**/ o(string, ret_string) \
457 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
459 /** called when an item is about to respawn */
460 #define EV_Item_RespawnCountdown(i, o) \
461 /**/ i(string, item_name) \
462 /**/ o(string, item_name) \
463 /**/ i(vector, item_color) \
464 /**/ o(vector, item_color) \
468 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
470 /** called when a bot checks a target to attack */
471 #define EV_BotShouldAttack(i, o) \
472 /**/ i(entity, __self) \
473 /**/ i(entity, checkentity) \
476 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
479 * called whenever a player goes through a portal gun teleport
480 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
482 #define EV_PortalTeleport(i, o) \
483 /**/ i(entity, __self) \
485 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
488 * called whenever a player uses impulse 33 (help me) in cl_impulse.qc
489 * normally help me ping uses self.waypointsprite_attachedforcarrier,
490 * but if your mutator uses something different then you can handle it
491 * in a special manner using this hook
493 #define EV_HelpMePing(i, o) \
494 /** the player who pressed impulse 33 */ i(entity, __self) \
496 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
499 * called when a vehicle initializes
500 * return true to remove the vehicle
502 #define EV_VehicleSpawn(i, o) \
503 /**/ i(entity, __self) \
505 MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
508 * called when a player enters a vehicle
509 * allows mutators to set special settings in this event
511 #define EV_VehicleEnter(i, o) \
512 /** player */ i(entity, vh_player) \
513 /** vehicle */ i(entity, vh_vehicle) \
517 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
520 * called when a player touches a vehicle
521 * return true to stop player from entering the vehicle
523 #define EV_VehicleTouch(i, o) \
524 /** vehicle */ i(entity, __self) \
525 /** player */ i(entity, other) \
527 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
530 * called when a player exits a vehicle
531 * allows mutators to set special settings in this event
533 #define EV_VehicleExit(i, o) \
534 /** player */ i(entity, vh_player) \
535 /** vehicle */ i(entity, vh_vehicle) \
537 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
539 /** called when a speedrun is aborted and the player is teleported back to start position */
540 #define EV_AbortSpeedrun(i, o) \
541 /** player */ i(entity, __self) \
543 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
545 /** called at when a item is touched. Called early, can edit item properties. */
546 #define EV_ItemTouch(i, o) \
547 /** item */ i(entity, __self) \
548 /** player */ i(entity, other) \
550 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
553 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
554 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
555 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
558 /** called at when a player connect */
559 #define EV_ClientConnect(i, o) \
560 /** player */ i(entity, __self) \
562 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
564 #define EV_HavocBot_ChooseRole(i, o) \
565 /**/ i(entity, __self) \
567 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
569 /** called when a target is checked for accuracy */
570 #define EV_AccuracyTargetValid(i, o) \
571 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
572 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
574 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
576 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
577 MUT_ACCADD_INVALID, // return this flag to make the function always continue
578 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
581 /** Called when clearing the global parameters for a model */
582 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
584 /** Called when getting the global parameters for a model */
585 #define EV_GetModelParams(i, o) \
586 /** entity id */ i(string, checkmodel_input) \
587 /** entity id */ i(string, checkmodel_command) \
589 string checkmodel_input, checkmodel_command;
590 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
592 /** called when a bullet has hit a target */
593 #define EV_FireBullet_Hit(i, o) \
594 /**/ i(entity, __self) \
595 /**/ i(entity, bullet_hit) \
596 /**/ i(vector, bullet_startpos) \
597 /**/ i(vector, bullet_endpos) \
598 /**/ i(float, frag_damage) \
599 /**/ o(float, frag_damage) \
602 //vector bullet_hitloc; // the end pos matches the hit location, apparently
603 vector bullet_startpos;
604 vector bullet_endpos;
606 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
608 #define EV_FixPlayermodel(i, o) \
609 /**/ i(string, ret_string) \
610 /**/ o(string, ret_string) \
611 /**/ i(int, ret_int) \
612 /**/ o(int, ret_int) \
615 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
617 /** Return error to play frag remaining announcements */
618 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
620 #define EV_GrappleHookThink(i, o) \
621 /**/ i(entity, __self) \
622 /**/ i(int, hook_tarzan) \
623 /**/ o(int, hook_tarzan) \
624 /**/ i(entity, hook_pullentity) \
625 /**/ o(entity, hook_pullentity) \
626 /**/ i(float, hook_velmultiplier) \
627 /**/ o(float, hook_velmultiplier) \
630 entity hook_pullentity;
631 float hook_velmultiplier;
632 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
634 #define EV_BuffModel_Customize(i, o) \
635 /**/ i(entity, __self) \
636 /**/ i(entity, buff_player) \
639 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
641 /** called at when a buff is touched. Called early, can edit buff properties. */
642 #define EV_BuffTouch(i, o) \
643 /** item */ i(entity, __self) \
644 /** player */ i(entity, other) \
646 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
648 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
650 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
652 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
654 #define EV_GetRecords(i, o) \
655 /**/ i(int, record_page) \
656 /**/ i(string, ret_string) \
657 /**/ o(string, ret_string) \
660 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
662 #define EV_Race_FinalCheckpoint(i, o) \
663 /**/ i(entity, race_player) \
666 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
668 /** called when player triggered kill (or is changing teams), return error to not do anything */
669 #define EV_ClientKill(i, o) \
670 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
671 /** kill delay */ i(float, MUTATOR_ARGV_1_float) \
672 /**/ o(float, MUTATOR_ARGV_1_float) \
674 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
676 #define EV_FixClientCvars(i, o) \
677 /** player */ i(entity, MUTATOR_ARGV_0_entity) \
679 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
681 #define EV_SpectateSet(i, o) \
682 /**/ i(entity, __self) \
683 /**/ i(entity, spec_player) \
684 /**/ o(entity, spec_player) \
687 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
689 #define EV_SpectateNext(i, o) \
690 /**/ i(entity, __self) \
691 /**/ i(entity, spec_player) \
692 /**/ o(entity, spec_player) \
694 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
696 #define EV_SpectatePrev(i, o) \
697 /**/ i(entity, __self) \
698 /**/ i(entity, spec_player) \
699 /**/ o(entity, spec_player) \
700 /**/ i(entity, spec_first) \
703 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
706 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
707 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
708 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
711 /** called when player triggered kill (or is changing teams), return error to not do anything */
712 #define EV_Bot_FixCount(i, o) \
713 /**/ i(int, bot_activerealplayers) \
714 /**/ o(int, bot_activerealplayers) \
715 /**/ i(int, bot_realplayers) \
716 /**/ o(int, bot_realplayers) \
718 int bot_activerealplayers;
720 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
722 #define EV_ClientCommand_Spectate(i, o) \
723 /**/ i(entity, __self) \
725 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
728 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
729 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
730 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
733 #define EV_CheckRules_World(i, o) \
734 /** status */ i(float, MUTATOR_ARGV_0_float) \
735 /**/ o(float, MUTATOR_ARGV_0_float) \
736 /* time limit */ i(float, MUTATOR_ARGV_1_float) \
737 /* frag limit */ i(float, MUTATOR_ARGV_2_float) \
739 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
741 #define EV_WantWeapon(i, o) \
742 /** weapon info entity */ i(entity, MUTATOR_ARGV_0_entity) \
743 /** do want? */ i(float, MUTATOR_ARGV_1_float) \
744 /**/ o(float, MUTATOR_ARGV_1_float) \
745 /** want all guns */ i(bool, MUTATOR_ARGV_2_bool) \
746 /**/ o(bool, MUTATOR_ARGV_2_bool) \
747 /** want mutator blocked */ i(bool, MUTATOR_ARGV_3_bool) \
748 /**/ o(bool, MUTATOR_ARGV_3_bool) \
750 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
752 #define EV_AddPlayerScore(i, o) \
753 /** score field */ i(int, MUTATOR_ARGV_0_int) \
754 /** score */ i(float, MUTATOR_ARGV_1_float) \
755 /**/ o(float, MUTATOR_ARGV_1_float) \
756 /** player */ i(entity, MUTATOR_ARGV_2_entity) \
758 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
760 #define EV_GetPlayerStatus(i, o) \
761 /**/ i(entity, set_player) \
762 /**/ i(string, ret_string) \
763 /**/ o(string, ret_string) \
766 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
768 #define EV_SetWeaponArena(i, o) \
769 /**/ i(string, ret_string) \
770 /**/ o(string, ret_string) \
772 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
774 #define EV_DropSpecialItems(i, o) \
775 /** target */ i(entity, MUTATOR_ARGV_0_entity) \
777 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
780 * called when an admin tries to kill all monsters
781 * return 1 to prevent spawning
783 MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
785 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
787 #define EV_SendWaypoint(i, o) \
788 /**/ i(entity, __self) \
789 /**/ i(entity, wp_sendto) \
790 /**/ i(int, wp_sendflags) \
791 /**/ o(int, wp_sendflags) \
792 /**/ i(int, wp_flag) \
793 /**/ o(int, wp_flag) \
798 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
800 #define EV_TurretValidateTarget(i, o) \
801 /** turret */ i(entity, MUTATOR_ARGV_0_entity) \
802 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
803 /** validate flags */ i(int, MUTATOR_ARGV_2_int) \
804 /** target score */ o(float, MUTATOR_ARGV_3_float) \
806 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
808 #define EV_TurretThink(i, o) \
809 /**/ i(entity, __self) \
811 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
813 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
816 #define EV_PrepareExplosionByDamage(i, o) \
817 /** projectile */ i(entity, MUTATOR_ARGV_0_entity) \
818 /** attacker */ i(entity, MUTATOR_ARGV_1_entity) \
820 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
822 /** called when a monster model is about to be set, allows custom paths etc. */
823 #define EV_MonsterModel(i, o) \
824 /**/ i(string, monster_model) \
825 /**/ i(string, monster_model_output) \
826 /**/ o(string, monster_model_output) \
828 string monster_model;
829 string monster_model_output;
830 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
833 #define EV_Player_ChangeTeam(i, o) \
834 /**/ i(entity, __self) \
835 /**/ i(float, pct_curteam) \
836 /**/ i(float, pct_newteam) \
840 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
843 #define EV_URI_GetCallback(i, o) \
844 /**/ i(float, uricb_id) \
845 /**/ i(float, uricb_status) \
846 /**/ i(string, uricb_data) \
851 MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);