From: terencehill Date: Thu, 22 Sep 2016 11:57:14 +0000 (+0200) Subject: Simplify overkill's regen code by customizing generic regen code parameters rather... X-Git-Tag: xonotic-v0.8.2~553^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d36c1a9a3cfa3cf5149713415ca3647e561ab59a;p=xonotic%2Fxonotic-data.pk3dir.git Simplify overkill's regen code by customizing generic regen code parameters rather than using dedicated code with some hardcoded parameters (given the current overkill cvar values, behaviour should be the same). Regen now gets properly disabled playing game types like LMS and CA. --- diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index 572261528..df19a665d 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -21,7 +21,7 @@ float autocvar_g_overkill_ammo_charge_limit; .float ok_use_ammocharge = _STAT(OK_AMMO_CHARGE); .float ok_ammo_charge = _STAT(OK_AMMO_CHARGEPOOL); -.float ok_pauseregen_finished; +.float pauseregen_finished; void(entity ent, float wep) ok_DecreaseCharge; @@ -122,7 +122,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerDamage_SplitHealthArmor) float damage_take = M_ARGV(4, float); if(damage_take) - frag_target.ok_pauseregen_finished = max(frag_target.ok_pauseregen_finished, time + 2); + frag_target.pauseregen_finished = max(frag_target.pauseregen_finished, time + 2); } void ok_DropItem(entity this, entity targ) @@ -170,26 +170,7 @@ MUTATOR_HOOKFUNCTION(ok, MonsterDropItem) MUTATOR_HOOKFUNCTION(ok, PlayerRegen) { - entity player = M_ARGV(0, entity); - - // overkill's values are different, so use custom regen - if(!STAT(FROZEN, player)) - { - 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; - - maxf = autocvar_g_balance_fuel_rotstable; - minf = autocvar_g_balance_fuel_regenstable; - limitf = autocvar_g_balance_fuel_limit; - - 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 + M_ARGV(4, float) = M_ARGV(1, float) = 1; // limit_mod = max_mod } MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon) @@ -288,7 +269,7 @@ MUTATOR_HOOKFUNCTION(ok, PlayerSpawn) if(player.impulse) player.ok_lastwep = 0; - player.ok_pauseregen_finished = time + 2; + player.pauseregen_finished = time + 2; } void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }