diff --git a/lua/helpers.lua b/lua/helpers.lua index 61078bd..de039ce 100755 --- a/lua/helpers.lua +++ b/lua/helpers.lua @@ -100,6 +100,7 @@ function drawers.spawn_visuals(pos) local pos2 = vector.add(pos, vector.multiply(fdir, 0.45)) local obj = core.add_entity(pos2, "drawers:visual") + if not obj then return end if bdir.x < 0 then obj:set_yaw(0.5 * math.pi) end if bdir.z < 0 then obj:set_yaw(math.pi) end diff --git a/lua/visual.lua b/lua/visual.lua index 3510723..130c1fa 100755 --- a/lua/visual.lua +++ b/lua/visual.lua @@ -78,7 +78,7 @@ core.register_entity("drawers:visual", { end local node = minetest.get_node(self.object:get_pos()) - if not node.name:match("^drawers:") then + if core.get_item_group(node.name, "drawer") == 0 then self.object:remove() return end @@ -210,7 +210,8 @@ core.register_entity("drawers:visual", { 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 + + if core.get_item_group(node.name, "drawer") == 0 then self.object:remove() return end