mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
fix block.index() calls in grass_block.lua and export base:util.calc_loot()
This commit is contained in:
parent
1519febf6a
commit
2eae8f6f27
2 changed files with 8 additions and 6 deletions
|
|
@ -12,14 +12,14 @@ function util.drop(ppos, itemid, count, data, pickup_delay)
|
|||
}})
|
||||
end
|
||||
|
||||
local function calc_loot(loot_table)
|
||||
function calc_loot(loot_table)
|
||||
local results = {}
|
||||
for _, loot in ipairs(loot_table) do
|
||||
local chance = loot.chance or 1
|
||||
local count = loot.count or 1
|
||||
|
||||
|
||||
local roll = math.random()
|
||||
|
||||
|
||||
if roll < chance then
|
||||
if loot.min and loot.max then
|
||||
count = math.random(loot.min, loot.max)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue