Fix maple drawers (#51)

Prevent the visible entity from being deleted on the maple drawers.
This commit is contained in:
gpcf 2020-09-05 23:54:15 +02:00 committed by GitHub
parent d3850ca205
commit 4e2e3a02b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

@ -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

@ -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