summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-25 20:34:26 +0200
committerWuzzy <almikes@aol.com>2016-08-25 20:34:26 +0200
commiteb3d7bf59bab7c3d58c63269f4f9816451f3d6f2 (patch)
treeb93cf9e38776d4df3d253c4c0bb292add5e98e2d /init.lua
parent9f4942e2159f444af07aab1a26b1186e121e70a0 (diff)
Take in empty drops into account for complex drops
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files 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