From eb3d7bf59bab7c3d58c63269f4f9816451f3d6f2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 25 Aug 2016 20:34:26 +0200 Subject: Take in empty drops into account for complex drops --- init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index a44eda2..7a93624 100644 --- a/init.lua +++ b/init.lua @@ -541,10 +541,14 @@ doc.new_category("nodes", { local itemstring = dropstack:get_name() local desc = get_desc(dropstack) local count = dropstack:get_count() - table.insert(probtable, {itemstring = itemstring, desc = desc, count = count}) + if not(itemstring == nil or itemstring == "" or count == 0) then + table.insert(probtable, {itemstring = itemstring, desc = desc, count = count}) + end end probtable.rarity = rarity - table.insert(probtables, probtable) + if #data.def.drop.items[i].items > 0 then + table.insert(probtables, probtable) + end if max ~= nil then remaining_rarity = 1/(1/remaining_rarity - 1/rarity) end @@ -568,7 +572,6 @@ doc.new_category("nodes", { if j>1 then formstring = formstring .. " and " end - icount = icount + 1 local desc = probtable[j].desc local count = probtable[j].count if count ~= 1 then @@ -594,6 +597,7 @@ doc.new_category("nodes", { end formstring = formstring .. string.format(" (%s%.0f%%)", ca, chance) end + icount = icount + 1 end formstring = formstring .. ".\n" end -- cgit v1.2.3