mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(resource): setup streaming exports and placeholders
Naturally I have not tested any of these.
This commit is contained in:
51
resource/streaming/client.lua
Normal file
51
resource/streaming/client.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
---@param dict string
|
||||
--- Loads an animation dictionary.
|
||||
function lib.requestAnimDict(dict)
|
||||
if not HasAnimDictLoaded(dict) then
|
||||
RequestAnimDict(dict)
|
||||
while not HasAnimDictLoaded(dict) do Wait(0) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---@param set string
|
||||
--- Loads an animation clipset.
|
||||
function lib.requestAnimSet(set)
|
||||
if not HasAnimSetLoaded(set) then
|
||||
RequestAnimSet(set)
|
||||
while not HasAnimSetLoaded(set) do Wait(0) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---@param model string|number
|
||||
--- Loads a model.
|
||||
function lib.requestModel(model)
|
||||
model = type(model) == 'number' and model or joaat(model)
|
||||
if not HasModelLoaded(model) then
|
||||
assert(IsModelValid(model), ('Attempted to load an invalid model (%s)'):format(model))
|
||||
RequestModel(model)
|
||||
while not HasModelLoaded(model) do Wait(0) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---@param dict string
|
||||
--- Loads a texture dictionary.
|
||||
function lib.requestStreamedTextureDict(dict)
|
||||
if not HasStreamedTextureDictLoaded(dict) then
|
||||
RequestStreamedTextureDict(dict)
|
||||
while not HasStreamedTextureDictLoaded(dict) do Wait(0) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
---@param fxName string
|
||||
--- Loads a named particle effect.
|
||||
function lib.requestNamedPtfxAsset(fxName)
|
||||
if not HasNamedPtfxAssetLoaded(fxName) then
|
||||
RequestNamedPtfxAsset(fxName)
|
||||
while not HasNamedPtfxAssetLoaded(fxName) do Wait(0) end
|
||||
end
|
||||
return true
|
||||
end
|
||||
Reference in New Issue
Block a user