small update
target got a print if onSelect or action are nil also added groups in fixoptions for sleepless client entities using return for loadmodel
This commit is contained in:
1 parent
07b76868f2
commit
2ad1f4669c
4 files changed
+16
-12
No files matched your search
@@ -22,14 +22,18 @@ 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)
|
||||
if not action then
|
||||
print(("Target option (%s) %s is missing an 'onSelect' or 'action' function."):format(k, v.label))
|
||||
else
|
||||
local select = function(entityOrData)
|
||||
if type(entityOrData) == 'table' then
|
||||
return action(entityOrData.entity)
|
||||
end
|
||||
return action(entityOrData)
|
||||
end
|
||||
return action(entityOrData)
|
||||
options[k].onSelect = select
|
||||
options[k].groups = v.job or v.groups
|
||||
end
|
||||
options[k].onSelect = select
|
||||
options[k].groups = v.job or v.groups
|
||||
end
|
||||
return options
|
||||
end
|
||||
|
||||
@@ -28,6 +28,7 @@ Target.FixOptions = function(options)
|
||||
return action(entityOrData)
|
||||
end
|
||||
options[k].onSelect = select
|
||||
options[k].groups = v.job or v.groups
|
||||
end
|
||||
return options
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user