From 5ef410730a97af8cda1a248e399d60f6d702085d Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Fri, 10 Jul 2020 01:12:48 +0200 Subject: [PATCH] Refine drops --- init.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 8887764..1f4d081 100644 --- a/init.lua +++ b/init.lua @@ -633,12 +633,21 @@ local function drop_table(name, drop) if not dstack:is_empty() and (dname ~= name or (dname == name and dcount > 1)) then if #di.items == 1 and (not di.rarity or di.rarity <= 1) then + if drop_sure[dname] then + if dcount > drop_sure[dname].output then + dcount = dcount + drop_sure[dname].output + else + dcount = drop_sure[dname].output + end + end + drop_sure[dname] = { output = dcount, tools = di.tools, } else - drop_maybe[dname] = { + drop_maybe[#drop_maybe + 1] = { + item = dname, output = dcount, rarity = di.rarity, tools = di.tools, @@ -657,11 +666,11 @@ local function drop_table(name, drop) } end - for item, data in pairs(drop_maybe) do + for _, data in ipairs(drop_maybe) do craftguide.register_craft{ type = "digging_chance", items = {name}, - output = fmt("%s %u", item, data.output), + output = fmt("%s %u", data.item, data.output), rarity = data.rarity, tools = data.tools, }