mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 00:20:17 +01:00
add description of item in frame / on pedestal
lets players brag about their tools and is useful for better overview.
This commit is contained in:
parent
f2cd1fbd49
commit
77af2295ae
@ -153,12 +153,19 @@ minetest.register_node("itemframes:frame",{
|
|||||||
drop_item(pos,node)
|
drop_item(pos,node)
|
||||||
local s = itemstack:take_item()
|
local s = itemstack:take_item()
|
||||||
meta:set_string("item",s:to_string())
|
meta:set_string("item",s:to_string())
|
||||||
local description = ""
|
|
||||||
local item_meta = s:get_meta()
|
local item_meta = s:get_meta()
|
||||||
if item_meta then
|
local description = item_meta:get_string("description")
|
||||||
description = item_meta:get_string("description") or ""
|
if description == "" then
|
||||||
|
local item_name = s:get_name()
|
||||||
|
if minetest.registered_items[item_name]
|
||||||
|
and minetest.registered_items[item_name].description
|
||||||
|
then
|
||||||
|
description = minetest.registered_items[item_name].description
|
||||||
|
else
|
||||||
|
description = item_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", S("Item frame (owned by @1)\n@2", name, description))
|
meta:set_string("infotext", S("Item frame (owned by @1)", name) .. "\n" .. description)
|
||||||
update_item(pos,node)
|
update_item(pos,node)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
@ -223,12 +230,19 @@ minetest.register_node("itemframes:pedestal",{
|
|||||||
drop_item(pos,node)
|
drop_item(pos,node)
|
||||||
local s = itemstack:take_item()
|
local s = itemstack:take_item()
|
||||||
meta:set_string("item",s:to_string())
|
meta:set_string("item",s:to_string())
|
||||||
local description = ""
|
|
||||||
local item_meta = s:get_meta()
|
local item_meta = s:get_meta()
|
||||||
if item_meta then
|
local description = item_meta:get_string("description")
|
||||||
description = item_meta:get_string("description") or ""
|
if description == "" then
|
||||||
|
local item_name = s:get_name()
|
||||||
|
if minetest.registered_items[item_name]
|
||||||
|
and minetest.registered_items[item_name].description
|
||||||
|
then
|
||||||
|
description = minetest.registered_items[item_name].description
|
||||||
|
else
|
||||||
|
description = item_name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", S("Pedestal (owned by @1)\n@2", name, description))
|
meta:set_string("infotext", S("Pedestal (owned by @1)", name) .. "\n" .. description)
|
||||||
update_item(pos,node)
|
update_item(pos,node)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
@ -313,3 +327,4 @@ if minetest.get_modpath("mesecons_mvps") then
|
|||||||
mesecon.register_mvps_stopper("itemframes:frame")
|
mesecon.register_mvps_stopper("itemframes:frame")
|
||||||
mesecon.register_mvps_stopper("itemframes:pedestal")
|
mesecon.register_mvps_stopper("itemframes:pedestal")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user