3 #include <common/mutators/base.qh>
6 * Called when a client command is parsed
7 * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
8 * NOTE: return true if you handled the command, return false to continue handling
9 * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
11 * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
12 * if (MUTATOR_RETURNVALUE) return false; // command was already handled
13 * string cmd_name = M_ARGV(0, string);
14 * int cmd_argc = M_ARGV(1, int);
15 * if (cmd_name == "echocvar" && cmd_argc >= 2) {
16 * print(cvar_string(argv(1)), "\n");
19 * if (cmd_name == "echostring" && cmd_argc >= 2) {
20 * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
26 #define EV_CSQC_ConsoleCommand(i, o) \
27 /** command name */ i(string, MUTATOR_ARGV_0_string) \
28 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_1_int) \
29 /** whole command, use only if you really have to */ i(string, MUTATOR_ARGV_2_string) \
31 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
33 /* Called when the crosshair is being updated */
34 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
36 /** Called when a projectile is linked with CSQC */
37 #define EV_Ent_Projectile(i, o) \
38 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
40 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
42 /** Called when a projectile's properties are being modified */
43 #define EV_EditProjectile(i, o) \
44 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
46 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
48 /* Called when projectiles are precached */
49 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
51 /** Called when updating the attached tags index */
52 #define EV_TagIndex_Update(i, o) \
53 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
55 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
57 /** Called when setting the attached tags */
58 #define EV_TagIndex_Apply(i, o) \
59 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
61 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
63 /** Called when setting up skeleton bones */
64 #define EV_Skeleton_CheckBones(i, o) \
65 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
67 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
69 /** Called when setting up bones from the loaded model */
70 #define EV_Skeleton_CheckModel(i, o) \
71 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
73 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
75 /** Called when clearing the global parameters for a model */
76 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
78 /** Called when getting the global parameters for a model */
79 #define EV_GetModelParams(i, o) \
80 /** input */ i(string, MUTATOR_ARGV_0_string) \
81 /** command */ i(string, MUTATOR_ARGV_1_string) \
83 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
85 /** Called checking if 3rd person mode should be forced on */
86 #define EV_WantEventchase(i, o) \
87 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
89 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
91 /** allow customizing 3rd person mode effect */
92 #define EV_CustomizeEventchase(i, o) \
93 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
94 /* current_view_origin_override */ o(vector, MUTATOR_ARGV_0_vector) \
95 /* view_offset_override */ o(vector, MUTATOR_ARGV_1_vector) \
96 /* chase_distance_override */ o(float, MUTATOR_ARGV_0_float) \
98 MUTATOR_HOOKABLE(CustomizeEventchase, EV_CustomizeEventchase);
100 #define EV_AnnouncerOption(i, o) \
101 /** announcer string */ i(string, MUTATOR_ARGV_0_string) \
102 /** announcer string */ o(string, MUTATOR_ARGV_0_string) \
104 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
106 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
108 #define EV_HUD_Draw_overlay(i, o) \
109 /**/ o(vector, MUTATOR_ARGV_0_vector) \
110 /**/ o(float, MUTATOR_ARGV_1_float) \
112 MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
114 MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
116 /** Return true to not draw any vortex beam */
117 #define EV_Particles_VortexBeam(i, o) \
118 /** beam shot origin */ i(vector, MUTATOR_ARGV_0_vector) \
119 /** beam end position */ i(vector, MUTATOR_ARGV_1_vector) \
121 MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
123 /** Return true to not draw any impact effect */
124 #define EV_Weapon_ImpactEffect(i, o) \
125 /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \
126 /** damage entity */ i(entity, MUTATOR_ARGV_1_entity) \
128 MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
130 /* NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
132 #define EV_HUD_Command(i, o) \
133 /** argc (also, argv() can be used) */ i(int, MUTATOR_ARGV_0_int) \
135 MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command);
137 /** Draw the grapple hook, allows changing hook texture and colour */
138 #define EV_DrawGrapplingHook(i, o) \
139 /** hook */ i(entity, MUTATOR_ARGV_0_entity) \
140 /** texture */ i(string, MUTATOR_ARGV_1_string) \
141 /***/ o(string, MUTATOR_ARGV_1_string) \
142 /** colour */ i(vector, MUTATOR_ARGV_2_vector) \
143 /***/ o(vector, MUTATOR_ARGV_2_vector) \
144 /** team */ i(float, MUTATOR_ARGV_3_float) \
146 MUTATOR_HOOKABLE(DrawGrapplingHook, EV_DrawGrapplingHook);
148 /** Called when an entity is updated (either by SVQC networking or PVS) */
149 #define EV_Ent_Update(i, o) \
150 /** entity id */ i(entity, MUTATOR_ARGV_0_entity) \
151 /** is new to client */ i(bool, MUTATOR_ARGV_1_bool) \
153 MUTATOR_HOOKABLE(Ent_Update, EV_Ent_Update);
155 /** Return true to not draw crosshair */
156 MUTATOR_HOOKABLE(DrawCrosshair, EV_NO_ARGS);
158 /** Return true to not draw scoreboard */
159 MUTATOR_HOOKABLE(DrawScoreboard, EV_NO_ARGS);