From 9de8cc12bbe000d0f29a64c5581ac172a5d7db53 Mon Sep 17 00:00:00 2001 From: stujones11 Date: Sun, 10 Apr 2016 20:17:50 +0100 Subject: [PATCH] Fix disappearing entities when placing stands next to each other --- 3d_armor_stand/init.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/3d_armor_stand/init.lua b/3d_armor_stand/init.lua index 9e3925f..a272db1 100644 --- a/3d_armor_stand/init.lua +++ b/3d_armor_stand/init.lua @@ -21,14 +21,16 @@ local function update_entity(pos) local node = minetest.get_node(pos) local objects = minetest.get_objects_inside_radius(pos, 1) or {} for _, obj in pairs(objects) do - local ent = obj:get_luaentity() - if ent then - if ent.name == "3d_armor_stand:armor_entity" then - -- Remove duplicates - if object then - obj:remove() - else - object = obj + if vector.equals(obj:getpos(), pos) then + local ent = obj:get_luaentity() + if ent then + if ent.name == "3d_armor_stand:armor_entity" then + -- Remove duplicates + if object then + obj:remove() + else + object = obj + end end end end