Garry's Mod Wiki

steamworks

Steamworks related functions.

Methods

steamworks.ApplyAddons()
Refreshes clients addons.
steamworks.Download( string workshopPreviewID, boolean uncompress, function resultCallback )
You really should be using steamworks. DownloadUGC. This is a legacy function. Downloads a file from the supplied addon and saves it as a . cache file in garrysmod/cache/ folder. This is mostly used to download the preview image of the addon. In case the retrieved file is an image and you need the IMaterial, use AddonMaterial with the path supplied from the callback.
steamworks.DownloadUGC( string workshopID, function resultCallback )
A serverside implementation of this function can be provided by binary modules, such as gmsv_workshop. Downloads a Steam Workshop file by its ID and returns a path to it.
steamworks.FileInfo( string workshopItemID, function resultCallback )
A serverside implementation of this function can be provided by binary modules, such as gmsv_workshop. Retrieves info about supplied Steam Workshop addon.
steamworks.GetList( string type, table tags, number offset, number numRetrieve, number days, string userID, function resultCallback )
Retrieves a customized list of Steam Workshop addons.
string steamworks.GetPlayerName( string steamID64 )
We advise against using this. It may be changed or removed in a future update. You should use the callback of steamworks. RequestPlayerInfo instead. Retrieves players name by their 64bit SteamID. You must call steamworks. RequestPlayerInfo a decent amount of time before calling this function.
boolean steamworks.IsSubscribed( string workshopItemID )
Returns whenever the client is subscribed to the specified Steam Workshop item.
steamworks.OpenWorkshop()
Opens the workshop website in the steam overlay browser.
steamworks.Publish( string filename, string image, string name, string desc, table tags, function callback, number fileid = nil, string changelist = "None given." )
This is used internally - although you're able to use it you probably shouldn't. Publishes dupes, saves or demos to workshop.
steamworks.RequestPlayerInfo( string steamID64, function callback )
Requests information of the player with SteamID64 for later use with steamworks. GetPlayerName.
string steamworks.SetFileCompleted( string workshopid )
Sets the workshop item as "completed" by the player. There will be a visual indicator on the Steam Workshop for completed items.
string steamworks.SetFilePlayed( string workshopid )
Sets whether you have played this addon or not. This will be shown to the user in the Steam Workshop itself:
steamworks.SetShouldMountAddon( string workshopItemID, boolean shouldMount )
Sets if an addon should be enabled or disabled. Call steamworks. ApplyAddons afterwards to update.
boolean steamworks.ShouldMountAddon( string workshopItemID )
Returns whenever the specified Steam Workshop addon will be mounted or not.
steamworks.Subscribe( string workshopItemID )
This is used internally - although you're able to use it you probably shouldn't. Subscribes to the specified workshop addon. Call steamworks. ApplyAddons afterwards to update.
steamworks.Unsubscribe( string workshopItemID )
This is used internally - although you're able to use it you probably shouldn't. Unsubscribes to the specified workshop addon. Call steamworks. ApplyAddons afterwards to update. This function should never be called without a user's consent and should not be called if the addon is currently in use (aka: the user is not in the main menu) as it may result in unexpected behaviour.
steamworks.ViewFile( string workshopItemID )
Opens the workshop website for specified Steam Workshop item in the Steam overlay browser.
steamworks.Vote( string workshopItemID, boolean upOrDown )
This is used internally - although you're able to use it you probably shouldn't. Makes the user vote for the specified addon
steamworks.VoteInfo( string workshopItemID, function resultCallback )
We advise against using this. It may be changed or removed in a future update. Use data steamworks. FileInfo instead. Retrieves vote info of supplied addon.