From 9fceb656b5096a914a72fda6ee448bcfa6e68f5e Mon Sep 17 00:00:00 2001
From: Juhu <5894800-Juhu_@users.noreply.gitlab.com>
Date: Sat, 5 Feb 2022 11:01:52 +0000
Subject: [PATCH] Allow rot and regeneration to be enabled individually in LMS

---
 gamemodes-server.cfg                          | 3 ++-
 qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg
index 09c84f0f85..1d2a0d70a9 100644
--- a/gamemodes-server.cfg
+++ b/gamemodes-server.cfg
@@ -445,7 +445,8 @@ set g_keyhunt_team_spawns 0 "when 1, players spawn from the team spawnpoints of
 set g_lms 0 "Last Man Standing: everyone starts with a certain amount of lives, and the survivor wins"
 set g_lms_lives_override -1
 set g_lms_extra_lives 0
-set g_lms_regenerate 0
+set g_lms_regenerate 0 "health and/or armor regeneration, according to g_balance_health_regen and g_balance_armor_regen"
+set g_lms_rot 0 "health and/or armor rotting, according to g_balance_health_rot and g_balance_armor_rot"
 set g_lms_last_join 3	"if g_lms_join_anytime is 0, new players can only join if the worst active player has (fraglimit - g_lms_last_join) or more lives; in other words, new players can no longer join once the worst player loses more than g_lms_last_join lives"
 set g_lms_join_anytime 1	"1: new players can join, but get same amount of lives as the worst player; 0: new players can only join if the worst active player has (fraglimit - g_lms_last_join) or more lives"
 set g_lms_items 0 "enables items to spawn, weaponarena still disables weapons and ammo (to force all items to spawn, use g_pickup_items 1 instead)"
diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
index c8cc0e6e56..b1252794cd 100644
--- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
+++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
@@ -11,6 +11,7 @@ bool autocvar_g_lms_join_anytime;
 int autocvar_g_lms_last_join;
 bool autocvar_g_lms_items;
 bool autocvar_g_lms_regenerate;
+bool autocvar_g_lms_rot;
 
 // main functions
 int LMS_NewPlayerLives()
@@ -358,9 +359,11 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 
 MUTATOR_HOOKFUNCTION(lms, PlayerRegen)
 {
-	if(autocvar_g_lms_regenerate)
-		return false;
-	return true;
+	if(!autocvar_g_lms_regenerate)
+		M_ARGV(2, float) = 0;
+	if(!autocvar_g_lms_rot)
+		M_ARGV(3, float) = 0;
+	return (!autocvar_g_lms_regenerate && !autocvar_g_lms_rot);
 }
 
 MUTATOR_HOOKFUNCTION(lms, ForbidThrowCurrentWeapon)
-- 
2.39.5