From: Lyberta Date: Mon, 28 Aug 2017 04:22:49 +0000 (+0300) Subject: Use GetResourceLimit in player_regen. X-Git-Tag: xonotic-v0.8.5~2459^2~19^2 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=9c765062f5aa52580c1896462d9593d70550c070;p=xonotic%2Fxonotic-data.pk3dir.git Use GetResourceLimit in player_regen. --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index ecc76cf11..95f315ad2 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -758,7 +758,7 @@ float GetResourceLimit(int resource_type) } case RESOURCE_FUEL: { - limit = g_pickup_fuel_max; + limit = autocvar_g_balance_fuel_limit; break; } default: diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index d150ee774..38598e098 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -110,6 +110,11 @@ int GetResourceType(.float resource_property); /// \return Entity proprty for that resource. .float GetResourceProperty(int resource_type); +/// \brief Returns the maximum amount of the given resource. +/// \param[in] resource_type Type of the resource (a RESOURCE_* constant). +/// \return Maximum amount of the given resource. +float GetResourceLimit(int resource_type); + /// \brief Gives player a resource such as health, armor or ammo. /// \param[in,out] player Player to give resource to. /// \param[in] resource_type Type of the resource (a RESOURCE_* constant). diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f1d417d6b..9d4df94e7 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1628,8 +1628,8 @@ void player_regen(entity this) float mina, maxa, limith, limita; maxa = autocvar_g_balance_armor_rotstable; mina = autocvar_g_balance_armor_regenstable; - limith = autocvar_g_balance_health_limit; - limita = autocvar_g_balance_armor_limit; + limith = GetResourceLimit(RESOURCE_HEALTH); + limita = GetResourceLimit(RESOURCE_ARMOR); regen_health_rotstable = regen_health_rotstable * max_mod; regen_health_stable = regen_health_stable * max_mod; @@ -1656,7 +1656,7 @@ void player_regen(entity this) maxf = autocvar_g_balance_fuel_rotstable; minf = autocvar_g_balance_fuel_regenstable; - limitf = autocvar_g_balance_fuel_limit; + limitf = GetResourceLimit(RESOURCE_FUEL); 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); }