From: Mario Date: Fri, 10 Jun 2016 18:33:41 +0000 (+1000) Subject: Cleanse PlayerRegen X-Git-Tag: xonotic-v0.8.2~833 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1a0e96c3a4c78f4e5c38ea07267ecf6136cd0454;p=xonotic%2Fxonotic-data.pk3dir.git Cleanse PlayerRegen --- diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index 24599e358..ab389278d 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -10,7 +10,7 @@ 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; }); diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index b89871c84..cd72bb46b 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -1036,16 +1036,18 @@ MUTATOR_HOOKFUNCTION(buffs, VehicleExit) } 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"); diff --git a/qcsrc/common/mutators/mutator/overkill/overkill.qc b/qcsrc/common/mutators/mutator/overkill/overkill.qc index a25dbe3e7..323286bbe 100644 --- a/qcsrc/common/mutators/mutator/overkill/overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/overkill.qc @@ -165,12 +165,16 @@ MUTATOR_HOOKFUNCTION(ok, MonsterDropItem) } 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; @@ -178,7 +182,8 @@ MUTATOR_HOOKFUNCTION(ok, PlayerRegen) 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 } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 457822e8e..93a63e5ac 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1483,18 +1483,28 @@ void player_regen(entity this) { 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; @@ -1503,11 +1513,6 @@ void player_regen(entity this) 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; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 4c25477c3..a18b6b80d 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -361,17 +361,30 @@ MUTATOR_HOOKABLE(PlayerPowerups, EV_PlayerPowerups); * 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