Keys: Show owner in description

Utilizes several new features allowing the description of an item to be changed using the `description` meta key. This also moves keys from using the old single-value itemstack metadata system to the new node-like metadata system.
This commit is contained in:
octacian 2017-02-26 09:24:12 -08:00 committed by Auke Kok
parent bb18eeccaf
commit 9d3a526324
3 changed files with 24 additions and 9 deletions

View file

@ -410,9 +410,10 @@ minetest.register_tool("default:skeleton_key", {
-- finish and return the new key
itemstack:take_item()
itemstack:add_item("default:key")
itemstack:set_metadata(minetest.write_json({
secret = secret
}))
local meta = itemstack:get_meta()
meta:set_string("secret", secret)
meta:set_string("description", "Key to "..placer:get_player_name().."'s "
..minetest.registered_nodes[node.name].description)
return itemstack
end
end