From 1b79084e6bbbcbc02229f3136b87cca98f14e829 Mon Sep 17 00:00:00 2001 From: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com> Date: Sun, 17 Mar 2024 22:21:43 +0100 Subject: [PATCH] fix chest duplication bug (#119) closes #118 Co-authored-by: BuckarooBanzay --- compat-chests.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compat-chests.lua b/compat-chests.lua index 0448660..eef3a5a 100644 --- a/compat-chests.lua +++ b/compat-chests.lua @@ -111,6 +111,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end minetest.after(0.2, function() if minetest.get_modpath("default") then + local current_node = minetest.get_node(pos) + if current_node.name ~= "default:" .. swap .. "_open" then + -- the chest has already been replaced, don't try to replace what's there. + -- see: https://github.com/minetest/minetest_game/pull/3046 + return + end minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 }) end