Ripped a part utility folder and shoved it into a lib. Changed a lot of Utility prefixes to the modules name. This contains breaking changes. Scripts that use 0.2.0 will need to update to match the new format
This commit is contained in:
gononono64 committed 2025-02-05 17:42:50 -06:00
1 parent a08c22afed
commit 84480f8939
36 files changed
+2523 -97

No files matched your search

+18 -14
View File
@@ -13,10 +13,22 @@ local targetZones = {}
Target = {}
Target.AddGlobalPlayer = function(options)
Target.FixOptions = function(options)
for k, v in pairs(options) do
options[k].action = v.action or v.onSelect
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 = action
end
return options
end
Target.AddGlobalPlayer = function(options)
options = Target.FixOptions(options)
exports['qb-target']:AddGlobalPlayer({
options = options,
distance = options.distance or 1.5
@@ -25,9 +37,7 @@ end
Target.AddGlobalVehicle = function(options)
for k, v in pairs(options) do
options[k].action = v.action or v.onSelect
end
options = Target.FixOptions(options)
exports['qb-target']:AddGlobalVehicle({
options = options,
distance = options.distance or 1.5
@@ -35,9 +45,7 @@ Target.AddGlobalVehicle = function(options)
end
Target.AddLocalEntity = function(entities, options)
for k, v in pairs(options) do
options[k].action = v.action or v.onSelect
end
options = Target.FixOptions(options)
exports['qb-target']:AddTargetEntity(entities, {
options = options,
distance = options.distance or 1.5
@@ -45,9 +53,7 @@ Target.AddLocalEntity = function(entities, options)
end
Target.AddModel = function(models, options)
for k, v in pairs(options) do
options[k].action = v.action or v.onSelect
end
options = Target.FixOptions(options)
exports['qb-target']:AddTargetModel(models, {
options = options,
distance = options.distance or 1.5,
@@ -55,9 +61,7 @@ Target.AddModel = function(models, options)
end
Target.AddBoxZone = function(name, coords, size, heading, options)
for k, v in pairs(options) do
options[k].action = v.action or v.onSelect
end
options = Target.FixOptions(options)
exports['qb-target']:AddBoxZone(name, coords, size.x, size.y, {
name = name,
debugPoly = targetDebug,