From df4e5f7c0c2f38a65f9cff9d42347a3e1a1aa04a Mon Sep 17 00:00:00 2001 From: Alex <24834740+GreenXenith@users.noreply.github.com> Date: Wed, 27 Mar 2019 09:27:55 -0700 Subject: [PATCH] Remove visual if no drawer (#28) --- lua/visual.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/visual.lua b/lua/visual.lua index b9e5ea3..f81ff20 100755 --- a/lua/visual.lua +++ b/lua/visual.lua @@ -163,6 +163,11 @@ core.register_entity("drawers:visual", { end, on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir) + local node = minetest.get_node(self.object:get_pos()) + if not node.name:match("^drawers:") then + self.object:remove() + return + end local add_stack = not puncher:get_player_control().sneak if core.is_protected(self.drawer_pos, puncher:get_player_name()) then core.record_protection_violation(self.drawer_pos, puncher:get_player_name())