Commit 4188bd2 1 parent 0b9f6e0 commit 4188bd2 Copy full SHA for 4188bd2
File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 100
100
local insideZones = lib .context == ' client' and {} --[[ @as table<number, CZone>]]
101
101
local exitingZones = lib .context == ' client' and lib .array :new () --[[ @as Array<CZone>]]
102
102
local enteringZones = lib .context == ' client' and lib .array :new () --[[ @as Array<CZone>]]
103
+ local nearbyZones = lib .array :new () --[[ @as Array<CZone>]]
103
104
local glm_polygon_contains = glm .polygon .contains
104
105
local tick
105
106
@@ -120,23 +121,21 @@ end
120
121
CreateThread (function ()
121
122
if lib .context == ' server' then return end
122
123
123
- local lastZones = {}
124
-
125
124
while true do
126
125
local coords = GetEntityCoords (cache .ped )
127
- local zones = lib .grid .getNearbyEntries (coords , function (entry ) return entry .remove == removeZone end ) --[[ @as CZone[] ]]
126
+ local zones = lib .grid .getNearbyEntries (coords , function (entry ) return entry .remove == removeZone end ) --[[ @as Array< CZone> ]]
128
127
local cellX , cellY = lib .grid .getCellPosition (coords )
129
128
cache .coords = coords
130
129
131
130
if cellX ~= cache .lastCellX or cellY ~= cache .lastCellY then
132
- for i = 1 , # lastZones do
133
- local zone = lastZones [i ]
131
+ for i = 1 , # nearbyZones do
132
+ local zone = nearbyZones [i ]
134
133
135
134
zone .insideZone = false
136
135
insideZones [zone .id ] = nil
137
136
end
138
137
139
- lastZones = zones
138
+ nearbyZones = zones
140
139
cache .lastCellX = cellX
141
140
cache .lastCellY = cellY
142
141
end
@@ -467,4 +466,6 @@ function lib.zones.getAllZones() return Zones end
467
466
468
467
function lib .zones .getCurrentZones () return insideZones end
469
468
469
+ function lib .zones .getNearbyZones () return nearbyZones end
470
+
470
471
return lib .zones
You can’t perform that action at this time.
0 commit comments