Fix door closing if dig opaque block next to it

This commit is contained in:
Wuzzy 2018-01-26 21:11:49 +01:00
parent 03b6c17f51
commit e8ebc537f0
5 changed files with 8 additions and 5 deletions

View file

@ -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

View file

@ -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 = {

View file

@ -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"

View file

@ -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"

View file

@ -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, {