1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

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

View File

@ -90,18 +90,18 @@ local function stack(itemstack, placer, fdir, pos, def, pos2, node1, node2)
return itemstack return itemstack
end 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) local node = minetest.get_node_or_nil(pos)
if not node then return false end if not node then return false end
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if not def or not def.on_rightclick then return false end 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 end
-- Stack one node above another -- Stack one node above another
-- leave the last argument nil if it's one 2m high node -- leave the last argument nil if it's one 2m high node
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2) 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 if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing) 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 -- 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) 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 if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing) local pos, def = select_node(pointed_thing)
@ -135,7 +135,7 @@ function homedecor.stack_wing(itemstack, placer, pointed_thing, node1, node2, no
end end
function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2, dir) 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 if rightclick_result then return rightclick_result end
local pos, def = select_node(pointed_thing) local pos, def = select_node(pointed_thing)
@ -224,7 +224,7 @@ function homedecor.unextend_bed(pos, color)
end end
function homedecor.place_banister(itemstack, placer, pointed_thing) 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 if rightclick_result then return rightclick_result end
local pos, _ = select_node(pointed_thing) local pos, _ = select_node(pointed_thing)