1
0
Fork 0

Item frames no longer have an owner

This commit is contained in:
Wuzzy 2017-12-10 23:06:03 +01:00
parent a79c2ade05
commit c4dbbc9147
1 changed files with 11 additions and 23 deletions

View File

@ -109,15 +109,9 @@ minetest.register_node("itemframes:frame",{
sunlight_propagates = true, sunlight_propagates = true,
groups = { dig_immediate=3,deco_block=1,dig_by_piston=1}, groups = { dig_immediate=3,deco_block=1,dig_by_piston=1},
sounds = mcl_sounds.node_sound_defaults(), sounds = mcl_sounds.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
local meta = minetest.get_meta(pos)
meta:set_string("owner",placer:get_player_name())
meta:set_string("infotext","Item frame (owned by "..placer:get_player_name()..")")
end,
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end if not itemstack then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") then
drop_item(pos, node, meta) drop_item(pos, node, meta)
-- item holds the itemstring -- item holds the itemstring
meta:set_string("item", itemstack:get_name()) meta:set_string("item", itemstack:get_name())
@ -130,7 +124,6 @@ minetest.register_node("itemframes:frame",{
if not minetest.settings:get_bool("creative_mode") then if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item() itemstack:take_item()
end end
end
return itemstack return itemstack
end, end,
on_destruct = function(pos) on_destruct = function(pos)
@ -138,11 +131,6 @@ minetest.register_node("itemframes:frame",{
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
drop_item(pos, node, meta) drop_item(pos, node, meta)
end, end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
return player:get_player_name() == meta:get_string("owner")
end,
on_rotate = on_rotate, on_rotate = on_rotate,
}) })