Skip to content

Commit

Permalink
Fix maple drawers (#51)
Browse files Browse the repository at this point in the history
Prevent the visible entity from being deleted on the maple drawers.
  • Loading branch information
gpcf authored Sep 5, 2020
1 parent d3850ca commit 4e2e3a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lua/visual.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4e2e3a0

Please sign in to comment.