Remove cache and batch event libraries, update locales

Deleted the cache and batch event libraries from the codebase, including all related client, server, and shared files. Removed server-side particle library and associated client event handlers. Updated utility and clothing modules to remove cache dependencies. Improved utility logging and deprecated point functions with notices. Updated all locales to use a consistent 'PurchasedItem' message format and added Bulgarian (bg) translation. Bumped version to 0.13.1 in fxmanifest.
This commit is contained in:
MrNewb committed 2025-12-23 19:27:27 -05:00
1 parent 5fd0744ca5
commit 48f8122197
76 files changed
+488 -875

No files matched your search

+20 -19
View File
@@ -2,16 +2,21 @@
Target = Target or {}
Ids = Ids or Require("lib/utility/shared/ids.lua")
local InteractIds = {}
local function warnUser()
print("Currently Only Targeting Is Supported By Community Bridge, You Are Using A Resource That Requires The Target Module To Be Used.")
end
local InteractIds = {}
Target.GetCanInteract = function(id)
function Target.GetResourceName()
return "default"
end
function Target.GetCanInteract(id)
return InteractIds[id]
end
Target.CreateCanInteract = function(cb)
function Target.CreateCanInteract(cb)
if not cb then return end
local id = Ids.CreateUniqueId(InteractIds)
InteractIds[id] = {
@@ -22,7 +27,7 @@ Target.CreateCanInteract = function(cb)
return id
end
Target.CanInteract = function(id, ...)
function Target.CanInteract(id, ...)
local interactData = InteractIds[id]
if not interactData then return true end
if interactData.ableToInteract == -1 then
@@ -36,7 +41,7 @@ Target.CanInteract = function(id, ...)
return interactData.ableToInteract > 0
end
Target.FixOptions = function(options)
function Target.FixOptions(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
local select = function(entityOrData)
@@ -57,19 +62,19 @@ Target.FixOptions = function(options)
return options
end
Target.AddGlobalPlayer = function(options)
function Target.AddGlobalPlayer(options)
warnUser()
end
Target.AddGlobalVehicle = function(options)
function Target.AddGlobalVehicle(options)
warnUser()
end
Target.RemoveGlobalVehicle = function(options)
function Target.RemoveGlobalVehicle(options)
warnUser()
end
Target.AddLocalEntity = function(entities, _options)
function Target.AddLocalEntity(entities, _options)
local fixedOptions = Target.FixOptions(_options)
if type(entities) == "string" or type(entities) == "number" then
entities = { entities }
@@ -117,11 +122,11 @@ Target.AddLocalEntity = function(entities, _options)
end
end
Target.AddModel = function(models, options)
function Target.AddModel(models, options)
warnUser()
end
Target.AddBoxZone = function(name, coords, size, heading, options)
function Target.AddBoxZone(name, coords, size, heading, options)
local fixedOptions = Target.FixOptions(options)
local id = Ids.RandomString()
local title = Bridge.Language.Locale("target.title")
@@ -162,24 +167,20 @@ Target.AddBoxZone = function(name, coords, size, heading, options)
end)
end
Target.RemoveGlobalPlayer = function()
function Target.RemoveGlobalPlayer()
warnUser()
end
Target.RemoveLocalEntity = function(entity)
function Target.RemoveLocalEntity(entity)
warnUser()
end
Target.RemoveModel = function(model)
function Target.RemoveModel(model)
warnUser()
end
Target.RemoveZone = function(name)
function Target.RemoveZone(name)
warnUser()
end
Target.GetResourceName = function()
return "default"
end
return Target
+17 -20
View File
@@ -4,12 +4,9 @@ if GetResourceState(resourceName) == 'missing' then return end
Target = Target or {}
local targetDebug = BridgeSharedConfig and BridgeSharedConfig.DebugLevel == 2 or false
local ox_target = exports.ox_target
local targetZones = {}
Target = Target or {}
Target.GetResourceName = function()
return "ox_target"
end
@@ -17,7 +14,7 @@ end
---This is an internal function that is used to fix the options passed to fit alternative target systems, for example qb-ox or ox-qb etc.
---@param options table
---@return table
Target.FixOptions = function(options)
function Target.FixOptions(options)
for _, v in pairs(options) do
local action = v.onSelect or v.action
if not action then
@@ -50,45 +47,45 @@ end
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool)
function Target.DisableTargeting(bool)
ox_target:disableTargeting(bool)
end
---This will add target options to players.
---@param options table
Target.AddGlobalPlayer = function(options)
function Target.AddGlobalPlayer(options)
options = Target.FixOptions(options)
ox_target:addGlobalPlayer(options)
end
---This will remove target options from all players.
Target.RemoveGlobalPlayer = function()
function Target.RemoveGlobalPlayer()
ox_target:removeGlobalPlayer()
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
function Target.AddGlobalPed(options)
options = Target.FixOptions(options)
ox_target:addGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
function Target.RemoveGlobalPed(options)
ox_target:removeGlobalPed(options)
end
---This will add taget options to all vehicles.
---@param options table
Target.AddGlobalVehicle = function(options)
function Target.AddGlobalVehicle(options)
options = Target.FixOptions(options)
ox_target:addGlobalVehicle(options)
end
---This will remove target options from all vehicles.
---@param options table
Target.RemoveGlobalVehicle = function(options)
function Target.RemoveGlobalVehicle(options)
local assembledLables = {}
for k, v in pairs(options) do
table.insert(assembledLables, v.name)
@@ -99,7 +96,7 @@ end
---This will generate targets on non networked entites with the passed options.
---@param entities number | table
---@param options table
Target.AddLocalEntity = function(entities, options)
function Target.AddLocalEntity(entities, options)
options = Target.FixOptions(options)
ox_target:addLocalEntity(entities, options)
end
@@ -107,14 +104,14 @@ end
---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity.
---@param entities table
---@param optionNames string | table | nil
Target.RemoveLocalEntity = function(entities, optionNames)
function Target.RemoveLocalEntity(entities, optionNames)
ox_target:removeLocalEntity(entities, optionNames)
end
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddNetworkedEntity = function(netids, options)
function Target.AddNetworkedEntity(netids, options)
options = Target.FixOptions(options)
ox_target:addEntity(netids, options)
end
@@ -122,21 +119,21 @@ end
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
function Target.RemoveNetworkedEntity(netids, optionNames)
ox_target:removeEntity(netids, optionNames)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param models number | table
---@param options table
Target.AddModel = function(models, options)
function Target.AddModel(models, options)
options = Target.FixOptions(options)
ox_target:addModel(models, options)
end
---This will remove target options from all specified models.
---@param model number
Target.RemoveModel = function(model)
function Target.RemoveModel(model)
ox_target:removeModel(model)
end
@@ -146,7 +143,7 @@ end
---@param size table
---@param heading number
---@param options table
Target.AddBoxZone = function(name, coords, size, heading, options, debug)
function Target.AddBoxZone(name, coords, size, heading, options, debug)
options = Target.FixOptions(options or {})
if not next(options) then return end
local target = ox_target:addBoxZone({
@@ -165,7 +162,7 @@ end
---@param coords table
---@param radius number
---@param options table
Target.AddSphereZone = function(name, coords, radius, options, debug)
function Target.AddSphereZone(name, coords, radius, options, debug)
options = Target.FixOptions(options)
local target = ox_target:addSphereZone({
coords = coords,
@@ -180,7 +177,7 @@ end
---This will remove target options from a specific zone.
---@param name string
Target.RemoveZone = function(name)
function Target.RemoveZone(name)
if not name then return end
for _, data in pairs(targetZones) do
if data.name == name then
+26 -30
View File
@@ -5,18 +5,14 @@ if GetResourceState("ox_target") ~= 'missing' then return end
Target = Target or {}
local targetDebug = BridgeSharedConfig and BridgeSharedConfig.DebugLevel == 2 or false
local targetZones = {}
Target = Target or {}
local qb_target = exports['qb-target']
Target.GetResourceName = function()
function Target.GetResourceName()
return "qb-target"
end
function GetLargestDistance(data)
local function getLargestDistance(data)
local largestDistance = -1
for _, v in pairs(data) do
if v.distance and v.distance > largestDistance then
@@ -30,7 +26,7 @@ end
---This is an internal function that is used to fix the options passed to fit alternative target systems, for example qb-ox or ox-qb etc.
---@param options table
---@return table
Target.FixOptions = function(options)
function Target.FixOptions(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
local select = action and function(entityOrData)
@@ -62,55 +58,55 @@ end
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool)
function Target.DisableTargeting(bool)
qb_target:AllowTargeting(not bool)
end
---This will add target options to players.
---@param options table
Target.AddGlobalPlayer = function(options)
function Target.AddGlobalPlayer(options)
options = Target.FixOptions(options)
qb_target:AddGlobalPlayer({
options = options,
distance = GetLargestDistance(options)
distance = getLargestDistance(options)
})
end
---This will remove target options from all players.
Target.RemoveGlobalPlayer = function()
function Target.RemoveGlobalPlayer()
qb_target:RemoveGlobalPlayer()
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
function Target.AddGlobalPed(options)
options = Target.FixOptions(options)
qb_target:AddGlobalPed({
options = options,
distance = GetLargestDistance(options)
distance = getLargestDistance(options)
})
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
function Target.RemoveGlobalPed(options)
qb_target:RemoveGlobalPed(options)
end
---This will add taget options to all vehicles.
---@param options table
Target.AddGlobalVehicle = function(options)
function Target.AddGlobalVehicle(options)
options = Target.FixOptions(options)
qb_target:AddGlobalVehicle({
options = options,
distance = GetLargestDistance(options)
distance = getLargestDistance(options)
})
end
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddNetworkedEntity = function(netids, options)
function Target.AddNetworkedEntity(netids, options)
options = Target.FixOptions(options)
qb_target:AddTargetEntity(netids, options)
end
@@ -118,13 +114,13 @@ end
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
function Target.RemoveNetworkedEntity(netids, optionNames)
qb_target:RemoveTargetEntity(netids, optionNames)
end
---This will remove target options from all vehicles.
---@param options table
Target.RemoveGlobalVehicle = function(options)
function Target.RemoveGlobalVehicle(options)
local assembledLables = {}
for k, v in pairs(options) do
table.insert(assembledLables, v.label)
@@ -135,35 +131,35 @@ end
---This will generate targets on non networked entites with the passed options.
---@param entities number | table
---@param options table
Target.AddLocalEntity = function(entities, options)
function Target.AddLocalEntity(entities, options)
options = Target.FixOptions(options)
qb_target:AddTargetEntity(entities, {
options = options,
distance = GetLargestDistance(options)
distance = getLargestDistance(options)
})
end
---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity.
---@param entity number | table
---@param labels string | table | nil
Target.RemoveLocalEntity = function(entity, labels)
function Target.RemoveLocalEntity(entity, labels)
qb_target:RemoveTargetEntity(entity, labels)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param models number | table
---@param options table
Target.AddModel = function(models, options, distance)
function Target.AddModel(models, options, distance)
options = Target.FixOptions(options)
qb_target:AddTargetModel(models, {
options = options,
distance = GetLargestDistance(options),
distance = getLargestDistance(options),
})
end
---This will remove target options from all specified models.
---@param model number
Target.RemoveModel = function(model)
function Target.RemoveModel(model)
qb_target:RemoveTargetModel(model)
end
@@ -173,7 +169,7 @@ end
---@param size table
---@param heading number
---@param options table
Target.AddBoxZone = function(name, coords, size, heading, options, debug)
function Target.AddBoxZone(name, coords, size, heading, options, debug)
options = Target.FixOptions(options)
if not next(options) then return end
qb_target:AddBoxZone(name, coords, size.x, size.y, {
@@ -184,7 +180,7 @@ Target.AddBoxZone = function(name, coords, size, heading, options, debug)
maxZ = coords.z + (size.z * 0.5),
}, {
options = options,
distance = GetLargestDistance(options),
distance = getLargestDistance(options),
})
table.insert(targetZones, { name = name, creator = GetInvokingResource() })
return name
@@ -195,14 +191,14 @@ end
---@param coords table
---@param radius number
---@param options table
Target.AddSphereZone = function(name, coords, radius, options, debug)
function Target.AddSphereZone(name, coords, radius, options, debug)
options = Target.FixOptions(options)
qb_target:AddCircleZone(name, coords, radius, {
name = name,
debugPoly = targetDebug or debug,
}, {
options = options,
distance = GetLargestDistance(options),
distance = getLargestDistance(options),
})
table.insert(targetZones, { name = name, creator = GetInvokingResource() })
return name
@@ -210,7 +206,7 @@ end
---This will remove target options from a specific zone.
---@param name string
Target.RemoveZone = function(name)
function Target.RemoveZone(name)
if not name then return end
for _, data in pairs(targetZones) do
if data.name == name then
+22 -28
View File
@@ -3,22 +3,20 @@ local resourceName = "sleepless_interact"
if GetResourceState(resourceName) == 'missing' then return end
if GetResourceState("ox_target") == 'started' then return end
local targetDebug = false
local function detectDebugEnabled()
if BridgeSharedConfig.DebugLevel == 2 then targetDebug = true end
end
detectDebugEnabled()
local targetDebug = BridgeSharedConfig and BridgeSharedConfig.DebugLevel == 2 or false
local sleepless_interact = exports.sleepless_interact
local targetZones = {}
Target = Target or {}
function Target.GetResourceName()
return "sleepless_interact"
end
---This is an internal function that is used to fix the options passed to fit alternative target systems, for example qb-ox or ox-qb etc.
---@param options table
---@return table
Target.FixOptions = function(options)
function Target.FixOptions(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
local select = function(entityOrData)
@@ -42,45 +40,45 @@ end
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool) -- someone disabled this mistakenly
function Target.DisableTargeting(bool) -- someone disabled this mistakenly
sleepless_interact:disableInteract(bool)
end
---This will add target options to players.
---@param options table
Target.AddGlobalPlayer = function(options)
function Target.AddGlobalPlayer(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalPlayer(options)
end
---This will remove target options from all players.
Target.RemoveGlobalPlayer = function()
function Target.RemoveGlobalPlayer()
sleepless_interact:removeGlobalPlayer()
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
function Target.AddGlobalPed(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
function Target.RemoveGlobalPed(options)
sleepless_interact:removeGlobalPed(options)
end
---This will add taget options to all vehicles.
---@param options table
Target.AddGlobalVehicle = function(options)
function Target.AddGlobalVehicle(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalVehicle(options)
end
---This will remove target options from all vehicles.
---@param options table
Target.RemoveGlobalVehicle = function(options)
function Target.RemoveGlobalVehicle(options)
local assembledLables = {}
for k, v in pairs(options) do
table.insert(assembledLables, v.name)
@@ -91,7 +89,7 @@ end
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddNetworkedEntity = function(netids, options)
function Target.AddNetworkedEntity(netids, options)
options = Target.FixOptions(options)
sleepless_interact:addEntity(netids, options)
end
@@ -99,14 +97,14 @@ end
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
function Target.RemoveNetworkedEntity(netids, optionNames)
sleepless_interact:removeEntity(netids, optionNames)
end
---This will generate targets on non networked entites with the passed options.
---@param entities number | table
---@param options table
Target.AddLocalEntity = function(entities, options)
function Target.AddLocalEntity(entities, options)
options = Target.FixOptions(options)
sleepless_interact:addLocalEntity(entities, options)
end
@@ -114,21 +112,21 @@ end
---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity.
---@param entity number | table
---@param labels string | table | nil
Target.RemoveLocalEntity = function(entity, labels)
function Target.RemoveLocalEntity(entity, labels)
sleepless_interact:removeLocalEntity(entity, labels)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param models number | table
---@param options table
Target.AddModel = function(models, options)
function Target.AddModel(models, options)
options = Target.FixOptions(options)
sleepless_interact:addModel(models, options)
end
---This will remove target options from all specified models.
---@param model number
Target.RemoveModel = function(model)
function Target.RemoveModel(model)
sleepless_interact:removeModel(model)
end
@@ -138,7 +136,7 @@ end
---@param size table
---@param heading number
---@param options table
Target.AddBoxZone = function(name, coords, size, heading, options)
function Target.AddBoxZone(name, coords, size, heading, options)
options = Target.FixOptions(options)
local target = sleepless_interact:addCoords({
coords = coords,
@@ -153,7 +151,7 @@ end
---@param coords table
---@param radius number
---@param options table
Target.AddSphereZone = function(name, coords, radius, options, debug)
function Target.AddSphereZone(name, coords, radius, options, debug)
options = Target.FixOptions(options)
local target = sleepless_interact:addSphereZone({
coords = coords,
@@ -168,7 +166,7 @@ end
---This will remove target options from a specific zone.
---@param name string
Target.RemoveZone = function(name)
function Target.RemoveZone(name)
for _, data in pairs(targetZones) do
if data.name == name then
sleepless_interact:removeCoords(data.id)
@@ -188,8 +186,4 @@ AddEventHandler('onResourceStop', function(resource)
targetZones = {}
end)
Target.GetResourceName = function()
return "sleepless_interact"
end
return Target