C# Class GarrysModLuaShared.resource

The resource library is used to control what files are sent to clients who join a server, this includes models, materials, sounds, text files but not Lua files.
Show file Open project: OmegaExtern/gmod-csharp-binary-module

Public Methods

Method Description
AddFile ( LuaState luaState, string path ) : void

Adds the specified and all related files to the files the client should download. For convenience, this function will automatically add any other files that are related to the selected one, and throw an error if it can't find them. For example, a .vmt file will automatically add the .vtf with the same name, and a .mdl file will automatically add all .vvd, .ani, .dx80.vtx, .dx90.vtx, .sw.vtx, .phy and .jpg files with the same name, with a separate error for each missing file. If you do not want it to do this, use AddSingleFile. NOTE: There's a 8192 downloadable file limit. If you need more, consider using Workshop addons - AddWorkshop. You should also consider the fact that you have way too many downloads.

AddSingleFile ( LuaState luaState, string path ) : void

Adds the specified file to the files the client should download.

AddWorkshop ( LuaState luaState, string workshopId ) : void

Adds a workshop addon for the client to download before entering the server. Having the raw files from a workshop item does not count as having already downloaded it. So players who previously downloaded a map through Fast Download will have to re-download it if you use the workshop. You should try to only add addons that have custom content ( models, sounds, etc ). Gamemodes that are workshop enabled are automatically added to this list - so there's no need to add them. The server's current map is also automatically added, if it is loaded from a workshop addon.

Method Details

AddFile() public static method

Adds the specified and all related files to the files the client should download. For convenience, this function will automatically add any other files that are related to the selected one, and throw an error if it can't find them. For example, a .vmt file will automatically add the .vtf with the same name, and a .mdl file will automatically add all .vvd, .ani, .dx80.vtx, .dx90.vtx, .sw.vtx, .phy and .jpg files with the same name, with a separate error for each missing file. If you do not want it to do this, use AddSingleFile. NOTE: There's a 8192 downloadable file limit. If you need more, consider using Workshop addons - AddWorkshop. You should also consider the fact that you have way too many downloads.
public static AddFile ( LuaState luaState, string path ) : void
luaState LuaState Pointer to lua_State struct.
path string Path of the file to be added, relative to garrysmod root folder.
return void

AddSingleFile() public static method

Adds the specified file to the files the client should download.
public static AddSingleFile ( LuaState luaState, string path ) : void
luaState LuaState Pointer to lua_State struct.
path string Path of the file to be added, relative to garrysmod root folder.
return void

AddWorkshop() public static method

Adds a workshop addon for the client to download before entering the server. Having the raw files from a workshop item does not count as having already downloaded it. So players who previously downloaded a map through Fast Download will have to re-download it if you use the workshop. You should try to only add addons that have custom content ( models, sounds, etc ). Gamemodes that are workshop enabled are automatically added to this list - so there's no need to add them. The server's current map is also automatically added, if it is loaded from a workshop addon.
public static AddWorkshop ( LuaState luaState, string workshopId ) : void
luaState LuaState Pointer to lua_State struct.
workshopId string The workshop ID of the file. This cannot be a collection.
return void