]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/events.qh
Merge branch 'master' into terencehill/menu_hudskin_selector
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / events.qh
1 #ifndef SERVER_MUTATORS_EVENTS_H
2 #define SERVER_MUTATORS_EVENTS_H
3
4 #include "../../common/mutators/base.qh"
5
6 // register all possible hooks here
7
8 /** called when a player becomes observer, after shared setup */
9 #define EV_MakePlayerObserver(i, o) \
10     /**/
11 MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver)
12
13 /** */
14 #define EV_PutClientInServer(i, o) \
15     /** client wanting to spawn */ i(entity, __self) \
16     /**/
17 MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
18
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) \
22     /**/
23 entity spawn_spot;
24 MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
25
26 /** called in reset_map */
27 #define EV_reset_map_global(i, o) \
28     /**/
29 MUTATOR_HOOKABLE(reset_map_global, EV_reset_map_global);
30
31 /** called in reset_map */
32 #define EV_reset_map_players(i, o) \
33     /**/
34 MUTATOR_HOOKABLE(reset_map_players, EV_reset_map_players);
35
36 /** returns 1 if clearing player score shall not be allowed */
37 #define EV_ForbidPlayerScore_Clear(i, o) \
38     /**/
39 MUTATOR_HOOKABLE(ForbidPlayerScore_Clear, EV_ForbidPlayerScore_Clear);
40
41 /** called when a player disconnects */
42 #define EV_ClientDisconnect(i, o) \
43     /**/
44 MUTATOR_HOOKABLE(ClientDisconnect, EV_ClientDisconnect);
45
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) \
52     /**/
53 entity frag_inflictor;
54 entity frag_attacker;
55 entity frag_target;
56 int frag_deathtype;
57 MUTATOR_HOOKABLE(PlayerDies, EV_PlayerDies);
58
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) \
62     /**/
63 entity frag_victim;
64 MUTATOR_HOOKABLE(PlayHitsound, EV_PlayHitsound);
65
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) \
71     /**/
72 string weapon_sound;
73 string weapon_sound_output;
74 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
75
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) \
81     /**/
82 string item_model;
83 string item_model_output;
84 MUTATOR_HOOKABLE(ItemModel, EV_ItemModel);
85
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) \
93     /**/
94 float frag_score;
95 MUTATOR_HOOKABLE(GiveFragsForKill, EV_GiveFragsForKill);
96
97 /** called when the match ends */
98 MUTATOR_HOOKABLE(MatchEnd, EV_NO_ARGS);
99
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) \
106     /**/
107 float ret_float;
108 MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
109
110 /** copies variables for spectating "other" to "self" */
111 #define EV_SpectateCopy(i, o) \
112     /**/ i(entity, other) \
113     /**/ i(entity, __self) \
114     /**/
115 MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
116
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) \
123     /**/
124 string format_escape;
125 string format_replacement;
126 string format_message;
127 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
128
129 /** returns true if throwing the current weapon shall not be allowed */
130 MUTATOR_HOOKABLE(ForbidThrowCurrentWeapon, EV_NO_ARGS);
131
132 /** returns true if dropping the current weapon shall not be allowed at any time including death */
133 MUTATOR_HOOKABLE(ForbidDropCurrentWeapon, EV_NO_ARGS);
134
135 /**  */
136 MUTATOR_HOOKABLE(SetDefaultAlpha, EV_NO_ARGS);
137
138 /** allows changing attack rate */
139 #define EV_WeaponRateFactor(i, o) \
140     /**/ i(float, weapon_rate) \
141     /**/ o(float, weapon_rate) \
142     /**/
143 float weapon_rate;
144 MUTATOR_HOOKABLE(WeaponRateFactor, EV_WeaponRateFactor);
145
146 /** allows changing weapon speed (projectiles mostly) */
147 #define EV_WeaponSpeedFactor(i, o) \
148     /**/ i(float, ret_float) \
149     /**/ o(float, ret_float) \
150     /**/
151 MUTATOR_HOOKABLE(WeaponSpeedFactor, EV_WeaponSpeedFactor);
152
153 /** adjusts {warmup_}start_{items,weapons,ammo_{cells,plasma,rockets,nails,shells,fuel}} */
154 MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS);
155
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) \
160     /**/
161 MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
162
163 /**
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
166  */
167 #define EV_FilterItem(i, o) \
168     /** the current item */ i(entity, __self) \
169     /**/
170 MUTATOR_HOOKABLE(FilterItem, EV_FilterItem);
171
172 /** return error to request removal */
173 #define EV_TurretSpawn(i, o) \
174     /** turret */ i(entity, __self) \
175     /**/
176 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
177
178 /** return error to not attack */
179 #define EV_TurretFire(i, o) \
180     /** turret */ i(entity, __self) \
181     /**/
182 MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
183
184 /** return error to not attack */
185 #define EV_Turret_CheckFire(i, o) \
186     /**/ i(bool, ret_bool) \
187     /**/ o(bool, ret_bool) \
188     /**/
189 bool ret_bool;
190 MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
191
192 /** return error to prevent entity spawn, or modify the entity */
193 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_NO_ARGS);
194
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);
197
198 /** TODO change this into a general PlayerPostThink hook? */
199 MUTATOR_HOOKABLE(GetPressedKeys, EV_NO_ARGS);
200
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) \
205     /**/
206 float get_cvars_f;
207 string get_cvars_s;
208 MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
209
210 /** can edit any "just fired" projectile */
211 #define EV_EditProjectile(i, o) \
212     /**/ i(entity, __self) \
213     /**/ i(entity, other) \
214     /**/
215 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
216
217 /** called when a monster spawns */
218 MUTATOR_HOOKABLE(MonsterSpawn, EV_NO_ARGS);
219
220 /** called when a monster dies */
221 #define EV_MonsterDies(i, o) \
222     /**/ i(entity, frag_attacker) \
223     /**/
224 MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
225
226 /** called when a monster dies */
227 #define EV_MonsterRemove(i, o) \
228     /**/ i(entity, rem_mon) \
229     /**/
230 entity rem_mon; // avoiding ovewriting self & other
231 MUTATOR_HOOKABLE(MonsterRemove, EV_MonsterRemove);
232
233 /** called when a monster wants to respawn */
234 #define EV_MonsterRespawn(i, o) \
235     /**/ i(entity, other) \
236     /**/
237 MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
238
239 /** called when a monster is dropping loot */
240 #define EV_MonsterDropItem(i, o) \
241     /**/ i(entity, other) \
242     /**/ o(entity, other) \
243     /**/
244 .void(entity this) monster_loot;
245 MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
246
247 /**
248  * called when a monster moves
249  * returning true makes the monster stop
250  */
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) \
257     /**/
258 float monster_speed_run;
259 float monster_speed_walk;
260 entity monster_target;
261 MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
262
263 /** called when a monster looks for another target */
264 MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
265
266 /** called to change a random monster to a miniboss */
267 MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_NO_ARGS);
268
269 /**
270  * called when a player tries to spawn a monster
271  * return 1 to prevent spawning
272  */
273 MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
274
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) \
285     /**/
286 vector damage_force;
287 float damage_take;
288 float damage_save;
289 MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
290
291 /**
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).
294  */
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) \
306     /**/
307 float frag_damage;
308 float frag_mirrordamage;
309 vector frag_force;
310 MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
311
312 /**
313  * Called when a player is damaged
314  */
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) \
322     /**/
323 MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged);
324
325 /**
326  * Called by W_DecreaseAmmo
327  */
328 #define EV_W_DecreaseAmmo(i, o) \
329     /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
330     /**/
331 MUTATOR_HOOKABLE(W_DecreaseAmmo, EV_W_DecreaseAmmo);
332
333 /**
334  * Called by W_Reload
335  */
336 #define EV_W_Reload(i, o) \
337     /** actor */ i(entity, MUTATOR_ARGV_0_entity) \
338     /**/
339 MUTATOR_HOOKABLE(W_Reload, EV_W_Reload);
340
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) \
345     /**/
346 int olditems;
347 MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
348
349 /**
350  * called every player think frame
351  * return 1 to disable regen
352  */
353 float regen_mod_max;
354 float regen_mod_regen;
355 float regen_mod_rot;
356 float regen_mod_limit;
357 float regen_health;
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);
364
365 /**
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
369  */
370 MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
371
372 /**
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()
377  * // example:
378  * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
379  * {
380  *     if (MUTATOR_RETURNVALUE) // command was already handled?
381  *         return false;
382  *     if (cmd_name == "echocvar" && cmd_argc >= 2)
383  *     {
384  *         print(cvar_string(argv(1)), "\n");
385  *         return true;
386  *     }
387  *     if (cmd_name == "echostring" && cmd_argc >= 2)
388  *     {
389  *         print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
390  *         return true;
391  *     }
392  *     return false;
393  * }
394  */
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) \
399     /**/
400 string cmd_name;
401 int cmd_argc;
402 string cmd_string;
403 MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
404
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) \
410     /**/
411 //string cmd_name;
412 //int cmd_argc;
413 //string cmd_string;
414 MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand);
415
416 /**
417  * called when a spawnpoint is being evaluated
418  * return 1 to make the spawnpoint unusable
419  */
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) \
425     /**/
426 vector spawn_score;
427 MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
428
429 /** runs globally each server frame */
430 MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
431
432 #define EV_SetModname(i, o) \
433     /** name of the mutator/mod if it warrants showing as such in the server browser */ \
434     o(string, modname) \
435     /**/
436 MUTATOR_HOOKABLE(SetModname, EV_SetModname);
437
438 /**
439  * called for each item being spawned on a map, including dropped weapons
440  * return 1 to remove an item
441  */
442 #define EV_Item_Spawn(i, o) \
443     /** the item */ i(entity, __self) \
444     /**/
445 MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
446
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) \
452     /**/
453 MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
454
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) \
461     /**/
462 string item_name;
463 vector item_color;
464 MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
465
466 /** called when a bot checks a target to attack */
467 #define EV_BotShouldAttack(i, o) \
468     /**/ i(entity, checkentity) \
469     /**/
470 entity checkentity;
471 MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
472
473 /**
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
476  */
477 #define EV_PortalTeleport(i, o) \
478     /**/ i(entity, __self) \
479     /**/
480 MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
481
482 /**
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
487  */
488 #define EV_HelpMePing(i, o) \
489     /** the player who pressed impulse 33 */ i(entity, __self) \
490     /**/
491 MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
492
493 /**
494  * called when a vehicle initializes
495  * return true to remove the vehicle
496  */
497 MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
498
499 /**
500  * called when a player enters a vehicle
501  * allows mutators to set special settings in this event
502  */
503 #define EV_VehicleEnter(i, o) \
504     /** player */ i(entity, vh_player) \
505     /** vehicle */ i(entity, vh_vehicle) \
506     /**/
507 entity vh_player;
508 entity vh_vehicle;
509 MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
510
511 /**
512  * called when a player touches a vehicle
513  * return true to stop player from entering the vehicle
514  */
515 #define EV_VehicleTouch(i, o) \
516     /** vehicle */ i(entity, __self) \
517     /** player */ i(entity, other) \
518     /**/
519 MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
520
521 /**
522  * called when a player exits a vehicle
523  * allows mutators to set special settings in this event
524  */
525 #define EV_VehicleExit(i, o) \
526     /** player */ i(entity, vh_player) \
527     /** vehicle */ i(entity, vh_vehicle) \
528     /**/
529 MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
530
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) \
534     /**/
535 MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
536
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) \
541     /**/
542 MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
543
544 enum {
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
548 };
549
550 /** called at when a player connect */
551 #define EV_ClientConnect(i, o) \
552     /** player */ i(entity, __self) \
553     /**/
554 MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
555
556 #define EV_HavocBot_ChooseRole(i, o) \
557     /**/ i(entity, __self) \
558     /**/
559 MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
560
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) \
565     /**/
566 MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
567 enum {
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
571 };
572
573 /** Called when clearing the global parameters for a model */
574 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
575
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) \
580     /**/
581 string checkmodel_input, checkmodel_command;
582 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
583
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) \
592     /**/
593 entity bullet_hit;
594 //vector bullet_hitloc; // the end pos matches the hit location, apparently
595 vector bullet_startpos;
596 vector bullet_endpos;
597 //float frag_damage;
598 MUTATOR_HOOKABLE(FireBullet_Hit, EV_FireBullet_Hit);
599
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) \
605     /**/
606 int ret_int;
607 MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel);
608
609 /** Return error to play frag remaining announcements */
610 MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
611
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) \
620     /**/
621 int hook_tarzan;
622 entity hook_pullentity;
623 float hook_velmultiplier;
624 MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
625
626 #define EV_BuffModel_Customize(i, o) \
627     /**/ i(entity, __self) \
628     /**/ i(entity, buff_player) \
629     /**/
630 entity buff_player;
631 MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize);
632
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) \
637     /**/
638 MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
639
640 MUTATOR_HOOKABLE(SetNewParms, EV_NO_ARGS);
641
642 MUTATOR_HOOKABLE(SetChangeParms, EV_NO_ARGS);
643
644 MUTATOR_HOOKABLE(DecodeLevelParms, EV_NO_ARGS);
645
646 #define EV_GetRecords(i, o) \
647     /**/ i(int, record_page) \
648     /**/ i(string, ret_string) \
649     /**/ o(string, ret_string) \
650     /**/
651 int record_page;
652 MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
653
654 #define EV_Race_FinalCheckpoint(i, o) \
655     /**/ i(entity, race_player) \
656     /**/
657 entity race_player;
658 MUTATOR_HOOKABLE(Race_FinalCheckpoint, EV_Race_FinalCheckpoint);
659
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) \
665     /**/
666 MUTATOR_HOOKABLE(ClientKill, EV_ClientKill);
667
668 #define EV_FixClientCvars(i, o) \
669     /**/ i(entity, fix_client) \
670     /**/
671 entity fix_client;
672 MUTATOR_HOOKABLE(FixClientCvars, EV_FixClientCvars);
673
674 #define EV_SpectateSet(i, o) \
675     /**/ i(entity, __self) \
676     /**/ i(entity, spec_player) \
677     /**/ o(entity, spec_player) \
678     /**/
679 entity spec_player;
680 MUTATOR_HOOKABLE(SpectateSet, EV_SpectateSet);
681
682 #define EV_SpectateNext(i, o) \
683     /**/ i(entity, __self) \
684     /**/ i(entity, spec_player) \
685     /**/ o(entity, spec_player) \
686     /**/
687 MUTATOR_HOOKABLE(SpectateNext, EV_SpectateNext);
688
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) \
694     /**/
695 entity spec_first;
696 MUTATOR_HOOKABLE(SpectatePrev, EV_SpectatePrev);
697
698 enum {
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)
702 };
703
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) \
710     /**/
711 int bot_activerealplayers;
712 int bot_realplayers;
713 MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
714
715 #define EV_ClientCommand_Spectate(i, o) \
716     /**/ i(entity, __self) \
717     /**/
718 MUTATOR_HOOKABLE(ClientCommand_Spectate, EV_ClientCommand_Spectate);
719
720 enum {
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
724 };
725
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) \
731     /**/
732 float checkrules_timelimit;
733 int checkrules_fraglimit;
734 MUTATOR_HOOKABLE(CheckRules_World, EV_CheckRules_World);
735
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) \
744     /**/
745 entity want_weaponinfo;
746 bool want_allguns;
747 bool want_mutatorblocked;
748 MUTATOR_HOOKABLE(WantWeapon, EV_WantWeapon);
749
750 #define EV_AddPlayerScore(i, o) \
751     /**/ i(int, score_field) \
752     /**/ i(float, ret_float) \
753     /**/ o(float, ret_float) \
754     /**/
755 int score_field;
756 MUTATOR_HOOKABLE(AddPlayerScore, EV_AddPlayerScore);
757
758 #define EV_GetPlayerStatus(i, o) \
759     /**/ i(entity, set_player) \
760     /**/ i(string, ret_string) \
761     /**/ o(string, ret_string) \
762     /**/
763 entity set_player;
764 MUTATOR_HOOKABLE(GetPlayerStatus, EV_GetPlayerStatus);
765
766 #define EV_SetWeaponArena(i, o) \
767     /**/ i(string, ret_string) \
768     /**/ o(string, ret_string) \
769     /**/
770 MUTATOR_HOOKABLE(SetWeaponArena, EV_SetWeaponArena);
771
772 #define EV_DropSpecialItems(i, o) \
773     /**/ i(entity, frag_target) \
774     /**/
775 MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
776
777 /**
778  * called when an admin tries to kill all monsters
779  * return 1 to prevent spawning
780  */
781 MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
782
783 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
784
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) \
792     /**/
793 entity wp_sendto;
794 int wp_sendflags;
795 int wp_flag;
796 MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
797
798 #define EV_TurretValidateTarget(i, o) \
799     /**/ i(entity, turret_this) \
800     /**/ i(entity, turret_target) \
801     /**/ i(int, turret_vflags) \
802     /**/
803 entity turret_this;
804 entity turret_target;
805 int turret_vflags;
806 MUTATOR_HOOKABLE(TurretValidateTarget, EV_TurretValidateTarget);
807
808 #define EV_TurretThink(i, o) \
809     /**/ i(entity, __self) \
810     /**/
811 MUTATOR_HOOKABLE(TurretThink, EV_TurretThink);
812
813 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
814
815 /** */
816 #define EV_PrepareExplosionByDamage(i, o) \
817     /**/ i(entity, __self) \
818     /**/ i(entity, frag_attacker) \
819     /**/
820 MUTATOR_HOOKABLE(PrepareExplosionByDamage, EV_PrepareExplosionByDamage);
821
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) \
827     /**/
828 string monster_model;
829 string monster_model_output;
830 MUTATOR_HOOKABLE(MonsterModel, EV_MonsterModel);
831
832 /**/
833 #define EV_Player_ChangeTeam(i, o) \
834     /**/ i(entity, __self) \
835     /**/ i(float, pct_curteam) \
836     /**/ i(float, pct_newteam) \
837     /**/
838 float pct_curteam;
839 float pct_newteam;
840 MUTATOR_HOOKABLE(Player_ChangeTeam, EV_Player_ChangeTeam);
841 #endif