Skip to content

Commit

Permalink
fix(random_shop): Do not put minimum player limited equip in random shop
Browse files Browse the repository at this point in the history
This fixes #1679, very well aware that other limitations (team/global
limited) are still not respected and might still show up.
  • Loading branch information
Histalek committed Nov 27, 2024
1 parent 2493ff1 commit a441f02
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions gamemodes/terrortown/gamemode/shared/sh_equip_items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down

0 comments on commit a441f02

Please sign in to comment.