forked from LizzyFleckenstein03/Memeclone
Fix #904
This commit is contained in:
parent
37f256648b
commit
fcc485a8e3
|
@ -147,6 +147,34 @@ minetest.register_node("mcl_itemframes:item_frame",{
|
|||
sunlight_propagates = true,
|
||||
groups = { dig_immediate=3,deco_block=1,dig_by_piston=1,container=7 },
|
||||
sounds = mcl_sounds.node_sound_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
if pointed_thing.above.y ~= pointed_thing.under.y then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].buildable_to then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local new_itemstack, success = minetest.item_place(itemstack, placer, pointed_thing)
|
||||
local node = minetest.get_node(pointed_thing.above)
|
||||
node.param2 = minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under))
|
||||
minetest.swap_node(pointed_thing.above, node)
|
||||
|
||||
return new_itemstack
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
|
Loading…
Reference in New Issue