Matrix Screen: Fix object duplication bug

This commit is contained in:
Thomas--S 2017-01-17 05:41:31 +01:00
parent 40f546226d
commit c67df39db1

View File

@ -10,14 +10,22 @@ local matrix_px = 16
-- gets the object at pos -- gets the object at pos
local function get_screen(pos) local function get_screen(pos)
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.5)) do local object
local objects = minetest.get_objects_inside_radius(pos, 0.5) or {}
for _, obj in pairs(objects) do
local ent = obj:get_luaentity() local ent = obj:get_luaentity()
if ent if ent then
and ent.name == "streets:matrix_screen_lights" then if ent.name == "streets:matrix_screen_lights" then
return obj -- Remove duplicates
if object then
obj:remove()
else
object = obj
end
end
end end
end end
return false return object
end end
-- used to get the texture for the object -- used to get the texture for the object