Update points.lua
This commit is contained in:
1 parent
87ce06a61f
commit
bfbf3e8f61
1 file changed
+6
-3
@@ -5,7 +5,7 @@ local GridCells = {}
|
|||||||
local LoopStarted = false
|
local LoopStarted = false
|
||||||
|
|
||||||
-- Grid configuration
|
-- Grid configuration
|
||||||
local GRID_SIZE = 150.0 -- Size of each grid cell
|
local GRID_SIZE = 500.0 -- Size of each grid cell
|
||||||
local CELL_BUFFER = 1 -- Number of adjacent cells to check
|
local CELL_BUFFER = 1 -- Number of adjacent cells to check
|
||||||
|
|
||||||
-- Consider adding these optimizations
|
-- Consider adding these optimizations
|
||||||
@@ -130,8 +130,9 @@ function Point.StartLoop()
|
|||||||
point.cellKey = Point.GetCellKey(point.coords)
|
point.cellKey = Point.GetCellKey(point.coords)
|
||||||
Point.UpdateInGrid(point, oldCellKey)
|
Point.UpdateInGrid(point, oldCellKey)
|
||||||
end
|
end
|
||||||
|
local coords = point.coords and vector3(point.coords.x, point.coords.y, point.coords.z) or vector3(0, 0, 0)
|
||||||
local distance = #(playerCoords - point.coords)
|
local distance = #(playerCoords - coords)
|
||||||
|
--local distance = #(playerCoords - point.coords)
|
||||||
|
|
||||||
-- Check if player entered/exited the point
|
-- Check if player entered/exited the point
|
||||||
if distance < point.distance then
|
if distance < point.distance then
|
||||||
@@ -152,10 +153,12 @@ function Point.StartLoop()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
--kills the loop if no targets exist
|
--kills the loop if no targets exist
|
||||||
|
--[[
|
||||||
if not targetsExist then
|
if not targetsExist then
|
||||||
LoopStarted = false
|
LoopStarted = false
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
--]]
|
||||||
|
|
||||||
Wait(waitTime) -- Faster updates when moving quickly
|
Wait(waitTime) -- Faster updates when moving quickly
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user