mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(client/points): add new getter functions
This commit is contained in:
@@ -1,18 +1,23 @@
|
|||||||
---@class CPoint
|
---@class PointProperties
|
||||||
---@field id number
|
|
||||||
---@field coords vector3
|
---@field coords vector3
|
||||||
---@field distance number
|
---@field distance number
|
||||||
---@field currentDistance number
|
|
||||||
---@field isClosest? boolean
|
|
||||||
---@field remove fun()
|
|
||||||
---@field onEnter? fun(self: CPoint)
|
---@field onEnter? fun(self: CPoint)
|
||||||
---@field onExit? fun(self: CPoint)
|
---@field onExit? fun(self: CPoint)
|
||||||
---@field nearby? fun(self: CPoint)
|
---@field nearby? fun(self: CPoint)
|
||||||
---@field [string] any
|
---@field [string] any
|
||||||
|
|
||||||
|
---@class CPoint : PointProperties
|
||||||
|
---@field id number
|
||||||
|
---@field currentDistance number
|
||||||
|
---@field isClosest? boolean
|
||||||
|
---@field remove fun()
|
||||||
|
|
||||||
|
---@type table<number, CPoint>
|
||||||
local points = {}
|
local points = {}
|
||||||
|
---@type CPoint[]
|
||||||
local nearbyPoints = {}
|
local nearbyPoints = {}
|
||||||
local nearbyCount = 0
|
local nearbyCount = 0
|
||||||
|
---@type CPoint?
|
||||||
local closestPoint
|
local closestPoint
|
||||||
local tick
|
local tick
|
||||||
|
|
||||||
@@ -107,6 +112,8 @@ end
|
|||||||
|
|
||||||
lib.points = {
|
lib.points = {
|
||||||
---@return CPoint
|
---@return CPoint
|
||||||
|
---@overload fun(data: PointProperties): CPoint
|
||||||
|
---@overload fun(coords: vector3, distance: number, data?: PointProperties): CPoint
|
||||||
new = function(...)
|
new = function(...)
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local id = #points + 1
|
local id = #points + 1
|
||||||
@@ -140,10 +147,15 @@ lib.points = {
|
|||||||
return self
|
return self
|
||||||
end,
|
end,
|
||||||
|
|
||||||
---@return CPoint
|
getAllPoints = function() return points end,
|
||||||
closest = function()
|
|
||||||
return closestPoint
|
getNearbyPoints = function() return nearbyPoints end,
|
||||||
end
|
|
||||||
|
---@return CPoint?
|
||||||
|
getClosestPoint = function() return closestPoint end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---@deprecated
|
||||||
|
lib.points.closest = lib.points.getClosestPoint
|
||||||
|
|
||||||
return lib.points
|
return lib.points
|
||||||
|
|||||||
Reference in New Issue
Block a user