Fix TNT splitting doors in half
This commit is contained in:
parent
bd604bbdcb
commit
cc39f0d86e
@ -99,13 +99,6 @@ function door.register_door(name, def)
|
||||
local tt = def.tiles_top
|
||||
local tb = def.tiles_bottom
|
||||
|
||||
local function after_dig_node(pos, name, digger)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == name then
|
||||
minetest.node_dig(pos, node, digger)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||
pos.y = pos.y+dir
|
||||
if not minetest.get_node(pos).name == check_name then
|
||||
@ -174,10 +167,6 @@ function door.register_door(name, def)
|
||||
},
|
||||
|
||||
groups = groups_node,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_1", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
@ -185,6 +174,13 @@ function door.register_door(name, def)
|
||||
end
|
||||
end,
|
||||
|
||||
after_destruct = function(bottom, oldnode)
|
||||
local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z }
|
||||
if minetest.get_node(bottom).name ~= name.."_b_2" and minetest.get_node(top).name == name.."_t_1" then
|
||||
minetest.remove_node(top)
|
||||
end
|
||||
end,
|
||||
|
||||
is_ground_content = false,
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
@ -209,17 +205,19 @@ function door.register_door(name, def)
|
||||
},
|
||||
groups = groups_node,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_1", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
|
||||
end
|
||||
end,
|
||||
|
||||
after_destruct = function(top, oldnode)
|
||||
local bottom = { x = top.x, y = top.y - 1, z = top.z }
|
||||
if minetest.get_node(top).name ~= name.."_t_2" and minetest.get_node(bottom).name == name.."_b_1" and oldnode.name == name.."_t_1" then
|
||||
minetest.dig_node(bottom)
|
||||
end
|
||||
end,
|
||||
|
||||
is_ground_content = false,
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
@ -244,17 +242,19 @@ function door.register_door(name, def)
|
||||
},
|
||||
groups = groups_node,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y+1
|
||||
after_dig_node(pos, name.."_t_2", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
after_destruct = function(bottom, oldnode)
|
||||
local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z }
|
||||
if minetest.get_node(bottom).name ~= name.."_b_1" and minetest.get_node(top).name == name.."_t_2" then
|
||||
minetest.remove_node(top)
|
||||
end
|
||||
end,
|
||||
|
||||
is_ground_content = false,
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
@ -279,17 +279,19 @@ function door.register_door(name, def)
|
||||
},
|
||||
groups = groups_node,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
pos.y = pos.y-1
|
||||
after_dig_node(pos, name.."_b_2", digger)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if check_player_priv(pos, clicker) then
|
||||
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
|
||||
end
|
||||
end,
|
||||
|
||||
after_destruct = function(top, oldnode)
|
||||
local bottom = { x = top.x, y = top.y - 1, z = top.z }
|
||||
if minetest.get_node(top).name ~= name.."_t_1" and minetest.get_node(bottom).name == name.."_b_2" and oldnode.name == name.."_t_2" then
|
||||
minetest.dig_node(bottom)
|
||||
end
|
||||
end,
|
||||
|
||||
is_ground_content = false,
|
||||
can_dig = check_player_priv,
|
||||
sounds = def.sounds,
|
||||
|
Loading…
Reference in New Issue
Block a user