Fix sapling placement handling of on_rightclick and CONTENT_IGNORE
This commit is contained in:
parent
67fc2247fc
commit
32f7051eb8
|
@ -435,12 +435,17 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
|
||||||
sapling_name, minp_relative, maxp_relative, interval)
|
sapling_name, minp_relative, maxp_relative, interval)
|
||||||
-- Position of sapling
|
-- Position of sapling
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
local pdef = minetest.registered_nodes[node.name]
|
local pdef = node and minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
|
if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then
|
||||||
|
return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
if not pdef or not pdef.buildable_to then
|
if not pdef or not pdef.buildable_to then
|
||||||
pos = pointed_thing.above
|
pos = pointed_thing.above
|
||||||
node = minetest.get_node(pos)
|
node = minetest.get_node_or_nil(pos)
|
||||||
pdef = minetest.registered_nodes[node.name]
|
pdef = node and minetest.registered_nodes[node.name]
|
||||||
if not pdef or not pdef.buildable_to then
|
if not pdef or not pdef.buildable_to then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue