Steam Workshop - Xrisofor/RenPy-SteamLib GitHub Wiki
đ ī¸ Steam Workshop
RenPy SteamLib provides a set of wrapper functions to work with the Steam Workshop via the SteamUGC
. These functions allow your game to create, update, query, and manage Workshop items such as mods, levels, or other user-generated content.
đ§ Available Functions
Function | Description |
---|---|
show_workshop_eula() | Opens the Workshop EULA for the user to accept. |
get_workshop_eula_status() | Checks if the user has accepted the Workshop EULA. |
create_item() | Creates a new Workshop item (returns a creation result with the published file ID). |
start_item_update(published_file_id) | Begins an update session for a specific Workshop item. |
submit_item_update(handle, change_note) | Submits changes made during an update session. |
set_item_title(handle, title) | Sets the title for the Workshop item. |
set_item_update_language(handle, language) | Sets the language context for the item update. |
set_item_description(handle, description) | Sets the item's description. |
set_item_content(handle, content) | Sets the content folder of the Workshop item. |
set_item_preview(handle, image) | Sets the main preview image for the item. |
add_item_preview_file(handle, preview_file, preview_type) | Adds an additional preview file (e.g., image). |
add_item_preview_video(handle, video_id) | Adds a YouTube video preview by ID. |
remove_item_preview(handle, index) | Removes a preview by index. |
update_item_preview_file(handle, index, preview_file) | Updates a preview image by index. |
update_item_preview_video(handle, index, video_id) | Updates a video preview by index. |
set_item_tags(handle, tags) | Sets the list of tags for the Workshop item. |
set_item_metadata(handle, metadata) | Sets custom metadata for the item. |
set_item_visibility(handle, visibility) | Sets the visibility (public/private/friends-only). |
get_item_update_progress(handle) | Retrieves update progress (bytes uploaded). |
get_item_state(published_file_id) | Returns the current state flags of the item (e.g. needs update, downloading). |
get_item_download_info(handle) | Gets info about an in-progress download. |
get_item_install_info(handle) | Returns install info: size, folder path, and timestamp. |
get_query_ugc_result(handle, index) | Retrieves full details (SteamUGCDetails_t) of a queried item. |
get_query_ugc_num_additional_previews(handle, index) | Gets the number of additional previews for an item. |
create_query_user_ugc_request(user_list, matching_type, user_list_sort_order, page) | Creates a UGC query request (e.g., for items published by the user). |
release_query_ugc_request(handle) | Releases a query handle after use. |
get_num_subscribed_items() | Gets the total number of Workshop items the user is subscribed to. |
get_subscribed_items() | Retrieves the list of subscribed item IDs. |
download_item(published_file_id, high_priority) | Forces download of a Workshop item. |
delete_item(published_file_id) | Deletes a Workshop item owned by the user. |
âšī¸ Before modifying a Workshop item (e.g. using
set_item_title
,set_item_description
, etc.), you must first callstart_item_update
to begin an update session. After making your changes, you must finish the process by callingsubmit_item_update
.
â Usage Example
init python:
# Create a new item
create_result = _steamlib.ugc.create_item()
if create_result and create_result.result == _steamlib.EResult.OK:
item_id = create_result.published_file_id
handle = _steamlib.ugc.start_item_update(item_id)
# Set metadata
_steamlib.ugc.set_item_title(handle, "My Level")
_steamlib.ugc.set_item_description(handle, "A challenging custom level.")
_steamlib.ugc.set_item_content(handle, "game/levels/mylevel/")
_steamlib.ugc.set_item_preview(handle, "game/levels/preview.jpg")
_steamlib.ugc.set_item_visibility(handle)
# Submit changes
result = _steamlib.ugc.submit_item_update(handle, "Initial upload")
if result and result.result == _steamlib.EResult.OK:
renpy.notify("Item uploaded to Steam Workshop!")