Fix crash caused by _mcl_shears_drop factoid
This commit is contained in:
parent
c36d19508b
commit
63fed60eaa
|
@ -187,13 +187,21 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
|
||||||
return "This block drops itself when mined by shears."
|
return "This block drops itself when mined by shears."
|
||||||
elseif type(def._mcl_shears_drop) == "table" then
|
elseif type(def._mcl_shears_drop) == "table" then
|
||||||
local drops = {}
|
local drops = {}
|
||||||
for i=1, #def._mcl_shears_drop do
|
for d=1, #def._mcl_shears_drop do
|
||||||
local desc = minetest.registered_items[def._mcl_shears_drop[i]].description
|
local item = ItemStack(def._mcl_shears_drop[d])
|
||||||
if desc then
|
local itemname = item:get_name()
|
||||||
table.insert(drops)
|
local itemcount = item:get_count()
|
||||||
|
local idef = minetest.registered_items[itemname]
|
||||||
|
local text = ""
|
||||||
|
if idef.description and idef.description ~= "" then
|
||||||
|
text = idef.description
|
||||||
else
|
else
|
||||||
table.insert(def._mcl_shears_drop[i])
|
text = itemname
|
||||||
end
|
end
|
||||||
|
if itemcount > 1 then
|
||||||
|
text = string.format("%d×%s", itemcount, text)
|
||||||
|
end
|
||||||
|
table.insert(drops, text)
|
||||||
end
|
end
|
||||||
local ret = string.format("This blocks drops the following when mined by shears: %s", table.concat(drops, ", "))
|
local ret = string.format("This blocks drops the following when mined by shears: %s", table.concat(drops, ", "))
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in New Issue