From 434c7a399a932190d916c9aeaff12ea4259c18f1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 27 May 2017 18:18:54 +0200 Subject: [PATCH] Allow buttons to replace pointed node again --- mods/ITEMS/REDSTONE/mesecons_button/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mesecons_button/init.lua b/mods/ITEMS/REDSTONE/mesecons_button/init.lua index 92fc7b798..0998b8e20 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_button/init.lua @@ -62,6 +62,15 @@ local on_button_place = function(itemstack, placer, pointed_thing) 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 if (not groups) or (not groups.solid) or (not groups.opaque) or (def.node_box and def.node_box.type ~= "regular") then return itemstack