e.monster_loot = self.monster_loot;
- other = e;
- MUTATOR_CALLHOOK(MonsterDropItem);
+ MUTATOR_CALLHOOK(MonsterDropItem, e);
e = other;
if(e && e.monster_loot)
{
other = ent;
if(ent.deadflag == DEAD_DEAD) // don't call when monster isn't dead
- if(MUTATOR_CALLHOOK(MonsterRespawn))
+ if(MUTATOR_CALLHOOK(MonsterRespawn, ent))
return true; // enabled by a mutator
if(ent.spawnflags & MONSTERFLAG_NORESPAWN)
targ = self.goalentity;
- monster_target = targ;
- monster_speed_run = runspeed;
- monster_speed_walk = walkspeed;
-
- if(MUTATOR_CALLHOOK(MonsterMove) || gameover || self.draggedby != world || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time)
+ if (MUTATOR_CALLHOOK(MonsterMove, runspeed, walkspeed, targ)
+ || gameover
+ || self.draggedby != world
+ || (round_handler_IsActive() && !round_handler_IsRoundStarted())
+ || time < game_starttime
+ || (autocvar_g_campaign && !campaign_bots_may_start)
+ || time < self.spawn_time)
{
runspeed = walkspeed = 0;
if(time >= self.spawn_time)
return;
}
- targ = monster_target;
runspeed = bound(0, monster_speed_run * Monster_SkillModifier(), runspeed * 2); // limit maxspeed to prevent craziness
walkspeed = bound(0, monster_speed_walk * Monster_SkillModifier(), walkspeed * 2); // limit maxspeed to prevent craziness
void player_powerups (void)
{
// add a way to see what the items were BEFORE all of these checks for the mutator hook
- olditems = self.items;
+ int items_prev = self.items;
if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover)
self.modelflags |= MF_ROCKET;
if (time < self.spawnshieldtime)
self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
- MUTATOR_CALLHOOK(PlayerPowerups);
+ MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
}
float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
{
float max_mod, regen_mod, rot_mod, limit_mod;
max_mod = regen_mod = rot_mod = limit_mod = 1;
- regen_mod_max = max_mod;
- regen_mod_regen = regen_mod;
- regen_mod_rot = rot_mod;
- regen_mod_limit = limit_mod;
- if(!MUTATOR_CALLHOOK(PlayerRegen))
+ if(!MUTATOR_CALLHOOK(PlayerRegen, max_mod, regen_mod, rot_mod, limit_mod))
if(!self.frozen)
{
float minh, mina, maxh, maxa, limith, limita;
/**/
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);
MUTATOR_HOOKABLE(PlayerUseKey, EV_NO_ARGS);
// called when the use key is pressed