mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
perf(imports/points): only insert into nearby if point uses callback
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user