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:
1 parent
5fd0744ca5
commit
48f8122197
76 files changed
+488
-875
No files matched your search
@@ -1,33 +1,34 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Clothing = Clothing or {}
|
||||
|
||||
ClothingBackup = {}
|
||||
Callback = Callback or Require("lib/callback/shared/callback.lua")
|
||||
Ultility = Utility or Require('lib/utility/client/utility.lua')
|
||||
Cache = Cache or Require('lib/cache/shared/cache.lua')
|
||||
|
||||
|
||||
function Clothing.IsMale()
|
||||
local ped = PlayerPedId()
|
||||
if not ped then return end
|
||||
if GetEntityModel(ped) == `mp_m_freemode_01` then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local ClothingBackup = {}
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Clothing.GetResourceName = function()
|
||||
function Clothing.GetResourceName()
|
||||
return 'default'
|
||||
end
|
||||
|
||||
---This will open the clothing menu for a player, in the event there is not a supported menu it will print that.
|
||||
function Clothing.OpenMenu()
|
||||
print("^6 No supported clothing menu in use in community_bridge. ^0 ")
|
||||
end
|
||||
|
||||
---This will check if the player model if male/female
|
||||
---@return boolean
|
||||
function Clothing.IsMale()
|
||||
local ped = PlayerPedId()
|
||||
if not ped or not DoesEntityExist(ped) then return false end
|
||||
if GetEntityModel(ped) == `mp_m_freemode_01` then return true end
|
||||
return false
|
||||
end
|
||||
|
||||
---Get the skin data of a ped
|
||||
---@param entity number
|
||||
---@return table
|
||||
function Clothing.GetAppearance(entity)
|
||||
if not entity and not DoesEntityExist(entity) then return end
|
||||
if not entity and not DoesEntityExist(entity) then return {} end
|
||||
local model = GetEntityModel(entity)
|
||||
local skinData = { model = model, components = {}, props = {} }
|
||||
for i = 0, 11 do
|
||||
@@ -38,17 +39,10 @@ function Clothing.GetAppearance(entity)
|
||||
table.insert(skinData.props,
|
||||
{ prop_id = i, drawable = GetPedPropIndex(entity, i), texture = GetPedPropTextureIndex(entity, i) })
|
||||
end
|
||||
ClothingBackup = skinData
|
||||
return skinData
|
||||
end
|
||||
|
||||
function Clothing.CopyAppearanceToClipboard()
|
||||
local ped = PlayerPedId()
|
||||
if not ped or not DoesEntityExist(ped) then return end
|
||||
local skinData = Clothing.GetAppearance(ped)
|
||||
if not skinData then return end
|
||||
Ultility.CopyToClipboard(skinData)
|
||||
end
|
||||
|
||||
Callback.Register('community_bridge:cb:GetAppearance', function()
|
||||
local ped = PlayerPedId()
|
||||
if not ped or not DoesEntityExist(ped) then return end
|
||||
@@ -57,101 +51,45 @@ Callback.Register('community_bridge:cb:GetAppearance', function()
|
||||
end)
|
||||
|
||||
---Apply skin data to a ped
|
||||
---@param entity number
|
||||
---@param ped number
|
||||
---@param skinData table
|
||||
---@return boolean
|
||||
function Clothing.SetAppearance(entity, skinData)
|
||||
function Clothing.SetAppearance(ped, skinData)
|
||||
for k, v in pairs(skinData.components or {}) do
|
||||
if v.component_id then
|
||||
SetPedComponentVariation(entity, v.component_id, v.drawable, v.texture, 0)
|
||||
SetPedComponentVariation(ped, v.component_id, v.drawable, v.texture, 0)
|
||||
end
|
||||
end
|
||||
for k, v in pairs(skinData.props or {}) do
|
||||
if v.prop_id then
|
||||
SetPedPropIndex(entity, v.prop_id, v.drawable, v.texture, 0)
|
||||
SetPedPropIndex(ped, v.prop_id, v.drawable, v.texture, false)
|
||||
end
|
||||
end
|
||||
ClothingBackup = nil
|
||||
return true
|
||||
end
|
||||
|
||||
---This will return the peds components to the previously stored components
|
||||
---@param ped number
|
||||
---@return boolean
|
||||
Clothing.RestoreAppearance = function(entity)
|
||||
Clothing.SetAppearance(entity, ClothingBackup)
|
||||
Clothing.RestoreAppearance = function(ped)
|
||||
Clothing.SetAppearance(ped, ClothingBackup)
|
||||
return true
|
||||
end
|
||||
|
||||
Clothing.UpdateAppearanceBackup = function(data)
|
||||
ClothingBackup = data
|
||||
end
|
||||
|
||||
Clothing.RunningDebug = false
|
||||
Clothing.Cache = nil -- maybe change this to the actual cache system???!? For future not lazy me
|
||||
|
||||
Cache.Create('Clothing', function()
|
||||
local ped = Cache.Get('Ped')
|
||||
local appearance = Clothing.GetAppearance(ped)
|
||||
if Table.Compare(Clothing.Cache, appearance) then
|
||||
return false
|
||||
end
|
||||
return appearance
|
||||
end, 1000)
|
||||
|
||||
local onChange = nil
|
||||
Clothing.ToggleDebugging = function()
|
||||
if Clothing.RunningDebug then
|
||||
Clothing.RunningDebug = false
|
||||
print("Clothing Debugging Disabled")
|
||||
return Cache.RemoveOnChange('Clothing', onChange)
|
||||
end
|
||||
Clothing.RunningDebug = true
|
||||
print("Clothing Debugging Enabled")
|
||||
|
||||
if Clothing.OpenMenu then
|
||||
Clothing.OpenMenu()
|
||||
end
|
||||
|
||||
onChange = Cache.OnChange('Clothing', function(new, old)
|
||||
print("Clothing Debugging", new)
|
||||
for k, v in pairs(old.components) do
|
||||
if v.component_id then
|
||||
if new.components[k].drawable ~= v.drawable or new.components[k].texture ~= v.texture then
|
||||
print("Component ID: " ..
|
||||
v.component_id ..
|
||||
" Drawable: " .. new.components[k].drawable .. " Texture: " .. new.components[k].texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
for k, v in pairs(old.props) do
|
||||
if v.prop_id then
|
||||
if new.props[k].drawable ~= v.drawable or new.props[k].texture ~= v.texture then
|
||||
print("Prop ID: " ..
|
||||
v.prop_id .. " Drawable: " .. new.props[k].drawable .. " Texture: " .. new.props[k].texture)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
|
||||
if source ~= 65535 then return end
|
||||
Clothing.SetAppearance(PlayerPedId(), data)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('community_bridge:client:GetAppearance', function()
|
||||
if source ~= 65535 then return end
|
||||
Clothing.GetAppearance(PlayerPedId())
|
||||
end)
|
||||
|
||||
RegisterNetEvent('community_bridge:client:RestoreAppearance', function()
|
||||
if source ~= 65535 then return end
|
||||
Clothing.RestoreAppearance(PlayerPedId())
|
||||
end)
|
||||
|
||||
-- RegisterCommand("clothing:enabledebug", function(source, args, rawCommand)
|
||||
-- Clothing.ToggleDebugging()
|
||||
-- end)
|
||||
|
||||
-- RegisterCommand("clothing:copy", function(source, args, rawCommand)
|
||||
-- Clothing.CopyAppearanceToClipboard()
|
||||
-- end)
|
||||
|
||||
|
||||
return Clothing
|
||||
return Clothing
|
||||
Reference in new issue
Block a user