diff options
Diffstat (limited to 'lua/helpers.lua')
-rwxr-xr-x | lua/helpers.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lua/helpers.lua b/lua/helpers.lua index 3662da2..374cd95 100755 --- a/lua/helpers.lua +++ b/lua/helpers.lua @@ -66,7 +66,7 @@ function drawers.get_inv_image(name) return texture end -function drawers.spawn_visual(pos) +function drawers.spawn_visuals(pos) local node = core.get_node(pos) local ndef = core.registered_nodes[node.name] local drawerType = ndef.groups.drawer @@ -150,6 +150,18 @@ function drawers.spawn_visual(pos) end end +function drawers.remove_visuals(pos) + local objs = core.get_objects_inside_radius(pos, 0.537) + if not objs then return end + + for _, obj in pairs(objs) do + if obj and obj:get_luaentity() and + obj:get_luaentity().name == "drawers:visual" then + obj:remove() + end + end +end + function drawers.randomize_pos(pos) local rndpos = table.copy(pos) local x = math.random(-50, 50) * 0.01 |