From 225930a2c73225041368aea750c260335841bcc8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 9 Mar 2019 06:09:52 +0100 Subject: [PATCH] Constructing double chest part checks for neighbor ... and reverts to single chest if none found. Required for piston stuff. --- mods/ITEMS/mcl_chests/init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mods/ITEMS/mcl_chests/init.lua b/mods/ITEMS/mcl_chests/init.lua index e17450ae..d3ceeb3f 100644 --- a/mods/ITEMS/mcl_chests/init.lua +++ b/mods/ITEMS/mcl_chests/init.lua @@ -204,6 +204,15 @@ minetest.register_node("mcl_chests:"..basename.."_left", { drop = drop, is_ground_content = false, sounds = mcl_sounds.node_sound_wood_defaults(), + on_construct = function(pos) + local n = minetest.get_node(pos) + local param2 = n.param2 + local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "left") + if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_right" then + n.name = "mcl_chests:"..basename + minetest.swap_node(pos, n) + end + end, on_destruct = function(pos) local n = minetest.get_node(pos) if n.name == "mcl_chests:"..basename then @@ -328,6 +337,15 @@ minetest.register_node("mcl_chests:"..basename.."_right", { drop = drop, is_ground_content = false, sounds = mcl_sounds.node_sound_wood_defaults(), + on_construct = function(pos) + local n = minetest.get_node(pos) + local param2 = n.param2 + local p = mcl_util.get_double_container_neighbor_pos(pos, param2, "right") + if not p or minetest.get_node(p).name ~= "mcl_chests:"..basename.."_left" then + n.name = "mcl_chests:"..basename + minetest.swap_node(pos, n) + end + end, on_destruct = function(pos) local n = minetest.get_node(pos) if n.name == "mcl_chests:"..basename then