From bb16fc5fe605b587f3eda8a9ae36e13c29710ed9 Mon Sep 17 00:00:00 2001 From: 12Me21 <12Me21.mc@gmail.com> Date: Mon, 17 Sep 2018 14:38:39 -0400 Subject: [PATCH] fixed cable plate placement --- technic/machines/register/cables.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 1e8cee9..620bdcf 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -201,6 +201,19 @@ function technic.register_cable(tier, size) def.node_box["connect_"..notconnects[i]] = nil if i == 1 then def.on_place = function(itemstack, placer, pointed_thing) + + -- Quick fix to prevent placing cables in protected areas and overwriting other nodes with cables + local name = placer:get_player_name() + if minetest.is_protected(pointed_thing.above, name) then + minetest.record_protection_violation(pos, name) + return true + end + local node = minetest.get_node_or_nil(pointed_thing.above) + if node then + local def = minetest.registered_nodes[node.name] + if def and def.buildable_to ~= true then return end + end + local pointed_thing_diff = vector.subtract(pointed_thing.above, pointed_thing.under) local num local changed