mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-22 16:09:33 +01:00
Fix crash caused by _mcl_shears_drop factoid
This commit is contained in:
parent
c36d19508b
commit
63fed60eaa
1 changed files with 13 additions and 5 deletions
|
@ -187,13 +187,21 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def)
|
|||
return "This block drops itself when mined by shears."
|
||||
elseif type(def._mcl_shears_drop) == "table" then
|
||||
local drops = {}
|
||||
for i=1, #def._mcl_shears_drop do
|
||||
local desc = minetest.registered_items[def._mcl_shears_drop[i]].description
|
||||
if desc then
|
||||
table.insert(drops)
|
||||
for d=1, #def._mcl_shears_drop do
|
||||
local item = ItemStack(def._mcl_shears_drop[d])
|
||||
local itemname = item:get_name()
|
||||
local itemcount = item:get_count()
|
||||
local idef = minetest.registered_items[itemname]
|
||||
local text = ""
|
||||
if idef.description and idef.description ~= "" then
|
||||
text = idef.description
|
||||
else
|
||||
table.insert(def._mcl_shears_drop[i])
|
||||
text = itemname
|
||||
end
|
||||
if itemcount > 1 then
|
||||
text = string.format("%d×%s", itemcount, text)
|
||||
end
|
||||
table.insert(drops, text)
|
||||
end
|
||||
local ret = string.format("This blocks drops the following when mined by shears: %s", table.concat(drops, ", "))
|
||||
return ret
|
||||
|
|
Loading…
Reference in a new issue