This repository was archived by the owner on Apr 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 33
33
34
34
CreateThread (function ()
35
35
while true do
36
- if nearbyCount ~= 0 then
37
- table .wipe (nearbyPoints )
38
- nearbyCount = 0
39
- end
40
-
41
36
local coords = GetEntityCoords (cache .ped )
42
37
local newPoints = lib .grid .getNearbyEntries (coords , function (entry ) return entry .remove == removePoint end ) --[[ @as CPoint[] ]]
43
38
local cellX , cellY = lib .grid .getCellPosition (coords )
44
39
cache .coords = coords
45
40
closestPoint = nil
46
41
47
42
if cellX ~= cache .lastCellX or cellY ~= cache .lastCellY then
48
- for i = 1 , # nearbyPoints do
43
+ for i = 1 , nearbyCount do
49
44
local point = nearbyPoints [i ]
50
45
51
46
if point .inside then
@@ -64,6 +59,11 @@ CreateThread(function()
64
59
cache .lastCellY = cellY
65
60
end
66
61
62
+ if nearbyCount ~= 0 then
63
+ table .wipe (nearbyPoints )
64
+ nearbyCount = 0
65
+ end
66
+
67
67
for i = 1 , # newPoints do
68
68
local point = newPoints [i ]
69
69
local distance = # (coords - point .coords )
@@ -78,10 +78,8 @@ CreateThread(function()
78
78
closestPoint = point
79
79
end
80
80
81
- if point .nearby then
82
- nearbyCount += 1
83
- nearbyPoints [nearbyCount ] = point
84
- end
81
+ nearbyCount += 1
82
+ nearbyPoints [nearbyCount ] = point
85
83
86
84
if point .onEnter and not point .inside then
87
85
point .inside = true
You can’t perform that action at this time.
0 commit comments