refactor(imports/streaming): remove default timeout

This commit is contained in:
Linden
2024-01-17 17:38:34 +11:00
parent 6817ae6649
commit 0f7d1c165f
7 changed files with 14 additions and 14 deletions

View File

@@ -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? Number of ticks to wait for the dictionary to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 1000.
---@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
@@ -19,7 +19,7 @@ function lib.requestAnimDict(animDict, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasAnimDictLoaded(animDict) then return animDict end if HasAnimDictLoaded(animDict) then return animDict end
end, ("failed to load animDict '%s'"):format(animDict), timeout or 500) end, ("failed to load animDict '%s'"):format(animDict), timeout)
end end
return lib.requestAnimDict return lib.requestAnimDict

View File

@@ -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? Number of ticks to wait for the clipset to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the clipset to load. Default is 1000.
---@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
@@ -15,7 +15,7 @@ function lib.requestAnimSet(animSet, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasAnimSetLoaded(animSet) then return animSet end if HasAnimSetLoaded(animSet) then return animSet end
end, ("failed to load animSet '%s'"):format(animSet), timeout or 500) end, ("failed to load animSet '%s'"):format(animSet), timeout)
end end
return lib.requestAnimSet return lib.requestAnimSet

View File

@@ -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? Number of ticks to wait for the model to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the model to load. Default is 1000.
---@return number? model ---@return number? model
function lib.requestModel(model, timeout) function lib.requestModel(model, timeout)
if not tonumber(model) then model = joaat(model) end if not tonumber(model) then model = joaat(model) end
@@ -17,7 +17,7 @@ function lib.requestModel(model, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasModelLoaded(model) then return model end if HasModelLoaded(model) then return model end
end, ("failed to load model '%s'"):format(model), timeout or 500) end, ("failed to load model '%s'"):format(model), timeout)
end end
return lib.requestModel return lib.requestModel

View File

@@ -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? Number of ticks to wait for the particle effect to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the particle effect to load. Default is 1000.
---@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
@@ -15,7 +15,7 @@ function lib.requestNamedPtfxAsset(ptFxName, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasNamedPtfxAssetLoaded(ptFxName) then return ptFxName end if HasNamedPtfxAssetLoaded(ptFxName) then return ptFxName end
end, ("failed to load ptFxName '%s'"):format(ptFxName), timeout or 500) end, ("failed to load ptFxName '%s'"):format(ptFxName), timeout)
end end
return lib.requestNamedPtfxAsset return lib.requestNamedPtfxAsset

View File

@@ -1,6 +1,6 @@
---Load a scaleform movie. When called from a thread, it will yield until it has loaded. ---Load a scaleform movie. When called from a thread, it will yield until it has loaded.
---@param scaleformName string ---@param scaleformName string
---@param timeout number? Number of ticks to wait for the scaleform movie to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the scaleform movie to load. Default is 1000.
---@return number? scaleform ---@return number? scaleform
function lib.requestScaleformMovie(scaleformName, timeout) function lib.requestScaleformMovie(scaleformName, timeout)
if type(scaleformName) ~= 'string' then if type(scaleformName) ~= 'string' then
@@ -13,7 +13,7 @@ function lib.requestScaleformMovie(scaleformName, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasScaleformMovieLoaded(scaleform) then return scaleform end if HasScaleformMovieLoaded(scaleform) then return scaleform end
end, ("failed to load scaleform '%s'"):format(scaleform), timeout or 500) end, ("failed to load scaleform '%s'"):format(scaleform), timeout)
end end
return lib.requestScaleformMovie return lib.requestScaleformMovie

View File

@@ -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? Number of ticks to wait for the dictionary to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the dictionary to load. Default is 1000.
---@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
@@ -15,7 +15,7 @@ function lib.requestStreamedTextureDict(textureDict, timeout)
return lib.waitFor(function() return lib.waitFor(function()
if HasStreamedTextureDictLoaded(textureDict) then return textureDict end if HasStreamedTextureDictLoaded(textureDict) then return textureDict end
end, ("failed to load textureDict '%s'"):format(textureDict), timeout or 500) end, ("failed to load textureDict '%s'"):format(textureDict), timeout)
end end
return lib.requestStreamedTextureDict return lib.requestStreamedTextureDict

View File

@@ -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? Number of ticks to wait for the asset to load. Default is 500. ---@param timeout number? Approximate milliseconds to wait for the asset to load. Default is 1000.
---@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
@@ -44,7 +44,7 @@ function lib.requestWeaponAsset(weaponType, timeout, weaponResourceFlags, extraW
return lib.waitFor(function() return lib.waitFor(function()
if HasWeaponAssetLoaded(weaponType) then return weaponType end if HasWeaponAssetLoaded(weaponType) then return weaponType end
end, ("failed to load weaponType '%s'"):format(weaponType), timeout or 500) end, ("failed to load weaponType '%s'"):format(weaponType), timeout)
end end
return lib.requestWeaponAsset return lib.requestWeaponAsset