mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 21:41:50 +00:00
add loot count 'min' and 'max'
This commit is contained in:
parent
ebea9af380
commit
f744c87c8e
1 changed files with 7 additions and 0 deletions
|
|
@ -20,8 +20,15 @@ local function calc_loot(loot_table)
|
||||||
local roll = math.random()
|
local roll = math.random()
|
||||||
|
|
||||||
if roll < chance then
|
if roll < chance then
|
||||||
|
if loot.min and loot.max then
|
||||||
|
count = math.random(loot.min, loot.max)
|
||||||
|
end
|
||||||
|
if count == 0 then
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
table.insert(results, {item=item.index(loot.item), count=count})
|
table.insert(results, {item=item.index(loot.item), count=count})
|
||||||
end
|
end
|
||||||
|
::continue::
|
||||||
end
|
end
|
||||||
return results
|
return results
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue