always pass pointed_thing along to on_rightclick

This commit is contained in:
Vanessa Ezekowitz 2017-01-29 12:15:14 -05:00
parent e97cefa94c
commit 4ae16c294e
1 changed files with 6 additions and 6 deletions

View File

@ -90,18 +90,18 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
return itemstack
end
local function rightclick_pointed_thing(pos, placer, itemstack)
local function rightclick_pointed_thing(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node_or_nil(pos)
if not node then return false end
local def = minetest.registered_nodes[node.name]
if not def or not def.on_rightclick then return false end
return def.on_rightclick(pos, node, placer, itemstack) or itemstack
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing) or itemstack
end
-- Stack one node above another
-- leave the last argument nil if it's one 2m high node
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -116,7 +116,7 @@ end
-- like homedecor.stack_vertically but tests first if it was placed as a right wing, then uses node1_right and node2_right instead
function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, node1_right, node2_right)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -135,7 +135,7 @@ function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, no
end
function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2, dir)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing)
@ -224,7 +224,7 @@ function homedecor.unextend_bed(pos, color)
end
function homedecor.place_banister(itemstack, placer, pointed_thing)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack)
local rightclick_result = rightclick_pointed_thing(pointed_thing.under, placer, itemstack, pointed_thing)
if rightclick_result then return rightclick_result end
local pos, _ = select_node(pointed_thing)