display item description and itemstring in infotext

master
CalebJ 2021-04-23 21:47:00 +00:00 committed by Hume2
parent f0d4bd8ccf
commit 075a4bf7f5
1 changed files with 7 additions and 3 deletions

View File

@ -92,14 +92,18 @@ function itemframe.rightclick(pos, node, clicker, itemstack)
end
drop_item(pos, node)
local description = itemstack:get_description() or ""
local itemname = itemstack:get_name()
local itemstring = itemstack:take_item():to_string()
meta:set_string("item", itemstring)
update_item(pos, node)
if itemstring == "" then
if minetest.is_protected(pos, player_name) then return end
meta:set_string("infotext", "Item Frame (owned by " .. player_name .. ")")
meta:set_string("owner", player_name)
if minetest.is_protected(pos, player_name) then return end
meta:set_string("infotext", "Item Frame (owned by " .. player_name .. ")")
meta:set_string("owner", player_name)
else
meta:set_string("infotext", description.." ("..itemname.." owned by " .. owner .. ")")
end
return itemstack