fix(points): store all points within range in nearbyZones

Previously this only stored points with the nearby
method.
This commit is contained in:
Linden
2025-03-18 05:36:57 +11:00
parent d0db63e2ec
commit ff2e765b60

View File

@@ -33,11 +33,6 @@ end
CreateThread(function()
while true do
if nearbyCount ~= 0 then
table.wipe(nearbyPoints)
nearbyCount = 0
end
local coords = GetEntityCoords(cache.ped)
local newPoints = lib.grid.getNearbyEntries(coords, function(entry) return entry.remove == removePoint end) --[[@as CPoint[] ]]
local cellX, cellY = lib.grid.getCellPosition(coords)
@@ -45,7 +40,7 @@ CreateThread(function()
closestPoint = nil
if cellX ~= cache.lastCellX or cellY ~= cache.lastCellY then
for i = 1, #nearbyPoints do
for i = 1, nearbyCount do
local point = nearbyPoints[i]
if point.inside then
@@ -64,6 +59,11 @@ CreateThread(function()
cache.lastCellY = cellY
end
if nearbyCount ~= 0 then
table.wipe(nearbyPoints)
nearbyCount = 0
end
for i = 1, #newPoints do
local point = newPoints[i]
local distance = #(coords - point.coords)
@@ -78,10 +78,8 @@ CreateThread(function()
closestPoint = point
end
if point.nearby then
nearbyCount += 1
nearbyPoints[nearbyCount] = point
end
if point.onEnter and not point.inside then
point.inside = true