-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: es_extended\client\modules\streaming.lua
- Loading branch information
1 parent
cfee6b5
commit 41453ff
Showing
1 changed file
with
20 additions
and
68 deletions.
There are no files selected for viewing
88 changes: 20 additions & 68 deletions
88
server-data/resources/[esx]/es_extended/client/modules/streaming.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,37 @@ | ||
function ESX.Streaming.RequestModel(modelHash, cb) | ||
modelHash = (type(modelHash) == "number" and modelHash or joaat(modelHash)) | ||
|
||
if not HasModelLoaded(modelHash) and IsModelInCdimage(modelHash) then | ||
RequestModel(modelHash) | ||
|
||
while not HasModelLoaded(modelHash) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
modelHash = type(modelHash) == "number" and modelHash or joaat(modelHash) | ||
if not IsModelInCdimage(modelHash) then return end | ||
RequestModel(modelHash) | ||
while not HasModelLoaded(modelHash) do Wait() end | ||
return cb and cb(modelHash) or modelHash | ||
end | ||
|
||
function ESX.Streaming.RequestStreamedTextureDict(textureDict, cb) | ||
if not HasStreamedTextureDictLoaded(textureDict) then | ||
RequestStreamedTextureDict(textureDict) | ||
|
||
while not HasStreamedTextureDictLoaded(textureDict) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
RequestStreamedTextureDict(textureDict) | ||
while not HasStreamedTextureDictLoaded(textureDict) do Wait() end | ||
return cb and cb(textureDict) or textureDict | ||
end | ||
|
||
function ESX.Streaming.RequestNamedPtfxAsset(assetName, cb) | ||
if not HasNamedPtfxAssetLoaded(assetName) then | ||
RequestNamedPtfxAsset(assetName) | ||
|
||
while not HasNamedPtfxAssetLoaded(assetName) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
RequestNamedPtfxAsset(assetName) | ||
while not HasNamedPtfxAssetLoaded(assetName) do Wait() end | ||
return cb and cb(assetName) or assetName | ||
end | ||
|
||
function ESX.Streaming.RequestAnimSet(animSet, cb) | ||
if not HasAnimSetLoaded(animSet) then | ||
RequestAnimSet(animSet) | ||
|
||
while not HasAnimSetLoaded(animSet) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
RequestAnimSet(animSet) | ||
while not HasAnimSetLoaded(animSet) do Wait() end | ||
return cb and cb(animSet) or animSet | ||
end | ||
|
||
function ESX.Streaming.RequestAnimDict(animDict, cb) | ||
if not HasAnimDictLoaded(animDict) then | ||
RequestAnimDict(animDict) | ||
|
||
while not HasAnimDictLoaded(animDict) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
RequestAnimDict(animDict) | ||
while not HasAnimDictLoaded(animDict) do Wait() end | ||
return cb and cb(animDict) or animDict | ||
end | ||
|
||
function ESX.Streaming.RequestWeaponAsset(weaponHash, cb) | ||
if not HasWeaponAssetLoaded(weaponHash) then | ||
RequestWeaponAsset(weaponHash) | ||
|
||
while not HasWeaponAssetLoaded(weaponHash) do | ||
Wait(0) | ||
end | ||
end | ||
|
||
if cb ~= nil then | ||
cb() | ||
end | ||
RequestWeaponAsset(weaponHash) | ||
while not HasWeaponAssetLoaded(weaponHash) do Wait() end | ||
return cb and cb(weaponHash) or weaponHash | ||
end |