Skip to content
Snippets Groups Projects

Steamworks

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Maximilian Grüttemeier
    Edited
    steamworks.lua 1.40 KiB
    function UGCWorkshopMount( workshopid )
        steamworks.FileInfo( workshopid, function( result )
            if not result.installed	or result.disabled then
                steamworks.DownloadUGC( result.id, function( name, file )
                    if name then
                        success, _ = game.MountGMA( name )
                        if success then
                            hook.Call( "UGCMountEvent", nil, result.id, result, true )
                        else
                            hook.Call( "UGCMountEvent", nil, result.id, result, false )
                        end
                    else
                        hook.Call( "UGCMountEvent", nil, result.id, result, false )
                    end
                end)
            end
        end)
    end
    
    function WorkshopMount( workshopid )
        steamworks.FileInfo( workshopid, function( result )
            if not result.installed	or result.disabled then
                steamworks.Download( result.previewid, true, function( name )
                    if name then
                        success, _ = game.MountGMA( name )
                        if success then
                            hook.Call( "MountEvent", nil, result.id, result, true )
                        else
                            hook.Call( "MountEvent", nil, result.id, result, false )
                        end
                    else
                        hook.Call( "MountEvent", nil, result.id, result, false )
                    end
                end)
            end
        end)
    end
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please to comment