bool monsters_animoverride(entity this)
{
Monster monster_id = NULL;
- FOREACH(Monsters, it != MON_Null && it.m_model == this.model, {
+ FOREACH(Monsters, it != MON_Null && it.m_model.model_str() == this.model, {
monster_id = it;
break;
});
}
MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
-{SELFPARAM();
- if(this.buffs & BUFF_MEDIC.m_itemid)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.buffs & BUFF_MEDIC.m_itemid)
{
- regen_mod_rot = autocvar_g_buffs_medic_rot;
- regen_mod_limit = regen_mod_max = autocvar_g_buffs_medic_max;
- regen_mod_regen = autocvar_g_buffs_medic_regen;
+ M_ARGV(2, float) = autocvar_g_buffs_medic_rot; // rot_mod
+ M_ARGV(4, float) = M_ARGV(1, float) = autocvar_g_buffs_medic_max; // limit_mod = max_mod
+ M_ARGV(2, float) = autocvar_g_buffs_medic_regen; // regen_mod
}
- if(this.buffs & BUFF_SPEED.m_itemid)
- regen_mod_regen = autocvar_g_buffs_speed_regen;
+ if(player.buffs & BUFF_SPEED.m_itemid)
+ M_ARGV(2, float) = autocvar_g_buffs_speed_regen; // regen_mod
}
REPLICATE(cvar_cl_buffs_autoreplace, bool, "cl_buffs_autoreplace");
}
MUTATOR_HOOKFUNCTION(ok, PlayerRegen)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
// overkill's values are different, so use custom regen
- if(!STAT(FROZEN, this))
+ if(!STAT(FROZEN, player))
{
- this.armorvalue = CalcRotRegen(this.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > this.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > this.pauserotarmor_finished), autocvar_g_balance_armor_limit);
- this.health = CalcRotRegen(this.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > this.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > this.pauserothealth_finished), autocvar_g_balance_health_limit);
+ player.armorvalue = CalcRotRegen(player.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear,
+ 1 * frametime * (time > player.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > player.pauserotarmor_finished), autocvar_g_balance_armor_limit);
+ player.health = CalcRotRegen(player.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > player.ok_pauseregen_finished), 200, 0,
+ autocvar_g_balance_health_rotlinear, 1 * frametime * (time > player.pauserothealth_finished), autocvar_g_balance_health_limit);
float minf, maxf, limitf;
minf = autocvar_g_balance_fuel_regenstable;
limitf = autocvar_g_balance_fuel_limit;
- this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
+ player.ammo_fuel = CalcRotRegen(player.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear,
+ frametime * (time > player.pauseregen_finished) * ((player.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > player.pauserotfuel_finished), limitf);
}
return true; // return true anyway, as frozen uses no regen
}
{
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;
-
- regen_health = autocvar_g_balance_health_regen;
- regen_health_linear = autocvar_g_balance_health_regenlinear;
- regen_health_rot = autocvar_g_balance_health_rot;
- regen_health_rotlinear = autocvar_g_balance_health_rotlinear;
- regen_health_stable = autocvar_g_balance_health_regenstable;
- regen_health_rotstable = autocvar_g_balance_health_rotstable;
- if(!MUTATOR_CALLHOOK(PlayerRegen))
+
+ float regen_health = autocvar_g_balance_health_regen;
+ float regen_health_linear = autocvar_g_balance_health_regenlinear;
+ float regen_health_rot = autocvar_g_balance_health_rot;
+ float regen_health_rotlinear = autocvar_g_balance_health_rotlinear;
+ float regen_health_stable = autocvar_g_balance_health_regenstable;
+ float regen_health_rotstable = autocvar_g_balance_health_rotstable;
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(PlayerRegen, this, max_mod, regen_mod, rot_mod, limit_mod, regen_health, regen_health_linear, regen_health_rot,
+ regen_health_rotlinear, regen_health_stable, regen_health_rotstable);
+ max_mod = M_ARGV(1, float);
+ regen_mod = M_ARGV(2, float);
+ rot_mod = M_ARGV(3, float);
+ limit_mod = M_ARGV(4, float);
+ regen_health = M_ARGV(5, float);
+ regen_health_linear = M_ARGV(6, float);
+ regen_health_rot = M_ARGV(7, float);
+ regen_health_rotlinear = M_ARGV(8, float);
+ regen_health_stable = M_ARGV(9, float);
+ regen_health_rotstable = M_ARGV(10, float);
+
+
+ if(!mutator_returnvalue)
if(!STAT(FROZEN, this))
{
float mina, maxa, limith, limita;
limith = autocvar_g_balance_health_limit;
limita = autocvar_g_balance_armor_limit;
- max_mod = regen_mod_max;
- regen_mod = regen_mod_regen;
- rot_mod = regen_mod_rot;
- limit_mod = regen_mod_limit;
-
regen_health_rotstable = regen_health_rotstable * max_mod;
regen_health_stable = regen_health_stable * max_mod;
limith = limith * limit_mod;
* called every player think frame
* return 1 to disable regen
*/
-float regen_mod_max;
-float regen_mod_regen;
-float regen_mod_rot;
-float regen_mod_limit;
-float regen_health;
-float regen_health_linear;
-float regen_health_rot;
-float regen_health_rotlinear;
-float regen_health_stable;
-float regen_health_rotstable;
-MUTATOR_HOOKABLE(PlayerRegen, EV_NO_ARGS);
+ #define EV_PlayerRegen(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** max_mod */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /** regen_mod */ i(float, MUTATOR_ARGV_2_float) \
+ /**/ o(float, MUTATOR_ARGV_2_float) \
+ /** rot_mod */ i(float, MUTATOR_ARGV_3_float) \
+ /**/ o(float, MUTATOR_ARGV_3_float) \
+ /** limit_mod */ i(float, MUTATOR_ARGV_4_float) \
+ /**/ o(float, MUTATOR_ARGV_4_float) \
+ /** health_regen */ i(float, MUTATOR_ARGV_5_float) \
+ /**/ o(float, MUTATOR_ARGV_5_float) \
+ /** health_regenlinear */ i(float, MUTATOR_ARGV_6_float) \
+ /**/ o(float, MUTATOR_ARGV_6_float) \
+ /** health_rot */ i(float, MUTATOR_ARGV_7_float) \
+ /**/ o(float, MUTATOR_ARGV_7_float) \
+ /** health_rotlinear */ i(float, MUTATOR_ARGV_8_float) \
+ /**/ o(float, MUTATOR_ARGV_8_float) \
+ /** health_stable */ i(float, MUTATOR_ARGV_9_float) \
+ /**/ o(float, MUTATOR_ARGV_9_float) \
+ /** health_rotstable */ i(float, MUTATOR_ARGV_10_float) \
+ /**/ o(float, MUTATOR_ARGV_10_float) \
+ /**/
+MUTATOR_HOOKABLE(PlayerRegen, EV_PlayerRegen);
/**
* called when the use key is pressed