forked from nalc/nalc_game
Allow interaction with nodes while wielding these items.
- beds - boats - carts - key/skeleton key - seeds All these had on_place handlers that did not allow nodes with an on_rightclick() handler to be used first (if not using sneak). This code is taken from the torches mod and applied everywhere. This allows all these items to e.g. be inserted into the `frame` mod's item frames.
This commit is contained in:
@ -46,6 +46,14 @@ function beds.register_bed(name, def)
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local under = pointed_thing.under
|
||||
local node = minetest.get_node(under)
|
||||
local udef = minetest.registered_nodes[node.name]
|
||||
if udef and udef.on_rightclick and
|
||||
not (placer and placer:get_player_control().sneak) then
|
||||
return udef.on_rightclick(under, node, placer, itemstack,
|
||||
pointed_thing) or itemstack
|
||||
end
|
||||
|
||||
local pos
|
||||
if minetest.registered_items[minetest.get_node(under).name].buildable_to then
|
||||
pos = under
|
||||
|
Reference in New Issue
Block a user