Limited support
This feature is only present in Portal 2: Community Edition.

WorkshopAPI

[API not finalized] The workshop content API. Exclusive to P2:CE!

Functions

CreateQueryUGCDetailsRequest

WorkshopAPI.CreateQueryUGCDetailsRequest(workshopIds: bigint[]): typescript.Promise<(pano-typed.SteamUGCDetails_t | null)[]>

No description provided.

Parameter

NameTypeDescription
workshopIdsbigint[]No description provided.

GetActiveMountList

WorkshopAPI.GetActiveMountList(): pano-typed.AddonIndex_t[]

No description provided.

GetAddonCount

WorkshopAPI.GetAddonCount(): number

Returns the number of addons in the addons list.

GetAddonDependencies

WorkshopAPI.GetAddonDependencies(index: number): pano-typed.AddonIndex_t[] | null

No description provided.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonDependenciesMissing

WorkshopAPI.GetAddonDependenciesMissing(index: number): pano-typed.PublishedFileId_t[] | null

No description provided.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonEnabled

WorkshopAPI.GetAddonEnabled(index: number): boolean

Returns the enable state of the addon at the specified index.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonMeta

WorkshopAPI.GetAddonMeta(index: number): pano-typed.AddonMeta

Returns the metadata for the addon at the specified index.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonNamedPath

WorkshopAPI.GetAddonNamedPath(index: number): string

Returns the content path of an addon at the specified index.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonSubscribed

WorkshopAPI.GetAddonSubscribed(index: number): boolean

Returns the subscription state of the addon at the specified index.

Parameter

NameTypeDescription
indexnumberNo description provided.

GetAddonUserRating

WorkshopAPI.GetAddonUserRating(index: number): pano-typed.AddonRating

Gets the user rating for the given addon. If installed locally, returns AddonRating.None

Parameter

NameTypeDescription
indexnumberNo description provided.

IsWorkshopToolsMode

WorkshopAPI.IsWorkshopToolsMode(): boolean

Launched the game from Hammer or using the -workshop_tools launch option

SetAddonEnabled

WorkshopAPI.SetAddonEnabled(index: number, enabled: boolean): void

Sets the enable state of the addon at the specified index

Parameters

NameTypeDescription
indexnumberNo description provided.
enabledbooleanNo description provided.

SetAddonListEnabled

WorkshopAPI.SetAddonListEnabled(addons: Record<number, boolean>): void

Enables or disables a set of addons in one fell swoop. Use this if you're planning to enable/disable multiple at once

Parameter

NameTypeDescription
addonsRecord<number, boolean>No description provided.

SetAddonSubscribed

WorkshopAPI.SetAddonSubscribed(index: number, subscribed: boolean): void

Sets the subscription state of the addon at the specified index

Parameters

NameTypeDescription
indexnumberNo description provided.
subscribedbooleanNo description provided.

SetAddonUserRating

WorkshopAPI.SetAddonUserRating(index: number, rating: pano-typed.AddonRating): void

Sets the user rating for the given addon

Parameters

NameTypeDescription
indexnumberNo description provided.
ratingpano-typed.AddonRatingNo description provided.