Close formspecs when double chest breaks

This commit is contained in:
Wuzzy 2019-03-09 05:51:58 +01:00
parent 79a3eb23a7
commit c6efa8a626
1 changed files with 6 additions and 0 deletions

View File

@ -220,6 +220,9 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_right" then if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_right" then
return return
end end
for pl=1, #players do
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..formspec_basename.."_"..p.x.."_"..p.y.."_"..p.z)
end
minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 }) minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 })
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
@ -341,6 +344,9 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_left" then if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_left" then
return return
end end
for pl=1, #players do
minetest.close_formspec(players[pl]:get_player_name(), "mcl_chests:"..formspec_basename.."_"..p.x.."_"..p.y.."_"..p.z)
end
minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 }) minetest.swap_node(p, { name = "mcl_chests:"..basename, param2 = param2 })
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)