version '0.0.7'
This commit is contained in:
1 parent
89a9a371bd
commit
47977ce701
105 files changed
+5036
-1
No files matched your search
@@ -0,0 +1,37 @@
|
||||
Points = {}
|
||||
local ActivePoints = {}
|
||||
|
||||
Points.RegisterPoint = function(pointCoords, pointDistance, pointOnEnter, pointOnExit)
|
||||
local enterZone = lib.points.new({
|
||||
coords = pointCoords,
|
||||
distance = pointDistance,
|
||||
onEnter = function(self)
|
||||
pointOnEnter(self)
|
||||
end,
|
||||
onExit = function(self)
|
||||
pointOnExit(self)
|
||||
end,
|
||||
})
|
||||
local pointID = Ids.CreateUniqueId(nil, 5, nil)
|
||||
ActivePoints[pointID] = enterZone
|
||||
return enterZone, pointID
|
||||
end
|
||||
|
||||
-- Function to retrieve the enterZone using pointID
|
||||
Points.GetPointById = function(pointID)
|
||||
return ActivePoints[pointID]
|
||||
end
|
||||
|
||||
Points.RemovePoint = function(pointID)
|
||||
local point = ActivePoints[pointID]
|
||||
if point then
|
||||
print("Removing point with ID " .. pointID)
|
||||
point:remove() -- Call the remove method on the point (ensure this method stops all event listeners)
|
||||
ActivePoints[pointID] = nil -- Remove from ActivePoints table
|
||||
print("Point removed successfully.")
|
||||
return true
|
||||
else
|
||||
print("Point with ID " .. pointID .. " not found.")
|
||||
return false
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user