diff options
author | Wuzzy <almikes@aol.com> | 2016-08-25 20:34:26 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-25 20:34:26 +0200 |
commit | eb3d7bf59bab7c3d58c63269f4f9816451f3d6f2 (patch) | |
tree | b93cf9e38776d4df3d253c4c0bb292add5e98e2d /init.lua | |
parent | 9f4942e2159f444af07aab1a26b1186e121e70a0 (diff) |
Take in empty drops into account for complex drops
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 |