1 #ifndef SERVER_MUTATORS_EVENTS_H
2 #define SERVER_MUTATORS_EVENTS_H
4 #include "../../common/mutators/base.qh"
6 // register all possible hooks here
8 /** called when a player becomes observer, after shared setup */
9 #define EV_MakePlayerObserver(i, o) \
11 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
14 #define EV_PutClientInServer(i, o) \
15 /** client wanting to spawn */ i(entity, __self) \
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 /** spot that was used, or world */ i(entity, spawn_spot) \
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) \
44 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
46 /** called when a player dies to e.g. remove stuff he was carrying. */
47 #define EV_PlayerDies(i, o) \
48 /**/ i(entity, frag_inflictor) \
49 /**/ i(entity, frag_attacker) \
50 /** same as self */ i(entity, frag_target) \
51 /**/ i(int, frag_deathtype) \
53 entity frag_inflictor;
57 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
59 /** called when a player dies to e.g. remove stuff he was carrying */
60 #define EV_PlayHitsound(i, o) \
61 /**/ i(entity, frag_victim) \
64 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
66 /** called when a weapon sound is about to be played, allows custom paths etc. */
67 #define EV_WeaponSound(i, o) \
68 /**/ i(string, weapon_sound) \
69 /**/ i(string, weapon_sound_output) \
70 /**/ o(string, weapon_sound_output) \
73 string weapon_sound_output;
74 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
76 /** called when an item model is about to be set, allows custom paths etc. */
77 #define EV_ItemModel(i, o) \
78 /**/ i(string, item_model) \
79 /**/ i(string, item_model_output) \
80 /**/ o(string, item_model_output) \
83 string item_model_output;
84 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
86 /** called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill */
87 #define EV_GiveFragsForKill(i, o) \
88 /**/ i(entity, __self) \
89 /** same as self */ i(entity, frag_attacker) \
90 /**/ i(entity, frag_target) \
91 /**/ i(float, frag_score) \
92 /**/ o(float, frag_score) \
95 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
97 /** called when the match ends */
98 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
100 /** should adjust ret_float to contain the team count */
101 #define EV_GetTeamCount(i, o) \
102 /**/ i(float, ret_float) \
103 /**/ o(float, ret_float) \
104 /**/ i(string, ret_string) \
105 /**/ o(string, ret_string) \
108 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
110 /** copies variables for spectating "other" to "self" */
111 #define EV_SpectateCopy(i, o) \
112 /**/ i(entity, other) \
113 /**/ i(entity, __self) \
115 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
117 /** called when formatting a chat message to replace fancy functions */
118 #define EV_FormatMessage(i, o) \
119 /**/ i(string, format_escape) \
120 /**/ i(string, format_replacement) \
121 /**/ o(string, format_replacement) \
122 /**/ i(string, format_message) \
124 string format_escape;
125 string format_replacement;
126 string format_message;
127 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
129 /** returns true if throwing the current weapon shall not be allowed */
130 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
132 /** returns true if dropping the current weapon shall not be allowed at any time including death */
133 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_NO_ARGS);
136 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
138 /** allows changing attack rate */
139 #define EV_WeaponRateFactor(i, o) \
140 /**/ i(float, weapon_rate) \
141 /**/ o(float, weapon_rate) \
144 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
146 /** allows changing weapon speed (projectiles mostly) */
147 #define EV_WeaponSpeedFactor(i, o) \
148 /**/ i(float, ret_float) \
149 /**/ o(float, ret_float) \
151 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
153 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
154 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
156 /** called every frame. customizes the waypoint for spectators */
157 #define EV_CustomizeWaypoint(i, o) \
158 /** waypoint */ i(entity, __self) \
159 /** player; other.enemy = spectator */ i(entity, other) \
161 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
164 * 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)
165 * return error to request removal
167 #define EV_FilterItem(i, o) \
168 /** the current item */ i(entity, __self) \
170 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
172 /** return error to request removal */
173 #define EV_TurretSpawn(i, o) \
174 /** turret */ i(entity, __self) \
176 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
178 /** return error to not attack */
179 #define EV_TurretFire(i, o) \
180 /** turret */ i(entity, __self) \
182 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
184 /** return error to not attack */
185 #define EV_Turret_CheckFire(i, o) \
186 /**/ i(bool, ret_bool) \
187 /**/ o(bool, ret_bool) \
190 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
192 /** return error to prevent entity spawn, or modify the entity */
193 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_NO_ARGS);
195 /** runs in the event loop for players; is called for ALL player entities, also bots, also the dead, or spectators */
196 MUTATOR_HOOKABLE(PlayerPreThink, EV_NO_ARGS);
198 /** TODO change this into a general PlayerPostThink hook? */
199 MUTATOR_HOOKABLE(GetPressedKeys, EV_NO_ARGS);
201 /** is meant to call GetCvars_handle*(get_cvars_s, get_cvars_f, cvarfield, "cvarname") for cvars this mutator needs from the client */
202 #define EV_GetCvars(i, o) \
203 /**/ i(float, get_cvars_f) \
204 /**/ i(string, get_cvars_s) \
208 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
210 /** can edit any "just fired" projectile */
211 #define EV_EditProjectile(i, o) \
212 /**/ i(entity, __self) \
213 /**/ i(entity, other) \
215 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
217 /** called when a monster spawns */
218 MUTATOR_HOOKABLE(MonsterSpawn, EV_NO_ARGS);
220 /** called when a monster dies */
221 #define EV_MonsterDies(i, o) \
222 /**/ i(entity, frag_attacker) \
224 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
226 /** called when a monster dies */
227 #define EV_MonsterRemove(i, o) \
228 /**/ i(entity, rem_mon) \
230 entity rem_mon; // avoiding ovewriting self & other
231 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
233 /** called when a monster wants to respawn */
234 #define EV_MonsterRespawn(i, o) \
235 /**/ i(entity, other) \
237 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
239 /** called when a monster is dropping loot */
240 #define EV_MonsterDropItem(i, o) \
241 /**/ i(entity, other) \
242 /**/ o(entity, other) \
244 .void(entity this) monster_loot;
245 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
248 * called when a monster moves
249 * returning true makes the monster stop
251 #define EV_MonsterMove(i, o) \
252 /**/ i(float, monster_speed_run) \
253 /**/ o(float, monster_speed_run) \
254 /**/ i(float, monster_speed_walk) \
255 /**/ o(float, monster_speed_walk) \
256 /**/ i(entity, monster_target) \
258 float monster_speed_run;
259 float monster_speed_walk;
260 entity monster_target;
261 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
263 /** called when a monster looks for another target */
264 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
266 /** called to change a random monster to a miniboss */
267 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_NO_ARGS);
270 * called when a player tries to spawn a monster
271 * return 1 to prevent spawning
273 MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
275 /** called when a player gets damaged to e.g. remove stuff he was carrying. */
276 #define EV_PlayerDamage_SplitHealthArmor(i, o) \
277 /**/ i(entity, frag_inflictor) \
278 /**/ i(entity, frag_attacker) \
279 /** same as self */ i(entity, frag_target) \
280 /** NOTE: this force already HAS been applied */ i(vector, damage_force) \
281 /**/ i(float, damage_take) \
282 /**/ o(float, damage_take) \
283 /**/ i(float, damage_save) \
284 /**/ o(float, damage_save) \
289 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
292 * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
293 * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
295 #define EV_PlayerDamage_Calculate(i, o) \
296 /**/ i(entity, frag_inflictor) \
297 /**/ i(entity, frag_attacker) \
298 /**/ i(entity, frag_target) \
299 /**/ i(float, frag_deathtype) \
300 /**/ i(float, frag_damage) \
301 /**/ o(float, frag_damage) \
302 /**/ i(float, frag_mirrordamage) \
303 /**/ o(float, frag_mirrordamage) \
304 /**/ i(vector, frag_force) \
305 /**/ o(vector, frag_force) \
308 float frag_mirrordamage;
310 MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
313 * Called when a player is damaged
315 #define EV_PlayerDamaged(i, o) \
316 /** attacker */ i(entity, MUTATOR_ARGV_0_entity) \
317 /** target */ i(entity, MUTATOR_ARGV_1_entity) \
318 /** health */ i(int, MUTATOR_ARGV_0_int) \
319 /** armor */ i(int, MUTATOR_ARGV_1_int) \
320 /** location */ i(vector, MUTATOR_ARGV_0_vector) \
321 /** deathtype */ i(int, MUTATOR_ARGV_2_int) \
323 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
326 * Called by W_DecreaseAmmo
328 #define EV_W_DecreaseAmmo(i, o) \
329 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
331 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
336 #define EV_W_Reload(i, o) \
337 /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
339 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
341 /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
342 #define EV_PlayerPowerups(i, o) \
343 /**/ i(entity, __self) \
344 /**/ i(int, olditems) \
347 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
350 * called every player think frame
351 * return 1 to disable regen
354 float regen_mod_regen;
356 float regen_mod_limit;
358 float regen_health_linear;
359 float regen_health_rot;
360 float regen_health_rotlinear;
361 float regen_health_stable;
362 float regen_health_rotstable;
363 MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
366 * called when the use key is pressed
367 * if MUTATOR_RETURNVALUE is 1, don't do anything
368 * return 1 if the use key actually did something
370 MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
373 * called when a client command is parsed
374 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
375 * NOTE: return true if you handled the command, return false to continue handling
376 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
378 * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
380 * if (MUTATOR_RETURNVALUE) // command was already handled?
382 * if (cmd_name == "echocvar" && cmd_argc >= 2)
384 * print(cvar_string(argv(1)), "\n");
387 * if (cmd_name == "echostring" && cmd_argc >= 2)
389 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
395 #define EV_SV_ParseClientCommand(i, o) \
396 /** command name */ i(string, cmd_name) \
397 /** also, argv() can be used */ i(int, cmd_argc) \
398 /** whole command, use only if you really have to */ i(string, cmd_string) \
403 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
405 /** please read EV_SV_ParseClientCommand description before using */
406 #define EV_SV_ParseServerCommand(i, o) \
407 /** command name */ i(string, cmd_name) \
408 /** also, argv() can be used */ i(int, cmd_argc) \
409 /** whole command, use only if you really have to */ i(string, cmd_string) \
414 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
417 * called when a spawnpoint is being evaluated
418 * return 1 to make the spawnpoint unusable
420 #define EV_Spawn_Score(i, o) \
421 /** player wanting to spawn */ i(entity, __self) \
422 /** spot to be evaluated */ i(entity, spawn_spot) \
423 /** _x is priority, _y is "distance" */ i(vector, spawn_score) \
424 /**/ o(vector, spawn_score) \
427 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
429 /** runs globally each server frame */
430 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
432 #define EV_SetModname(i, o) \
433 /** name of the mutator/mod if it warrants showing as such in the server browser */ \
436 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
439 * called for each item being spawned on a map, including dropped weapons
440 * return 1 to remove an item
442 #define EV_Item_Spawn(i, o) \
443 /** the item */ i(entity, __self) \
445 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
447 #define EV_SetWeaponreplace(i, o) \
448 /** map entity */ i(entity, __self) \
449 /** weapon info */ i(entity, other) \
450 /**/ i(string, ret_string) \
451 /**/ o(string, ret_string) \
453 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
455 /** called when an item is about to respawn */
456 #define EV_Item_RespawnCountdown(i, o) \
457 /**/ i(string, item_name) \
458 /**/ o(string, item_name) \
459 /**/ i(vector, item_color) \
460 /**/ o(vector, item_color) \
464 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
466 /** called when a bot checks a target to attack */
467 #define EV_BotShouldAttack(i, o) \
468 /**/ i(entity, checkentity) \
471 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
474 * called whenever a player goes through a portal gun teleport
475 * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
477 #define EV_PortalTeleport(i, o) \
478 /**/ i(entity, __self) \
480 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
483 * called whenever a player uses impulse 33 (help me) in cl_impulse.qc
484 * normally help me ping uses self.waypointsprite_attachedforcarrier,
485 * but if your mutator uses something different then you can handle it
486 * in a special manner using this hook
488 #define EV_HelpMePing(i, o) \
489 /** the player who pressed impulse 33 */ i(entity, __self) \
491 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
494 * called when a vehicle initializes
495 * return true to remove the vehicle
497 MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
500 * called when a player enters a vehicle
501 * allows mutators to set special settings in this event
503 #define EV_VehicleEnter(i, o) \
504 /** player */ i(entity, vh_player) \
505 /** vehicle */ i(entity, vh_vehicle) \
509 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
512 * called when a player touches a vehicle
513 * return true to stop player from entering the vehicle
515 #define EV_VehicleTouch(i, o) \
516 /** vehicle */ i(entity, __self) \
517 /** player */ i(entity, other) \
519 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
522 * called when a player exits a vehicle
523 * allows mutators to set special settings in this event
525 #define EV_VehicleExit(i, o) \
526 /** player */ i(entity, vh_player) \
527 /** vehicle */ i(entity, vh_vehicle) \
529 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
531 /** called when a speedrun is aborted and the player is teleported back to start position */
532 #define EV_AbortSpeedrun(i, o) \
533 /** player */ i(entity, __self) \
535 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
537 /** called at when a item is touched. Called early, can edit item properties. */
538 #define EV_ItemTouch(i, o) \
539 /** item */ i(entity, __self) \
540 /** player */ i(entity, other) \
542 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
545 MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
546 MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
547 MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
550 /** called at when a player connect */
551 #define EV_ClientConnect(i, o) \
552 /** player */ i(entity, __self) \
554 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
556 #define EV_HavocBot_ChooseRole(i, o) \
557 /**/ i(entity, __self) \
559 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
561 /** called when a target is checked for accuracy */
562 #define EV_AccuracyTargetValid(i, o) \
563 /** attacker */ i(entity, frag_attacker) \
564 /** target */ i(entity, frag_target) \
566 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
568 MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
569 MUT_ACCADD_INVALID, // return this flag to make the function always continue
570 MUT_ACCADD_INDIFFERENT // return this flag to make the function always return
573 /** Called when clearing the global parameters for a model */
574 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
576 /** Called when getting the global parameters for a model */
577 #define EV_GetModelParams(i, o) \
578 /** entity id */ i(string, checkmodel_input) \
579 /** entity id */ i(string, checkmodel_command) \
581 string checkmodel_input, checkmodel_command;
582 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
584 /** called when a bullet has hit a target */
585 #define EV_FireBullet_Hit(i, o) \
586 /**/ i(entity, __self) \
587 /**/ i(entity, bullet_hit) \
588 /**/ i(vector, bullet_startpos) \
589 /**/ i(vector, bullet_endpos) \
590 /**/ i(float, frag_damage) \
591 /**/ o(float, frag_damage) \
594 //vector bullet_hitloc; // the end pos matches the hit location, apparently
595 vector bullet_startpos;
596 vector bullet_endpos;
598 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
600 #define EV_FixPlayermodel(i, o) \
601 /**/ i(string, ret_string) \
602 /**/ o(string, ret_string) \
603 /**/ i(int, ret_int) \
604 /**/ o(int, ret_int) \
607 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
609 /** Return error to play frag remaining announcements */
610 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
612 #define EV_GrappleHookThink(i, o) \
613 /**/ i(entity, __self) \
614 /**/ i(int, hook_tarzan) \
615 /**/ o(int, hook_tarzan) \
616 /**/ i(entity, hook_pullentity) \
617 /**/ o(entity, hook_pullentity) \
618 /**/ i(float, hook_velmultiplier) \
619 /**/ o(float, hook_velmultiplier) \
622 entity hook_pullentity;
623 float hook_velmultiplier;
624 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
626 #define EV_BuffModel_Customize(i, o) \
627 /**/ i(entity, __self) \
628 /**/ i(entity, buff_player) \
631 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
633 /** called at when a buff is touched. Called early, can edit buff properties. */
634 #define EV_BuffTouch(i, o) \
635 /** item */ i(entity, __self) \
636 /** player */ i(entity, other) \
638 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
640 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
642 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
644 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
646 #define EV_GetRecords(i, o) \
647 /**/ i(int, record_page) \
648 /**/ i(string, ret_string) \
649 /**/ o(string, ret_string) \
652 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
654 #define EV_Race_FinalCheckpoint(i, o) \
655 /**/ i(entity, race_player) \
658 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
660 /** called when player triggered kill (or is changing teams), return error to not do anything */
661 #define EV_ClientKill(i, o) \
662 /** player */ i(entity, __self) \
663 /* kill delay */ i(float, ret_float) \
664 /* kill delay */ o(float, ret_float) \
666 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
668 #define EV_FixClientCvars(i, o) \
669 /**/ i(entity, fix_client) \
672 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
674 #define EV_SpectateSet(i, o) \
675 /**/ i(entity, __self) \
676 /**/ i(entity, spec_player) \
677 /**/ o(entity, spec_player) \
680 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
682 #define EV_SpectateNext(i, o) \
683 /**/ i(entity, __self) \
684 /**/ i(entity, spec_player) \
685 /**/ o(entity, spec_player) \
687 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
689 #define EV_SpectatePrev(i, o) \
690 /**/ i(entity, __self) \
691 /**/ i(entity, spec_player) \
692 /**/ o(entity, spec_player) \
693 /**/ i(entity, spec_first) \
696 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
699 MUT_SPECPREV_CONTINUE, // return this flag to make the function continue as normal
700 MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
701 MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
704 /** called when player triggered kill (or is changing teams), return error to not do anything */
705 #define EV_Bot_FixCount(i, o) \
706 /**/ i(int, bot_activerealplayers) \
707 /**/ o(int, bot_activerealplayers) \
708 /**/ i(int, bot_realplayers) \
709 /**/ o(int, bot_realplayers) \
711 int bot_activerealplayers;
713 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
715 #define EV_ClientCommand_Spectate(i, o) \
716 /**/ i(entity, __self) \
718 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
721 MUT_SPECCMD_CONTINUE, // return this flag to make the function continue as normal
722 MUT_SPECCMD_RETURN, // return this flag to make the function return (don't spectate)
723 MUT_SPECCMD_FORCE // return this flag to force the player to spectate, even if they're not a player
726 #define EV_CheckRules_World(i, o) \
727 /* status */ i(float, ret_float) \
728 /* status */ o(float, ret_float) \
729 /* time limit */ i(float, checkrules_timelimit) \
730 /* frag limit */ i(int, checkrules_fraglimit) \
732 float checkrules_timelimit;
733 int checkrules_fraglimit;
734 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
736 #define EV_WantWeapon(i, o) \
737 /**/ i(entity, want_weaponinfo) \
738 /**/ i(float, ret_float) \
739 /**/ o(float, ret_float) \
740 /**/ i(bool, want_allguns) \
741 /**/ o(bool, want_allguns) \
742 /**/ i(bool, want_mutatorblocked) \
743 /**/ o(bool, want_mutatorblocked) \
745 entity want_weaponinfo;
747 bool want_mutatorblocked;
748 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
750 #define EV_AddPlayerScore(i, o) \
751 /**/ i(int, score_field) \
752 /**/ i(float, ret_float) \
753 /**/ o(float, ret_float) \
756 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
758 #define EV_GetPlayerStatus(i, o) \
759 /**/ i(entity, set_player) \
760 /**/ i(string, ret_string) \
761 /**/ o(string, ret_string) \
764 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
766 #define EV_SetWeaponArena(i, o) \
767 /**/ i(string, ret_string) \
768 /**/ o(string, ret_string) \
770 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
772 #define EV_DropSpecialItems(i, o) \
773 /**/ i(entity, frag_target) \
775 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
778 * called when an admin tries to kill all monsters
779 * return 1 to prevent spawning
781 MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
783 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
785 #define EV_SendWaypoint(i, o) \
786 /**/ i(entity, __self) \
787 /**/ i(entity, wp_sendto) \
788 /**/ i(int, wp_sendflags) \
789 /**/ o(int, wp_sendflags) \
790 /**/ i(int, wp_flag) \
791 /**/ o(int, wp_flag) \
796 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
798 #define EV_TurretValidateTarget(i, o) \
799 /**/ i(entity, turret_this) \
800 /**/ i(entity, turret_target) \
801 /**/ i(int, turret_vflags) \
804 entity turret_target;
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 /**/ i(entity, __self) \
818 /**/ i(entity, frag_attacker) \
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);