From ede02fb1b481c8e33702de962a5b9029e3561f01 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 16 Nov 2021 11:16:34 +1100 Subject: [PATCH] feat(resource): setup streaming exports and placeholders Naturally I have not tested any of these. --- resource/entities/client.lua | 0 resource/entities/server.lua | 0 resource/scaleform/client.lua | 0 resource/streaming/client.lua | 51 +++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 resource/entities/client.lua create mode 100644 resource/entities/server.lua create mode 100644 resource/scaleform/client.lua create mode 100644 resource/streaming/client.lua diff --git a/resource/entities/client.lua b/resource/entities/client.lua new file mode 100644 index 0000000..e69de29 diff --git a/resource/entities/server.lua b/resource/entities/server.lua new file mode 100644 index 0000000..e69de29 diff --git a/resource/scaleform/client.lua b/resource/scaleform/client.lua new file mode 100644 index 0000000..e69de29 diff --git a/resource/streaming/client.lua b/resource/streaming/client.lua new file mode 100644 index 0000000..824e4d8 --- /dev/null +++ b/resource/streaming/client.lua @@ -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 \ No newline at end of file