From e8ebc537f0f4a6198d2756d9f3c062227d3e58e5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 26 Jan 2018 21:11:49 +0100 Subject: [PATCH] Fix door closing if dig opaque block next to it --- mods/ITEMS/REDSTONE/mesecons/services.lua | 4 ++-- mods/ITEMS/REDSTONE/mesecons_torch/init.lua | 6 +++--- mods/ITEMS/mcl_doors/api_doors.lua | 1 + mods/ITEMS/mcl_doors/api_trapdoors.lua | 1 + mods/ITEMS/mcl_fences/init.lua | 1 + 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/services.lua b/mods/ITEMS/REDSTONE/mesecons/services.lua index 0a65b3bc2f..6ea036aa96 100644 --- a/mods/ITEMS/REDSTONE/mesecons/services.lua +++ b/mods/ITEMS/REDSTONE/mesecons/services.lua @@ -85,8 +85,8 @@ mesecon.on_dignode = function(pos, node) local nnode = minetest.get_node(npos) if mesecon.is_conductor_on(nnode) then mesecon.receptor_off(npos, mesecon.conductor_get_rules(nnode)) - -- Redstone torch is a special case and must be ignored - elseif mesecon.is_effector_on(nnode.name) and mesecon.is_powered(npos) == false and minetest.get_item_group(nnode.name, "redstone_torch") == 0 then + -- Disable neighbor effectors unless they are in a special ignore group + elseif mesecon.is_effector_on(nnode.name) and mesecon.is_powered(npos) == false and minetest.get_item_group(nnode.name, "mesecon_ignore_opaque_dig") == 0 then mesecon.changesignal(npos, nnode, nlink, mesecon.state.off, 1) mesecon.deactivate(npos, nnode, nlink, 1) end diff --git a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua index f5724875bd..48c593c445 100644 --- a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua @@ -122,7 +122,7 @@ mcl_torches.register_torch("mesecon_torch_off", "Redstone Torch (off)", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", {"jeija_torches_off.png"}, 0, - {dig_immediate=3, dig_by_water=1, redstone_torch=2, not_in_creative_inventory=1}, + {dig_immediate=3, dig_by_water=1, redstone_torch=2, mesecon_ignore_opaque_dig=1, not_in_creative_inventory=1}, mcl_sounds.node_sound_wood_defaults(), { mesecons = { @@ -148,7 +148,7 @@ mcl_torches.register_torch("mesecon_torch_overheated", "Redstone Torch (overheat "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", {"jeija_torches_off.png"}, 0, - {dig_immediate=3, dig_by_water=1, redstone_torch=2, not_in_creative_inventory=1}, + {dig_immediate=3, dig_by_water=1, redstone_torch=2, mesecon_ignore_opaque_dig=1, not_in_creative_inventory=1}, mcl_sounds.node_sound_wood_defaults(), { drop = "mesecons_torch:mesecon_torch_on", @@ -175,7 +175,7 @@ mcl_torches.register_torch("mesecon_torch_on", "Redstone Torch", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", {"jeija_torches_on.png"}, 7, - {dig_immediate=3, dig_by_water=1, redstone_torch=1}, + {dig_immediate=3, dig_by_water=1, redstone_torch=1, mesecon_ignore_opaque_dig=1}, mcl_sounds.node_sound_wood_defaults(), { mesecons = { diff --git a/mods/ITEMS/mcl_doors/api_doors.lua b/mods/ITEMS/mcl_doors/api_doors.lua index 8903eb5a63..2ac0122785 100644 --- a/mods/ITEMS/mcl_doors/api_doors.lua +++ b/mods/ITEMS/mcl_doors/api_doors.lua @@ -42,6 +42,7 @@ function mcl_doors:register_door(name, def) def.groups.not_in_creative_inventory = 1 def.groups.dig_by_piston = 1 def.groups.door = 1 + def.groups.mesecon_ignore_opaque_dig = 1 if not def.sound_open then def.sound_open = "doors_door_open" diff --git a/mods/ITEMS/mcl_doors/api_trapdoors.lua b/mods/ITEMS/mcl_doors/api_trapdoors.lua index f8e1a38b07..db118da412 100644 --- a/mods/ITEMS/mcl_doors/api_trapdoors.lua +++ b/mods/ITEMS/mcl_doors/api_trapdoors.lua @@ -27,6 +27,7 @@ function mcl_doors:register_trapdoor(name, def) if groups == nil then groups = {} end + groups.mesecon_ignore_opaque_dig = 1 if not def.sound_open then def.sound_open = "doors_door_open" diff --git a/mods/ITEMS/mcl_fences/init.lua b/mods/ITEMS/mcl_fences/init.lua index 023817fd72..6ba95bd597 100644 --- a/mods/ITEMS/mcl_fences/init.lua +++ b/mods/ITEMS/mcl_fences/init.lua @@ -121,6 +121,7 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups, cgroups.fence_gate = 1 cgroups.deco_block = 1 + cgroups.mesecon_ignore_opaque_dig = 1 cgroups.mesecon_effector_on = 1 cgroups.fence_gate = 1 minetest.register_node(open_gate_id, {