Fix doors dropping duplicate when blown up

This commit is contained in:
Elias Fleckenstein 2021-01-17 12:00:00 +01:00
parent b54b6c4c97
commit fa9d4402c7

View file

@ -275,7 +275,7 @@ function mcl_doors:register_door(name, def)
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
drop = name, drop = "",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -291,6 +291,7 @@ function mcl_doors:register_door(name, def)
sounds = def.sounds, sounds = def.sounds,
after_destruct = function(bottom, oldnode) after_destruct = function(bottom, oldnode)
minetest.add_item(bottom, name)
local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } 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 if minetest.get_node(bottom).name ~= name.."_b_2" and minetest.get_node(top).name == name.."_t_1" then
minetest.remove_node(top) minetest.remove_node(top)
@ -394,7 +395,7 @@ function mcl_doors:register_door(name, def)
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
drop = name, drop = "",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -410,6 +411,7 @@ function mcl_doors:register_door(name, def)
sounds = def.sounds, sounds = def.sounds,
after_destruct = function(bottom, oldnode) after_destruct = function(bottom, oldnode)
minetest.add_item(bottom, name)
local top = { x = bottom.x, y = bottom.y + 1, z = bottom.z } 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 if minetest.get_node(bottom).name ~= name.."_b_1" and minetest.get_node(top).name == name.."_t_2" then
minetest.remove_node(top) minetest.remove_node(top)