]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use GetResourceLimit in player_regen.
authorLyberta <lyberta@lyberta.net>
Mon, 28 Aug 2017 04:22:49 +0000 (07:22 +0300)
committerLyberta <lyberta@lyberta.net>
Mon, 28 Aug 2017 04:22:49 +0000 (07:22 +0300)
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/server/client.qc

index ecc76cf11c6f0e10d88262ccbee53dfaaf899735..95f315ad2714e0cf1ddbaedac0ecf26a56e299cc 100644 (file)
@@ -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:
index d150ee774d37c1ac60ff4c0abb591fda26a4a80c..38598e098c126dc0e8b4c4f12af2c20fb77d9f6f 100644 (file)
@@ -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).
index f1d417d6bace6987d6f1a72984f6f77260b7db0f..9d4df94e77070631dd98a239a37617633895c758 100644 (file)
@@ -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);
        }