From 58242b421399cff29ec66d330bd1115ba2fb3b48 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Sat, 16 Aug 2025 07:04:00 -0400 Subject: [PATCH] possible fix Before only one point could exist per cell. This corrects that but im unsure on the impact to performance or grids --- lib/points/client/pointsv2.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/points/client/pointsv2.lua b/lib/points/client/pointsv2.lua index fd5dd0f..5500047 100644 --- a/lib/points/client/pointsv2.lua +++ b/lib/points/client/pointsv2.lua @@ -102,7 +102,8 @@ function Point.Register(id, target, distance, args, _onEnter, _onExit) self.inside = false -- Track if player is inside self.args = args or {} local grid = Grid.GetCellByCoords(coords) - self.cellKey = Grid.GetCellId(coords) + -- OLD CODE: self.cellKey = Grid.GetCellId(coords) -- This caused points to overwrite each other in same cell + self.cellKey = id -- Use unique ID instead of cell coordinates grid[self.cellKey] = self Point.All[id] = self Point.StartLoop() @@ -132,14 +133,17 @@ function Point.UpdateCoords(id, coords) if not point then return end local newGrid = Grid.GetCellByCoords(coords) - if not newGrid or newGrid[point.cellKey] then return end + if not newGrid then return end + -- OLD CODE: if not newGrid or newGrid[point.cellKey] then return end -- This prevented adding points to cells with existing points + local oldGrid = Grid.GetCellByCoords(point.coords) if oldGrid then oldGrid[point.cellKey] = nil end -- Add to new grid point.coords = coords - point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) + -- OLD CODE: point.cellKey = string.format("%d_%d", newGrid.x, newGrid.y) -- This used cell coordinates instead of unique ID + point.cellKey = id -- Keep using the unique ID newGrid[point.cellKey] = point return true end