return max(stable, current + (stable - current) * rotfactor * rotframetime);\r
}\r
\r
-float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit)\r
+.float regen_soundtime;\r
+float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit, string regensound)\r
{\r
if(current > rotstable)\r
{\r
{\r
current = CalcRegen(current, regenstable, regenfactor, regenframetime);\r
current = min(regenstable, current + regenlinear * regenframetime);\r
+\r
+ if(regensound != "")\r
+ {\r
+ if(self.regen_soundtime < time)\r
+ {\r
+ msg_entity = self;\r
+ if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
+ soundto(MSG_ONE, self, CHAN_AUTO, regensound, VOL_BASE, ATTN_NONE);\r
+ }\r
+ self.regen_soundtime = time + 1; // only replay the sound if regen was paused for one second\r
+ }\r
}\r
}\r
\r
\r
if (!g_ca && (!g_lms || cvar("g_lms_regenerate")))\r
{\r
- self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregenarmor_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita);\r
- self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserothealth_finished), limith);\r
+ self.armorvalue = CalcRotRegen(self.armorvalue, mina, cvar("g_balance_armor_regen"), cvar("g_balance_armor_regenlinear"), regen_mod * frametime * (time > self.pauseregenarmor_finished), maxa, cvar("g_balance_armor_rot"), cvar("g_balance_armor_rotlinear"), rot_mod * frametime * (time > self.pauserotarmor_finished), limita, "misc/armor_regen.ogg");\r
+ self.health = CalcRotRegen(self.health, minh, cvar("g_balance_health_regen"), cvar("g_balance_health_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished), maxh, cvar("g_balance_health_rot"), cvar("g_balance_health_rotlinear"), rot_mod * frametime * (time > self.pauserothealth_finished), limith, "misc/health_regen.ogg");\r
\r
// if player rotted to death... die!\r
if(self.health < 1)\r
}\r
\r
if not(self.items & IT_UNLIMITED_WEAPON_AMMO)\r
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf);\r
+ self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, cvar("g_balance_fuel_regen"), cvar("g_balance_fuel_regenlinear"), regen_mod * frametime * (time > self.pauseregenhealth_finished) * (self.items & IT_FUEL_REGEN != 0), maxf, cvar("g_balance_fuel_rot"), cvar("g_balance_fuel_rotlinear"), rot_mod * frametime * (time > self.pauserotfuel_finished), limitf, "");\r
}\r
\r
float zoomstate_set;\r