mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(streaming): bump default timeout
There's no point trying to argue with people who rely on faulty behaviour and race conditions.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
---Load an animation dictionary. When called from a thread, it will yield until it has loaded.
|
---Load an animation dictionary. When called from a thread, it will yield until it has loaded.
|
||||||
---@param animDict string
|
---@param animDict string
|
||||||
---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 10000.
|
||||||
---@return string animDict
|
---@return string animDict
|
||||||
function lib.requestAnimDict(animDict, timeout)
|
function lib.requestAnimDict(animDict, timeout)
|
||||||
if HasAnimDictLoaded(animDict) then return animDict end
|
if HasAnimDictLoaded(animDict) then return animDict end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---Load an animation clipset. When called from a thread, it will yield until it has loaded.
|
---Load an animation clipset. When called from a thread, it will yield until it has loaded.
|
||||||
---@param animSet string
|
---@param animSet string
|
||||||
---@param timeout number? Approximate milliseconds to wait for the clipset to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the clipset to load. Default is 10000.
|
||||||
---@return string animSet
|
---@return string animSet
|
||||||
function lib.requestAnimSet(animSet, timeout)
|
function lib.requestAnimSet(animSet, timeout)
|
||||||
if HasAnimSetLoaded(animSet) then return animSet end
|
if HasAnimSetLoaded(animSet) then return animSet end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---Load a model. When called from a thread, it will yield until it has loaded.
|
---Load a model. When called from a thread, it will yield until it has loaded.
|
||||||
---@param model number | string
|
---@param model number | string
|
||||||
---@param timeout number? Approximate milliseconds to wait for the model to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the model to load. Default is 10000.
|
||||||
---@return number model
|
---@return number model
|
||||||
function lib.requestModel(model, timeout)
|
function lib.requestModel(model, timeout)
|
||||||
if type(model) ~= 'number' then model = joaat(model) end
|
if type(model) ~= 'number' then model = joaat(model) end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---Load a named particle effect. When called from a thread, it will yield until it has loaded.
|
---Load a named particle effect. When called from a thread, it will yield until it has loaded.
|
||||||
---@param ptFxName string
|
---@param ptFxName string
|
||||||
---@param timeout number? Approximate milliseconds to wait for the particle effect to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the particle effect to load. Default is 10000.
|
||||||
---@return string ptFxName
|
---@return string ptFxName
|
||||||
function lib.requestNamedPtfxAsset(ptFxName, timeout)
|
function lib.requestNamedPtfxAsset(ptFxName, timeout)
|
||||||
if HasNamedPtfxAssetLoaded(ptFxName) then return ptFxName end
|
if HasNamedPtfxAssetLoaded(ptFxName) then return ptFxName end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---Load a texture dictionary. When called from a thread, it will yield until it has loaded.
|
---Load a texture dictionary. When called from a thread, it will yield until it has loaded.
|
||||||
---@param textureDict string
|
---@param textureDict string
|
||||||
---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 10000.
|
||||||
---@return string textureDict
|
---@return string textureDict
|
||||||
function lib.requestStreamedTextureDict(textureDict, timeout)
|
function lib.requestStreamedTextureDict(textureDict, timeout)
|
||||||
if HasStreamedTextureDictLoaded(textureDict) then return textureDict end
|
if HasStreamedTextureDictLoaded(textureDict) then return textureDict end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
---Load a weapon asset. When called from a thread, it will yield until it has loaded.
|
---Load a weapon asset. When called from a thread, it will yield until it has loaded.
|
||||||
---@param weaponType string | number
|
---@param weaponType string | number
|
||||||
---@param timeout number? Approximate milliseconds to wait for the asset to load. Default is 1000.
|
---@param timeout number? Approximate milliseconds to wait for the asset to load. Default is 10000.
|
||||||
---@param weaponResourceFlags WeaponResourceFlags? Default is 31.
|
---@param weaponResourceFlags WeaponResourceFlags? Default is 31.
|
||||||
---@param extraWeaponComponentFlags ExtraWeaponComponentFlags? Default is 0.
|
---@param extraWeaponComponentFlags ExtraWeaponComponentFlags? Default is 0.
|
||||||
---@return string | number weaponType
|
---@return string | number weaponType
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function lib.streamingRequest(request, hasLoaded, assetType, asset, timeout, ...
|
|||||||
|
|
||||||
return lib.waitFor(function()
|
return lib.waitFor(function()
|
||||||
if hasLoaded(asset) then return asset end
|
if hasLoaded(asset) then return asset end
|
||||||
end, ("failed to load %s '%s' - this is likely caused by unreleased assets"):format(assetType, asset), timeout)
|
end, ("failed to load %s '%s' - this is likely caused by unreleased assets"):format(assetType, asset), timeout or 10000)
|
||||||
end
|
end
|
||||||
|
|
||||||
return lib.streamingRequest
|
return lib.streamingRequest
|
||||||
|
|||||||
Reference in New Issue
Block a user