1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-25 00:04:15 +02:00
parent be02d05ba8
commit fc7ea910e9
35 changed files with 11992 additions and 1 deletions

View file

@ -0,0 +1,43 @@
local points = {}
---@param id string
---@param coords table
---@param distance number
---@param label string
---@param key number
---@param keyLabel string
---@param onClick function
---@param canInteract function | boolean
local createInteractionPoint = function(id, coords, distance, label, key, keyLabel, onClick, canInteract)
points[id] = lib.points.new({
coords = coords,
distance = distance,
onEnter = function()
if not canInteract then return end
exports.mt_lib:showTextUI(label, keyLabel, 'bottom')
end,
onExit = function()
exports.mt_lib:hideTextUI()
end,
nearby = function()
if canInteract and IsControlJustPressed(0, key) then
onClick()
end
end
})
end
exports("createInteractionPoint", createInteractionPoint)
---@param id string
local removeInteractionPoint = function(id)
if not points[id] then return end
points[id]:remove()
exports.mt_lib:hideTextUI()
end
exports("removeInteractionPoint", removeInteractionPoint)
---@return table | nil
local getCreatedPoints = function()
return points
end
exports("getCreatedPoints", getCreatedPoints)