Table of Contents

Class Registry

Namespace
PolyMod
Assembly
PolyMod.dll

The central store of the mods and the mod content that PolyMod loads.

public static class Registry
Inheritance
Registry
Inherited Members

Methods

GetAudioClip(string, TribeType, SkinType)

Gets the mod audio clip that is the best match for a name, a tribe and a skin. The method changes the tribe and the skin to their EnumCache names and calls GetAudioClipByText(string, string, string).

public static AudioClip? GetAudioClip(string name, TribeType tribe = TribeType.None, SkinType skin = SkinType.Default)

Parameters

name string

The base name of the audio clip.

tribe TribeType

The tribe of the audio clip, or PolytopiaBackendBase.Common.TribeType.None for no tribe.

skin SkinType

The skin of the audio clip, or PolytopiaBackendBase.Common.SkinType.Default for no skin.

Returns

AudioClip

The audio clip that is the best match, or null if no audio clip matches.

GetAutoIndex(Type)

Gets the next free index for an automatically indexed value of an enum type. The method does not change the counter. Call IncrementAutoIndex(Type) after you use the index. If the type has no counter yet, the method makes one that starts at PolyMod.Plugin.AUTOIDX_STARTS_FROM.

public static int GetAutoIndex(Type type)

Parameters

type Type

The enum type.

Returns

int

The next free index for the type.

GetSprite(string, TribeType, SkinType, int, bool)

Gets the mod sprite that is the best match for a base name, a tribe, a skin and a level. The method changes the tribe and the skin to their EnumCache names and calls GetSpriteByText(string, string, string, string, bool).

public static Sprite? GetSprite(string baseName, TribeType tribe = TribeType.None, SkinType skin = SkinType.Default, int level = -1, bool outline = false)

Parameters

baseName string

The base name of the sprite.

tribe TribeType

The tribe of the sprite, or PolytopiaBackendBase.Common.TribeType.None for no tribe.

skin SkinType

The skin of the sprite, or PolytopiaBackendBase.Common.SkinType.Default for no skin.

level int

The level of the sprite, or -1 for no level.

outline bool

If true, the method finds the outline variant of the sprite.

Returns

Sprite

The sprite that is the best match, or null if no sprite matches.

GetSpriteByText(string, string, string, string, bool)

Gets the mod sprite that is the best match for a base name, a tribe text, a skin text and a level text.

public static Sprite? GetSpriteByText(string baseName, string tribeText = "", string skinText = "", string levelText = "", bool outline = false)

Parameters

baseName string

The base name of the sprite.

tribeText string

The tribe part of the sprite name, or an empty string.

skinText string

The skin part of the sprite name, or an empty string.

levelText string

The level part of the sprite name, or an empty string for no level.

outline bool

If true, the method finds the outline variant of the sprite.

Returns

Sprite

The sprite that is the best match, or null if no sprite matches.

Remarks

The method changes the base name, the tribe text and the skin text to lowercase. If the level text is not empty, the method adds _level to the base name. Then it tries these names in sequence: base, base_tribe, base_skin and base_tribe_skin. If outline is true, the method adds _outline to each name. A sprite that the method finds later replaces a sprite that it found before. The result is the sprite with the most specific name that exists in PolyMod.Registry.sprites.

IncrementAutoIndex(Type)

Increases the next free index of an enum type by 1. If the type has no counter yet, the method makes one that starts at PolyMod.Plugin.AUTOIDX_STARTS_FROM and then increases it.

public static void IncrementAutoIndex(Type type)

Parameters

type Type

The enum type.