Skip to content

Commit

Permalink
Don't add empty containers to corpses (otland#3187)
Browse files Browse the repository at this point in the history
  • Loading branch information
nekiro authored Jan 21, 2021
1 parent 7618ddb commit 75c24cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion data/lib/core/container.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Container.createLootItem(self, item)
end

if itemCount > 0 then
local tmpItem = self:addItem(item.itemId, math.min(itemCount, 100))
local tmpItem = Game.createItem(item.itemId, math.min(itemCount, 100))
if not tmpItem then
return false
end
Expand All @@ -30,6 +30,11 @@ function Container.createLootItem(self, item)
return false
end
end

if #item.childLoot > 0 and tmpItem:getSize() == 0 then
tmpItem:remove()
return true
end
end

if item.subType ~= -1 then
Expand All @@ -43,6 +48,8 @@ function Container.createLootItem(self, item)
if item.text and item.text ~= "" then
tmpItem:setText(item.text)
end

self:addItemEx(tmpItem)
end
return true
end

0 comments on commit 75c24cf

Please sign in to comment.