1 #ifndef CLIENT_MUTATORS_EVENTS_H
2 #define CLIENT_MUTATORS_EVENTS_H
4 #include "../../common/mutators/base.qh"
13 * Called when a client command is parsed
14 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
15 * NOTE: return true if you handled the command, return false to continue handling
16 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
18 * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
19 * if (MUTATOR_RETURNVALUE) return false; // command was already handled
20 * if (cmd_name == "echocvar" && cmd_argc >= 2) {
21 * print(cvar_string(argv(1)), "\n");
24 * if (cmd_name == "echostring" && cmd_argc >= 2) {
25 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
31 #define EV_CSQC_ConsoleCommand(i, o) \
32 /** command name */ i(string, cmd_name) \
33 /** also, argv() can be used */ i(int, cmd_argc) \
34 /** whole command, use only if you really have to */ i(string, cmd_string) \
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
42 * Called when a temp entity is parsed
43 * NOTE: hooks MUST start with `if (MUTATOR_RETURNVALUE) return false;`
44 * NOTE: hooks MUST start with `if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return false;`
45 * NOTE: return true if you handled the command, return false to continue handling
47 #define EV_CSQC_Parse_TempEntity(i, o) \
48 /** mutator id */ i(int, mutator_argv_int_0) \
50 MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity);
53 * Called when a shared entity is updated
54 * NOTE: hooks MUST start with `if (MUTATOR_RETURNVALUE) return false;`
55 * NOTE: hooks MUST start with `if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return false;`
56 * NOTE: return true if you handled the command, return false to continue handling
58 #define EV_CSQC_Ent_Update(i, o) \
59 /** mutator id */ i(int, mutator_argv_int_0) \
60 /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \
62 MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update);
64 /** Called when a projectile is linked with CSQC */
65 #define EV_Ent_Projectile(i, o) \
66 /** entity id */ i(entity, self) \
68 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
70 /** Called when a projectile's properties are being modified */
71 #define EV_EditProjectile(i, o) \
72 /** entity id */ i(entity, self) \
74 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
76 /* Called when projectiles are precached */
77 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
79 /** Called when updating the attached tags index */
80 #define EV_TagIndex_Update(i, o) \
81 /** entity id */ i(entity, self) \
83 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
85 /** Called when setting the attached tags */
86 #define EV_TagIndex_Apply(i, o) \
87 /** entity id */ i(entity, self) \
89 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);