From a441f02d4660b55009d297091aa30bcfa284e631 Mon Sep 17 00:00:00 2001 From: Histalek <16392835+Histalek@users.noreply.github.com> Date: Wed, 27 Nov 2024 14:51:11 +0100 Subject: [PATCH] fix(random_shop): Do not put minimum player limited equip in random shop This fixes #1679, very well aware that other limitations (team/global limited) are still not respected and might still show up. --- CHANGELOG.md | 1 + .../terrortown/gamemode/shared/sh_equip_items.lua | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42814b8d7..f4a1d7ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel - Fixed spectating player still being visible through thermalvision after killing that player (by @MrXonte) - Fixed Magneto-stick not using C_Hands (by @SvveetMavis) - Fixed console error when dropping ammo for weapons with no AmmoEnt (by @MrXonte) +- Fixed randomshop containing equipment which minimum playeramount was not satisfied (by @Histalek) ### Changed diff --git a/gamemodes/terrortown/gamemode/shared/sh_equip_items.lua b/gamemodes/terrortown/gamemode/shared/sh_equip_items.lua index 4a6ef3d2b..7fe38cde6 100644 --- a/gamemodes/terrortown/gamemode/shared/sh_equip_items.lua +++ b/gamemodes/terrortown/gamemode/shared/sh_equip_items.lua @@ -568,6 +568,8 @@ if SERVER then RANDOMSHOP[ply] = RANDOMTEAMSHOPS[GetShopFallback(srd.index)] end else -- every player has his own shop + local activePlys = util.GetActivePlayers() + for i = 1, #tmpTbl do local ply = tmpTbl[i] local srd = ply:GetSubRoleData() @@ -590,6 +592,14 @@ if SERVER then continue end + if + equip.minPlayers + and equip.minPlayers > 1 + and #activePlys < equip.minPlayersthen + then + continue + end + if equip.NoRandom then amount = amount - 1