Clothes - Ellpeck/TinyLifeExampleMod Wiki
public class Clothes : TinyLife.World.IPricedObject
Inheritance System.Object 🡒 Clothes
Clothes.Clothes(string, ClothesLayer, TextureRegion, float, ClothesIntention, TextureRegion, bool, ColorScheme) Constructor
Creates a new clothes item with the given data
public Clothes(string name, TinyLife.Objects.ClothesLayer layer, MLEM.Textures.TextureRegion region, float price, TinyLife.Objects.ClothesIntention intentions, MLEM.Textures.TextureRegion icon=null, bool nonBuyable=false, params TinyLife.Utilities.ColorScheme colors);
The name of this clothes item
The price of this piece of clothing
The character creator icon for this object, which represents the category / theme / mod that it comes from
Whether this item should be unable to be bought in the character creator
public readonly ColorScheme Colors;
The character creator icon for this object, which represents the category / theme / mod that it comes from.
If this value is nonnull, the icon will be displayed in the corner of the character creator button for this object.
public readonly TextureRegion Icon;
public readonly ClothesIntention Intentions;
The ClothesLayer that this clothes item should render on
public readonly ClothesLayer Layer;
A set of all valid ClothesLayer values
public static readonly ClothesLayer Layers;
The name of this clothes item.
Since this is used for the Types registry, the name must be unique across mods.
public readonly string Name;
This value determines whether this clothes item can be bought in the character creator.
If this value is false, the only way for this clothes item to be visible in the character creator is by adding it to the ClothesStorage.
public readonly bool NonBuyable;
The price of this piece of clothing.
Use GetPrice() to retrieve this value for consistency.
public readonly float Price;
The reference price for a piece of clothing.
When clothes items are randomly chosen for a new Person, the items chosen will be guaranteed to have a price equal to or below this value.
public const int ReferencePrice = 50;
The MLEM.Textures.TextureRegion that this clothes item uses in the world.
The texture region specified in the constructor only needs to cover the top left animation frame of the Person, any remaining frames will automatically be gathered.
Multiple layers will be gathered if Colors has multiple entries. Each new layer will be gathered to the right of the passed region's area.
public readonly TextureRegion TextureRegions;
A registry that contains all Clothes in the game and all mods
public static readonly IDictionary<string,Clothes> Types;
Returns a set of strings (split into multiple lines) that describes this clothes item's Intentions in a localized fashion
public System.Collections.Generic.IEnumerable<string> GetIntentionDescription();
Clothes.GetIntentionMatchingOutfit(IEnumerable<IEnumerable<Clothes>>, ClothesIntention, float) Method
Returns the index for an outfit that best matches the given ClothesIntention out of all of the passed outfits.
This method is used by GetMatchingOutfit(ClothesIntention, float) and evaluates the best match by using GetIntentionPercentage(IEnumerable<Clothes>, ClothesIntention).
public static int GetIntentionMatchingOutfit(System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<TinyLife.Objects.Clothes>> outfits, TinyLife.Objects.ClothesIntention intention, float requiredMatchPercentage=0f);
The intention to match the best outfit to
An optional minimum percentage that the returned outfit needs to have. If this is greater than 0, this method can return -1, meaning no outfit is sufficiently matching.
Clothes.GetIntentionPercentage(IEnumerable<Clothes>, ClothesIntention) Method
Returns a value between 0 and 1 that represents how well the given set of clothes (outfit) matches the given ClothesIntention.
For a person, this method is used by GetMatchingOutfit(ClothesIntention, float).
public static float GetIntentionPercentage(System.Collections.Generic.IEnumerable<TinyLife.Objects.Clothes> outfit, TinyLife.Objects.ClothesIntention intention);
The intention to match the outfit to
The intention match percentage, between 0 and 1
Returns the price that this object can be bought or sold for.
Note that, like in the case of the Painting, the returned price isn't necessarily the full price that the object can be sold for. Instead, the price returned here should be the price that this object has when bought or sold from the FurnitureTool or similar.
public float GetPrice();
The object's price
Register the given clothes instance to the Types registry
public static void Register(TinyLife.Objects.Clothes clothes);
The clothes to register