Allow buttons to replace pointed node again

This commit is contained in:
Wuzzy 2017-05-27 18:18:54 +02:00
parent 1357bd5555
commit 434c7a399a
1 changed files with 9 additions and 0 deletions

View File

@ -62,6 +62,15 @@ local on_button_place = function(itemstack, placer, pointed_thing)
end end
end end
-- If the pointed node is buildable, let's look at the node *behind* that node
if def.buildable_to then
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
local actual = vector.subtract(under, dir)
local actualnode = minetest.get_node(actual)
def = minetest.registered_nodes[actualnode.name]
groups = def.groups
end
-- Only allow placement on full-cube solid opaque nodes -- Only allow placement on full-cube solid opaque nodes
if (not groups) or (not groups.solid) or (not groups.opaque) or (def.node_box and def.node_box.type ~= "regular") then if (not groups) or (not groups.solid) or (not groups.opaque) or (def.node_box and def.node_box.type ~= "regular") then
return itemstack return itemstack