partial support for sleepless interact
This commit is contained in:
1 parent
24ebe4e5d9
commit
00e20f8f94
3 files changed
+37
-2
No files matched your search
@@ -12,7 +12,7 @@ detectDebugEnabled()
|
||||
local ox_target = exports.ox_target
|
||||
local targetZones = {}
|
||||
|
||||
Target = {}
|
||||
Target = Target or {}
|
||||
|
||||
Target.FixOptions = function(options)
|
||||
for k, v in pairs(options) do
|
||||
|
||||
@@ -11,7 +11,7 @@ detectDebugEnabled()
|
||||
|
||||
local targetZones = {}
|
||||
|
||||
Target = {}
|
||||
Target = Target or {}
|
||||
|
||||
Target.FixOptions = function(options)
|
||||
for k, v in pairs(options) do
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
if GetResourceState('sleepless_interact') ~= 'started' then return end
|
||||
|
||||
local sleepless = exports.sleepless_interact
|
||||
|
||||
Target = Target or {}
|
||||
|
||||
Target.FixOptions = function(options)
|
||||
for k, v in pairs(options) do
|
||||
local action = v.onSelect or v.action
|
||||
local select = function(entityOrData)
|
||||
if type(entityOrData) == 'table' then
|
||||
return action(entityOrData.entity)
|
||||
end
|
||||
return action(entityOrData)
|
||||
end
|
||||
options[k].onSelect = select
|
||||
end
|
||||
return options
|
||||
end
|
||||
|
||||
Target.AddLocalEntity = function(entity, _options)
|
||||
local options = Target.FixOptions(_options)
|
||||
sleepless:addLocalEntity({
|
||||
id = entity,
|
||||
entity = entity,
|
||||
options = options,
|
||||
renderDistance = 10.0,
|
||||
activeDistance = 2.0,
|
||||
cooldown = 1500
|
||||
})
|
||||
end
|
||||
|
||||
Target.RemoveLocalEntity = function(entity)
|
||||
sleepless:removeLocalEntity(entity)
|
||||
end
|
||||
Reference in new issue
Block a user