Table of Contents

Class Mod

Namespace
TinyLife.Mods
Assembly
Tiny Life.dll

The base class for all Tiny Life mods. For an example mod, see https://github.com/Ellpeck/TinyLifeExampleMod. Mods are uniquely identified by their ID. The id is the name of the class that extends Mod.

public abstract class Mod
Inheritance
Mod
Inherited Members
Extension Methods

Properties

Description

The description of this mod, which will be visible in the options menu. To localize the description, use Localization.

public abstract string Description { get; }

Property Value

string

Icon

The icon texture region of this mod, which will be visible in the options menu

public virtual TextureRegion Icon { get; }

Property Value

TextureRegion

IssueTrackerUrl

An optional string that will be the destination of a clickable text in the main menu when this mod fails to initialize (Initialize(Logger, RawContentManager, RuntimeTexturePacker, ModInfo)) or add game content (AddGameContent(GameImpl, ModInfo)). Note that this will not be displayed when the mod fails to load entirely, since this class will not have had time to instantiate.

public virtual string IssueTrackerUrl { get; }

Property Value

string

Name

The display name of this mod, which will be visible in the options menu

public abstract string Name { get; }

Property Value

string

RequiresHarmony

Whether this mod requires Harmony for patches. If this is true, the Harmony instance to use can be found in Harmony during Initialize(Logger, RawContentManager, RuntimeTexturePacker, ModInfo).

public virtual bool RequiresHarmony { get; }

Property Value

bool

TestedVersionRange

A semantic version range in interval notation that denotes the game versions that this mod has been tested for. If the game's current version (Version) is not included in this range, a warning is displayed on game startup. For more information on semantic version ranges in interval notation, see https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges.

public abstract string TestedVersionRange { get; }

Property Value

string

Methods

AddGameContent(GameImpl, ModInfo)

Add the content that this mod provides for the given GameImpl instance. Some of the supported things to register are: Register(TypeSettings) to register furniture types, Register(TypeSettings) to register action types, Register(Clothes) to register clothes (and hair), Register(SkillType) to register skills. Note that there are a lot of additional things that can be registered in this method.

public abstract void AddGameContent(GameImpl game, ModInfo info)

Parameters

game GameImpl

The game instance.

info ModInfo

The ModInfo of this mod.

FinalizeGameContent(GameImpl, ModInfo)

Finalize loading any additional game content for your mod. Note that "finalize" in this context refers not to object destruction, but to the completion of the loading process. This method is called after all mods had their AddGameContent(GameImpl, ModInfo) methods called, and after all basegame content has been finalized. This method can be used, for example, to modify any game content added by other mods.

public virtual void FinalizeGameContent(GameImpl game, ModInfo info)

Parameters

game GameImpl

The game instance.

info ModInfo

The ModInfo of this mod.

GetCustomFurnitureTextures(ModInfo)

Return a list of paths (relative to this mod's Content directory) to textures that contain the texture regions used by this mod's custom FurnitureTypes. Note that the furniture texture needs to have an associated MLEM.Data.DataTextureAtlas file in the same location, but with the .atlas file extension. By default, an empty IEnumerable<T> is returned.

public virtual IEnumerable<string> GetCustomFurnitureTextures(ModInfo info)

Parameters

info ModInfo

Returns

IEnumerable<string>

The custom data texture atlases for this mod's furniture

Initialize(Logger, RawContentManager, RuntimeTexturePacker, ModInfo)

Initialize the data for this mod, including textures, sounds and other data. The MLEM.Data.Content.RawContentManager is a variation of MonoGame's Microsoft.Xna.Framework.Content.ContentManager and should be used to load mod content.

public abstract void Initialize(Logger logger, RawContentManager content, RuntimeTexturePacker texturePacker, ModInfo info)

Parameters

logger Logger

The logger that can be used to write info about this mod to the console

content RawContentManager

The content manager for this mod

texturePacker RuntimeTexturePacker

The texture packer that packs added textures into one big texture

info ModInfo

The ModInfo of this mod.

PopulateOptions(Group, ModInfo)

Populates this mod's options section, which can be found in the Mods section of the game's main and in-game menus. If any elements are added to the group provided, a button will display next to this mod to open its options. This mod can create, add, and load custom options using LoadOptions<T>(Func<T>) and SaveOptions<T>(T).

public virtual void PopulateOptions(Group group, ModInfo info)

Parameters

group Group

The group to add options to.

info ModInfo

The game's mod info.