From a9648fb45f317ef9f1558d0dabe1394c8fd27028 Mon Sep 17 00:00:00 2001 From: David Malchin Date: Sun, 10 Aug 2025 03:20:46 +0300 Subject: [PATCH] fix(points): grid inconsistencies (#37) --- imports/points/client.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/imports/points/client.lua b/imports/points/client.lua index a0b21d7..f83b7ef 100644 --- a/imports/points/client.lua +++ b/imports/points/client.lua @@ -39,10 +39,14 @@ local function removePoint(self) points[self.id] = nil end +local function hasRemovePoint(entry) + return entry.remove == removePoint +end + CreateThread(function() while true do local coords = GetEntityCoords(cache.ped) - local newPoints = lib.grid.getNearbyEntries(coords, function(entry) return entry.remove == removePoint end) --[[@as CPoint[] ]] + local newPoints = lib.grid.getNearbyEntries(coords, hasRemovePoint) --[[@as CPoint[] ]] local cellX, cellY = lib.grid.getCellPosition(coords) cache.coords = coords closestPoint = nil @@ -89,9 +93,11 @@ CreateThread(function() nearbyCount += 1 nearbyPoints[nearbyCount] = point - if point.onEnter and not point.inside then + if not point.inside then point.inside = true - point:onEnter() + if point.onEnter then + point:onEnter() + end end elseif point.currentDistance then if point.onExit then point:onExit() end