Usage - SilksPlugins/UnturnedImages GitHub Wiki

Usage

Directly using a Content Delivery Network

To access images, it's recommended to use the jsDeliver CDN. For item images, it's as simple as substituting the item ID in the following example.

When an image for the ID doesn't exist, the HTTP GET request will return a 404 error code.

Eaglefire image URL (item ID 4):

https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedImages@images/vanilla/items/4.png

Blimp image URL (vehicle ID 189):

https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedImages@images/vanilla/vehicles/189.png

Unturned Images Module

An Unturned module that adds the ability to export different asset images to your game's Extras directory.

Purpose

This module adds the ability to export different asset images - for both vanilla and workshop mods - to your game's Extras directory. This includes:

  • Item images
  • Vehicle images (with customizable camera angles)

Installation

To install this module, you must first download the latest release. Follow the previous link and download the UnturnedImages.Module.zip file.

You can then extract this file in your Modules directory inside your Unturned's installation directory. This is meant to be client-side, none of this is for servers.

You must then launch Unturned without BattlEye enabled - client-side modules will not load unless BattlEye is disabled. To run Unturned with BattlEye disabled, press Launch in the Steam Library and select Play without BattlEye Anti-Cheat, then click play.

Usage

After installing the module and launching Unturned with BattlEye disabled, you can view the module's controls by navigating within the main menu to the Workshop menu. All UnturnedImages.Module's controls are available underneath the UnturnedImages Controls header.

  • Export All Vehicle Images This button will export all vehicle asset images. You can change the camera angles in the advanced settings found below the main controls.

  • Export All Item Images This button will export all item asset images.

  • Export Certain Mods Below this header, you can find buttons to export each mod separately. When you click one of these buttons, you will export the item and vehicles images of the mod with that ID.

  • Open Extras Folder This button will open your Unturned/Extras directory in File Explorer (Windows-only feature).

  • Reload Module This button is meant for development purposes and hot-reloads the module allowing for code changes without restarting Unturned.

All exported images are sorted into directories. Item images will be in the Unturned/Extras/Items directory and all vehicle images will be in the Unturned/Extras/Vehicles directory.

All vanilla items and vehicle images are placed in an Official subdirectory. All modded item and vehicle images will be placed in subdirectories with the ID of the mod. Example: 2683620106

Alongside images, the module will also export a config segment in a file called config.yaml. You can find this in the directory along with the images. This config segment can be used with the UnturnedImages plugin to configure image overrides.

Unturned Images Plugin

An OpenMod plugin for Unturned which adds a repository of images available to plugins for usage in UIs.

Purpose

This plugin contains services which other plugins can use to get image URLs for in-game assets. For more information, see the Usage section.

These image URLs can be used in different applications, but mainly in-game UIs.

Configuration

Default configuration (contains comment-based documentation):

# Default repositories for different in-game asset categories.
# If no override specifies a different repository, it will attempt to use the default repository.
DefaultRepositories:
  # The default repository for item images.
  Items: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/vanilla/items/{ItemId}.png"
  # The default repository for vehicle images.
  Vehicles: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/vanilla/vehicles/{VehicleId}.png"

# Repository overrides for item images. Simply specify an ID, or list of IDs and their repository.
# Remove the # before lines to uncomment them and have it work with the config.
# Priority is based on which line is first. For example, if all lines below were uncommented,
# the image URL for the item with an ID of 46001 would be https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/modded/other2/items/{ItemId}.png
ItemOverrides:
#- Id: 46000 # The ID of the override.
#  Repository: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/modded/other/items/{ItemId}.png" # The repository of the override.
#- Id: "46001-47000" # A range of IDs can be specified as well. You can specify multiple IDs using ranges. and multiple ranges by separating them with commas (',') or semi-colons (';').
#  Repository: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/modded/other2/items/{ItemId}.png"
#- Id: "46001-47000;48000-49000;50023" # A range of IDs can be specified as well. You can specify multiple ranges/IDs by separating them with commas (',') or semi-colons (';').
#  Repository: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/modded/other3/items/{ItemId}.png"

# Repository overrides for vehicle images. Simply specify an ID, or list of IDs and their repository.
# See the comments in the above ItemOverrides config for more information on configuring this.
VehicleOverrides:
#- Id: 46000 # The ID of the override.
#  Repository: "https://cdn.jsdelivr.net/gh/SilKsPlugins/UnturnedIcons@images/modded/other/vehicle/{VehicleId}.png" # The repository of the override.

Usage

Developers can include this plugin library in their plugins simply by adding the package to their project references and ensuring the plugin is installed on their server endpoints.

Install via Microsoft Visual Studio's Package Manager Console:

Install-Package SilK.UnturnedImages

Install via the .NET CLI:

dotnet add package SilK.UnturnedImages

After the plugin's library has been added to your project, you can retrieve one of the following services using dependency injection:

  • IItemImageDirectoryAsync - An asynchronous item image directory.
  • IItemImageDirectorySync - A synchronous item image directory.