mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56: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)
|
local distance = #(coords - point.coords)
|
||||||
|
|
||||||
if distance <= point.distance then
|
if distance <= point.distance then
|
||||||
nearby[#nearby + 1] = point
|
|
||||||
point.currentDistance = distance
|
point.currentDistance = distance
|
||||||
|
|
||||||
|
if point.callback then
|
||||||
|
nearby[#nearby + 1] = point
|
||||||
|
end
|
||||||
|
|
||||||
if point.onEnter and not point.inside then
|
if point.onEnter and not point.inside then
|
||||||
point.inside = true
|
point.inside = true
|
||||||
point:onEnter()
|
point:onEnter()
|
||||||
@@ -50,8 +53,7 @@ CreateThread(function()
|
|||||||
while true do
|
while true do
|
||||||
Wait(0)
|
Wait(0)
|
||||||
for i = 1, #nearby do
|
for i = 1, #nearby do
|
||||||
local point = nearby[i]
|
nearby[i]:callback()
|
||||||
if point.callback then point:callback() end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user