Skip to content

Commit

Permalink
Fix quantity
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverfeelin committed Jul 24, 2017
1 parent e532211 commit 54ea2b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"QuickbarMini",
"StardustLib"
],
"version" : "1.3.2",
"version" : "1.3.2.1",
"link" : "steam://url/CommunityFilePage/733665104",
"steamContentId" : "733665104"
}
9 changes: 6 additions & 3 deletions scripts/spawnableItemPack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,17 @@ function sip.spawnItem(itemConfig, quantity)
if itemConfig.maxStack == 1 then quantity = 1 end

local item = widget.itemSlotItem(sip.widgets.itemSlot)
item.count = quantity
local maxItem = {name=item.name, count=1000, parameters = item.parameters }

local it, rest = math.floor(quantity / 1000), quantity % 1000
for i=1,it do
player.giveItem({name=itemName, count=1000, parameters = params })
player.giveItem(maxItem)
end

player.giveItem(item)
item.count = rest
if item.count > 0 then
player.giveItem(item)
end

-- Refresh
sip.randomizeItem()
Expand Down

0 comments on commit 54ea2b2

Please sign in to comment.