perf(imports/points): only insert into nearby if point uses callback

This commit is contained in:
Linden
2022-03-25 10:38:32 +00:00
parent 820beb5438
commit 3b18ca2b33

View File

@@ -30,9 +30,12 @@ CreateThread(function()
local distance = #(coords - point.coords)
if distance <= point.distance then
nearby[#nearby + 1] = point
point.currentDistance = distance
if point.callback then
nearby[#nearby + 1] = point
end
if point.onEnter and not point.inside then
point.inside = true
point:onEnter()
@@ -50,8 +53,7 @@ CreateThread(function()
while true do
Wait(0)
for i = 1, #nearby do
local point = nearby[i]
if point.callback then point:callback() end
nearby[i]:callback()
end
end
end)