From f744c87c8e56eecb652c0322539d125384b02843 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 29 Dec 2024 09:04:10 +0300 Subject: [PATCH] add loot count 'min' and 'max' --- res/content/base/modules/util.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/res/content/base/modules/util.lua b/res/content/base/modules/util.lua index 6dfa90a6..d12337fb 100644 --- a/res/content/base/modules/util.lua +++ b/res/content/base/modules/util.lua @@ -20,8 +20,15 @@ local function calc_loot(loot_table) local roll = math.random() 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}) end + ::continue:: end return results end