From 63c83c1489584fbbcdc83874c94d1b08ab11876f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 3 Sep 2019 17:32:24 +0200 Subject: [PATCH] Fix treasure stack size not being properly limited --- mods/goodies/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/goodies/init.lua b/mods/goodies/init.lua index 3fc80ec..596f604 100644 --- a/mods/goodies/init.lua +++ b/mods/goodies/init.lua @@ -89,7 +89,8 @@ function goodies.fill(pos, ctype, pr, listname, keepchance) local chance = goodies.types[ctype][util.choice(goodies.types[ctype], pr)] local item = util.choice(goodies.types[ctype], pr) if pr:next(1, chance) <= 1 then - local itemstr = item.." "..pr:next(1, goodies.max_stack) + local max = math.min(goodies.max_stack, minetest.registered_items[item].stack_max) + local itemstr = item.." "..pr:next(1, max) inv:set_stack(listname, pr:next(1, size), ItemStack(itemstr)) end end