/**/
float get_cvars_f;
string get_cvars_s;
-MUTATOR_HOOKABLE(GetCvars, EV_GetCvars);
+MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because of `SZ_GetSpace: overflow`
/** can edit any "just fired" projectile */
#define EV_EditProjectile(i, o) \
/**/
MUTATOR_HOOKABLE(MonsterDies, EV_MonsterDies);
-MUTATOR_HOOKABLE(MonsterRespawn, EV_NO_ARGS);
- // called when a monster wants to respawn
- // INPUT:
-// entity other;
-
-MUTATOR_HOOKABLE(MonsterDropItem, EV_NO_ARGS);
- // called when a monster is dropping loot
- // INPUT, OUTPUT:
- .void() monster_loot;
-// entity other;
-
-MUTATOR_HOOKABLE(MonsterMove, EV_NO_ARGS);
- // called when a monster moves
- // returning true makes the monster stop
- // INPUT:
- float monster_speed_run;
- float monster_speed_walk;
- entity monster_target;
+/** called when a monster wants to respawn */
+#define EV_MonsterRespawn(i, o) \
+ /**/ i(entity, other) \
+ /**/
+MUTATOR_HOOKABLE(MonsterRespawn, EV_MonsterRespawn);
+
+/** called when a monster is dropping loot */
+#define EV_MonsterDropItem(i, o) \
+ /**/ i(entity, other) \
+ /**/ o(entity, other) \
+ /**/
+.void() monster_loot;
+MUTATOR_HOOKABLE(MonsterDropItem, EV_MonsterDropItem);
+/**
+ * called when a monster moves
+ * returning true makes the monster stop
+ */
+#define EV_MonsterMove(i, o) \
+ /**/ i(float, monster_speed_run) \
+ /**/ o(float, monster_speed_run) \
+ /**/ i(float, monster_speed_walk) \
+ /**/ o(float, monster_speed_walk) \
+ /**/ i(entity, monster_target) \
+ /**/
+float monster_speed_run;
+float monster_speed_walk;
+entity monster_target;
+MUTATOR_HOOKABLE(MonsterMove, EV_MonsterMove);
+
+/** called when a monster looks for another target */
MUTATOR_HOOKABLE(MonsterFindTarget, EV_NO_ARGS);
- // called when a monster looks for another target
+/** called to change a random monster to a miniboss */
MUTATOR_HOOKABLE(MonsterCheckBossFlag, EV_NO_ARGS);
- // called to change a random monster to a miniboss
+/**
+ * called when a player tries to spawn a monster
+ * return 1 to prevent spawning
+ */
MUTATOR_HOOKABLE(AllowMobSpawning, EV_NO_ARGS);
- // called when a player tries to spawn a monster
- // return 1 to prevent spawning
-
-MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_NO_ARGS);
- // called when a player gets damaged to e.g. remove stuff he was carrying.
- // INPUT:
-// entity frag_inflictor;
-// entity frag_attacker;
-// entity frag_target; // same as self
- vector damage_force; // NOTE: this force already HAS been applied
- // INPUT, OUTPUT:
- float damage_take;
- float damage_save;
-
-MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_NO_ARGS);
- // called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
- // i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
- // INPUT:
-// entity frag_attacker;
-// entity frag_target;
-// float frag_deathtype;
- // INPUT, OUTPUT:
- float frag_damage;
- float frag_mirrordamage;
- vector frag_force;
-
-MUTATOR_HOOKABLE(PlayerPowerups, EV_NO_ARGS);
- // called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items.
- // INPUT
-// entity self;
- int olditems; // also technically output, but since it is at the end of the function it's useless for that :P
-
-MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
- // called every player think frame
- // return 1 to disable regen
- // INPUT, OUTPUT:
- float regen_mod_max;
- float regen_mod_regen;
- float regen_mod_rot;
- float regen_mod_limit;
+/** called when a player gets damaged to e.g. remove stuff he was carrying. */
+#define EV_PlayerDamage_SplitHealthArmor(i, o) \
+ /**/ i(entity, frag_inflictor) \
+ /**/ i(entity, frag_attacker) \
+ /** same as self */ i(entity, frag_target) \
+ /** NOTE: this force already HAS been applied */ i(vector, damage_force) \
+ /**/ i(float, damage_take) \
+ /**/ o(float, damage_take) \
+ /**/ i(float, damage_save) \
+ /**/ o(float, damage_save) \
+ /**/
+vector damage_force;
+float damage_take;
+float damage_save;
+MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor);
+
+/**
+ * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
+ * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
+ */
+#define EV_PlayerDamage_Calculate(i, o) \
+ /**/ i(entity, frag_attacker) \
+ /**/ i(entity, frag_target) \
+ /**/ i(float, frag_deathtype) \
+ /**/ i(float, frag_damage) \
+ /**/ o(float, frag_damage) \
+ /**/ i(float, frag_mirrordamage) \
+ /**/ o(float, frag_mirrordamage) \
+ /**/ i(vector, frag_force) \
+ /**/ o(vector, frag_force) \
+ /**/
+float frag_damage;
+float frag_mirrordamage;
+vector frag_force;
+MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
+
+/** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
+#define EV_PlayerPowerups(i, o) \
+ /**/ i(entity, self) \
+ /**/ i(int, olditems) \
+ /**/
+int olditems;
+MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups);
+
+/**
+ * called every player think frame
+ * return 1 to disable regen
+ */
+#define EV_PlayerRegen(i, o) \
+ /**/ i(float, regen_mod_max) \
+ /**/ o(float, regen_mod_max) \
+ /**/ i(float, regen_mod_regen) \
+ /**/ o(float, regen_mod_regen) \
+ /**/ i(float, regen_mod_rot) \
+ /**/ o(float, regen_mod_rot) \
+ /**/ i(float, regen_mod_limit) \
+ /**/ o(float, regen_mod_limit) \
+ /**/
+float regen_mod_max;
+float regen_mod_regen;
+float regen_mod_rot;
+float regen_mod_limit;
+MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
+
+/**
+ * called when the use key is pressed
+ * if MUTATOR_RETURNVALUE is 1, don't do anything
+ * return 1 if the use key actually did something
+ */
MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
- // called when the use key is pressed
- // if MUTATOR_RETURNVALUE is 1, don't do anything
- // return 1 if the use key actually did something
-
-MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_NO_ARGS);
- // called when a client command is parsed
- // NOTE: hooks MUST start with if(MUTATOR_RETURNVALUE) return 0;
- // NOTE: return 1 if you handled the command, return 0 to continue handling
- // NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
- // INPUT
- string cmd_name; // command name
- int cmd_argc; // also, argv() can be used
- string cmd_string; // whole command, use only if you really have to
- /*
- // example:
- MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
- {
- if(MUTATOR_RETURNVALUE) // command was already handled?
- return 0;
- if(cmd_name == "echocvar" && cmd_argc >= 2)
- {
- print(cvar_string(argv(1)), "\n");
- return 1;
- }
- if(cmd_name == "echostring" && cmd_argc >= 2)
- {
- print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
- return 1;
- }
- return 0;
- }
- */
-
-MUTATOR_HOOKABLE(Spawn_Score, EV_NO_ARGS);
- // called when a spawnpoint is being evaluated
- // return 1 to make the spawnpoint unusable
- // INPUT
-// entity self; // player wanting to spawn
-// entity spawn_spot; // spot to be evaluated
- // IN+OUT
- vector spawn_score; // _x is priority, _y is "distance"
+/**
+ * called when a client command is parsed
+ * NOTE: hooks MUST start with if(MUTATOR_RETURNVALUE) return 0;
+ * NOTE: return 1 if you handled the command, return 0 to continue handling
+ * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
+ * // example:
+ * MUTATOR_HOOKFUNCTION(foo_SV_ParseClientCommand)
+ * {
+ * if (MUTATOR_RETURNVALUE) // command was already handled?
+ * return false;
+ * if (cmd_name == "echocvar" && cmd_argc >= 2)
+ * {
+ * print(cvar_string(argv(1)), "\n");
+ * return true;
+ * }
+ * if (cmd_name == "echostring" && cmd_argc >= 2)
+ * {
+ * print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
+ * return true;
+ * }
+ * return false;
+ * }
+ */
+#define EV_SV_ParseClientCommand(i, o) \
+ /** command name */ i(string, cmd_name) \
+ /** also, argv() can be used */ i(int, cmd_argc) \
+ /** whole command, use only if you really have to */ i(string, cmd_string) \
+ /**/
+string cmd_name;
+int cmd_argc;
+string cmd_string;
+MUTATOR_HOOKABLE(SV_ParseClientCommand, EV_SV_ParseClientCommand);
+
+/**
+ * called when a spawnpoint is being evaluated
+ * return 1 to make the spawnpoint unusable
+ */
+#define EV_Spawn_Score(i, o) \
+ /** player wanting to spawn */ i(entity, self) \
+ /** spot to be evaluated */ i(entity, spawn_spot) \
+ /** _x is priority, _y is "distance" */ i(vector, spawn_score) \
+ /**/ o(vector, spawn_score) \
+ /**/
+vector spawn_score;
+MUTATOR_HOOKABLE(Spawn_Score, EV_Spawn_Score);
+
+/** runs globally each server frame */
MUTATOR_HOOKABLE(SV_StartFrame, EV_NO_ARGS);
- // runs globally each server frame
-
-MUTATOR_HOOKABLE(SetModname, EV_NO_ARGS);
- // OUT
-// string modname; // name of the mutator/mod if it warrants showing as such in the server browser
-
-MUTATOR_HOOKABLE(Item_Spawn, EV_NO_ARGS);
- // called for each item being spawned on a map, including dropped weapons
- // return 1 to remove an item
- // INPUT
-// entity self; // the item
-
-MUTATOR_HOOKABLE(SetWeaponreplace, EV_NO_ARGS);
- // IN
-// entity self; // map entity
-// entity other; // weapon info
- // IN+OUT
-// string ret_string;
-
-MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_NO_ARGS);
- // called when an item is about to respawn
- // INPUT+OUTPUT:
- string item_name;
- vector item_color;
-
-MUTATOR_HOOKABLE(BotShouldAttack, EV_NO_ARGS);
- // called when a bot checks a target to attack
- // INPUT
- entity checkentity;
-
-MUTATOR_HOOKABLE(PortalTeleport, EV_NO_ARGS);
- // called whenever a player goes through a portal gun teleport
- // allows you to strip a player of an item if they go through the teleporter to help prevent cheating
- // INPUT
-// entity self;
-
-MUTATOR_HOOKABLE(HelpMePing, EV_NO_ARGS);
- // called whenever a player uses impulse 33 (help me) in cl_impulse.qc
- // normally help me ping uses self.waypointsprite_attachedforcarrier,
- // but if your mutator uses something different then you can handle it
- // in a special manner using this hook
- // INPUT
-// entity self; // the player who pressed impulse 33
+#define EV_SetModname(i, o) \
+ /** name of the mutator/mod if it warrants showing as such in the server browser */ \
+ o(string, modname) \
+ /**/
+MUTATOR_HOOKABLE(SetModname, EV_SetModname);
+
+/**
+ * called for each item being spawned on a map, including dropped weapons
+ * return 1 to remove an item
+ */
+#define EV_Item_Spawn(i, o) \
+ /** the item */ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
+
+#define EV_SetWeaponreplace(i, o) \
+ /** map entity */ i(entity, self) \
+ /** weapon info */ i(entity, other) \
+ /**/ i(string, ret_string) \
+ /**/ o(string, ret_string) \
+ /**/
+MUTATOR_HOOKABLE(SetWeaponreplace, EV_SetWeaponreplace);
+
+/** called when an item is about to respawn */
+#define EV_Item_RespawnCountdown(i, o) \
+ /**/ i(string, item_name) \
+ /**/ o(string, item_name) \
+ /**/ i(vector, item_color) \
+ /**/ o(vector, item_color) \
+ /**/
+string item_name;
+vector item_color;
+MUTATOR_HOOKABLE(Item_RespawnCountdown, EV_Item_RespawnCountdown);
+
+/** called when a bot checks a target to attack */
+#define EV_BotShouldAttack(i, o) \
+ /**/ i(entity, checkentity) \
+ /**/
+entity checkentity;
+MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack);
+
+/**
+ * called whenever a player goes through a portal gun teleport
+ * allows you to strip a player of an item if they go through the teleporter to help prevent cheating
+ */
+#define EV_PortalTeleport(i, o) \
+ /**/ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
+
+/**
+ * called whenever a player uses impulse 33 (help me) in cl_impulse.qc
+ * normally help me ping uses self.waypointsprite_attachedforcarrier,
+ * but if your mutator uses something different then you can handle it
+ * in a special manner using this hook
+ */
+#define EV_HelpMePing(i, o) \
+ /** the player who pressed impulse 33 */ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
+
+/**
+ * called when a vehicle initializes
+ * return true to remove the vehicle
+ */
MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
- // called when a vehicle initializes
- // return true to remove the vehicle
-
-MUTATOR_HOOKABLE(VehicleEnter, EV_NO_ARGS);
- // called when a player enters a vehicle
- // allows mutators to set special settings in this event
- // INPUT
- entity vh_player; // player
- entity vh_vehicle; // vehicle
-
-MUTATOR_HOOKABLE(VehicleTouch, EV_NO_ARGS);
- // called when a player touches a vehicle
- // return true to stop player from entering the vehicle
- // INPUT
-// entity self; // vehicle
-// entity other; // player
-
-MUTATOR_HOOKABLE(VehicleExit, EV_NO_ARGS);
- // called when a player exits a vehicle
- // allows mutators to set special settings in this event
- // INPUT
-// entity vh_player; // player
-// entity vh_vehicle; // vehicle
-
-MUTATOR_HOOKABLE(AbortSpeedrun, EV_NO_ARGS);
- // called when a speedrun is aborted and the player is teleported back to start position
- // INPUT
-// entity self; // player
-
-MUTATOR_HOOKABLE(ItemTouch, EV_NO_ARGS);
- // called at when a item is touched. Called early, can edit item properties.
-// entity self; // item
-// entity other; // player
+
+/**
+ * called when a player enters a vehicle
+ * allows mutators to set special settings in this event
+ */
+#define EV_VehicleEnter(i, o) \
+ /** player */ i(entity, vh_player) \
+ /** vehicle */ i(entity, vh_vehicle) \
+ /**/
+entity vh_player;
+entity vh_vehicle;
+MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter);
+
+/**
+ * called when a player touches a vehicle
+ * return true to stop player from entering the vehicle
+ */
+#define EV_VehicleTouch(i, o) \
+ /** vehicle */ i(entity, self) \
+ /** player */ i(entity, other) \
+ /**/
+MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
+
+/**
+ * called when a player exits a vehicle
+ * allows mutators to set special settings in this event
+ */
+#define EV_VehicleExit(i, o) \
+ /** player */ i(entity, vh_player) \
+ /** vehicle */ i(entity, vh_vehicle) \
+ /**/
+MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit);
+
+/** called when a speedrun is aborted and the player is teleported back to start position */
+#define EV_AbortSpeedrun(i, o) \
+ /** player */ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
+
+/** called at when a item is touched. Called early, can edit item properties. */
+#define EV_ItemTouch(i, o) \
+ /** item */ i(entity, self) \
+ /** player */ i(entity, other) \
+ /**/
+MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
+
enum {
MUT_ITEMTOUCH_CONTINUE, // return this flag to make the function continue as normal
MUT_ITEMTOUCH_RETURN, // return this flag to make the function return (handled entirely by mutator)
MUT_ITEMTOUCH_PICKUP // return this flag to have the item "picked up" and taken even after mutator handled it
};
-MUTATOR_HOOKABLE(ClientConnect, EV_NO_ARGS);
- // called at when a player connect
-// entity self; // player
+/** called at when a player connect */
+#define EV_ClientConnect(i, o) \
+ /** player */ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
-MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_NO_ARGS);
-// entity self;
+#define EV_HavocBot_ChooseRole(i, o) \
+ /**/ i(entity, self) \
+ /**/
+MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
-MUTATOR_HOOKABLE(AccuracyTargetValid, EV_NO_ARGS);
- // called when a target is checked for accuracy
-// entity frag_attacker; // attacker
-// entity frag_target; // target
+/** called when a target is checked for accuracy */
+#define EV_AccuracyTargetValid(i, o) \
+ /** attacker */ i(entity, frag_attacker) \
+ /** target */ i(entity, frag_target) \
+ /**/
+MUTATOR_HOOKABLE(AccuracyTargetValid, EV_AccuracyTargetValid);
enum {
MUT_ACCADD_VALID, // return this flag to make the function continue if target is a client
MUT_ACCADD_INVALID, // return this flag to make the function always continue