From: bones_was_here <bones_was_here@xa.org.au>
Date: Fri, 17 Dec 2021 08:41:43 +0000 (+1000)
Subject: Add support for LMS with items
X-Git-Tag: xonotic-v0.8.5~248^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3440f317ec142dd28f938dfd76ef3c8352680055;p=xonotic%2Fxonotic-data.pk3dir.git

Add support for LMS with items
---

diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg
index 17b90c624..62570e523 100644
--- a/gamemodes-server.cfg
+++ b/gamemodes-server.cfg
@@ -448,6 +448,7 @@ set g_lms_extra_lives 0
 set g_lms_regenerate 0
 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)"
 set g_lms_weaponarena "most_available" "starting weapons - takes the same options as g_weaponarena"
 
 
diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
index 8f545955c..43bf50621 100644
--- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
+++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
@@ -9,6 +9,7 @@
 int autocvar_g_lms_extra_lives;
 bool autocvar_g_lms_join_anytime;
 int autocvar_g_lms_last_join;
+bool autocvar_g_lms_items;
 bool autocvar_g_lms_regenerate;
 
 // main functions
@@ -414,6 +415,9 @@ MUTATOR_HOOKFUNCTION(lms, ForbidPlayerScore_Clear)
 
 MUTATOR_HOOKFUNCTION(lms, FilterItemDefinition)
 {
+	if (autocvar_g_lms_items)
+		return false;
+
 	entity definition = M_ARGV(0, entity);
 
 	if (autocvar_g_lms_extra_lives && definition == ITEM_ExtraLife)