Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(random_shop): Do not put minimum player limited equip in random shop #1683

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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