Skip to content

Commit

Permalink
Fixed inventory.HasItemOfBase and inventory.HasItem returning prematu…
Browse files Browse the repository at this point in the history
…rely.
  • Loading branch information
alexgrist committed Aug 19, 2018
1 parent 1aeccf8 commit 1f0ab0a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions gamemode/core/meta/sh_inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,18 @@ function META:HasItem(targetID, data)
if (v.uniqueID == targetID) then
if (data) then
local itemData = v.data
local bFound = true

for dataKey, dataVal in pairs(data) do
if (itemData[dataKey] != dataVal) then
return false
bFound = false
break
end
end

if (!bFound) then
continue
end
end

return v
Expand All @@ -364,12 +370,18 @@ function META:HasItemOfBase(baseID, data)
if (v.base == baseID) then
if (data) then
local itemData = v.data
local bFound = true

for dataKey, dataVal in pairs(data) do
if (itemData[dataKey] != dataVal) then
return false
bFound = false
break
end
end

if (!bFound) then
continue
end
end

return v
Expand Down

0 comments on commit 1f0ab0a

Please sign in to comment.