FurnitureType_TypeSettings - Ellpeck/TinyLifeExampleMod Wiki

Original URL: https://github.com/Ellpeck/TinyLifeExampleMod/wiki/FurnitureType_TypeSettings

Tiny Life

TinyLife.Objects.FurnitureType

FurnitureType.TypeSettings Struct

A set of settings that define the properties of a FurnitureType

public struct FurnitureType.TypeSettings :
MLEM.Misc.IGenericDataHolder

Implements MLEM.Misc.IGenericDataHolder

Constructors

FurnitureType.TypeSettings.TypeSettings(string, Point, ObjectCategory, float, ColorScheme[]) Constructor

Initializes a new TypeSettings instance with the given data

public TypeSettings(string name, Microsoft.Xna.Framework.Point size, TinyLife.Objects.ObjectCategory categories, float price, params TinyLife.Utilities.ColorScheme[] colorSchemes);

Parameters

name System.String
The name that this furniture type should have

size Microsoft.Xna.Framework.Point
The size that this furniture type should have

categories ObjectCategory
The categories that this furniture type should have

price System.Single
The price of this furniture type

colorSchemes ColorScheme[]
The color schemes that this furniture type should have. Cannot be empty.

Fields

FurnitureType.TypeSettings.ActionSpots Field

An array of ActionSpot instances that this furniture type should have.
By default, every tile that this furniture covers has an action spot reachable from all sides.

public ActionSpot[] ActionSpots;

Field Value

ActionSpot[]

FurnitureType.TypeSettings.BrokenBehavior Field

A set of BrokenBehavior that this object should have if it is broken.
This is only relevant if Reliability is non-null.

public BrokenBehavior BrokenBehavior;

Field Value

BrokenBehavior

FurnitureType.TypeSettings.BuyableVariations Field

An array of actions that can modify the passed Furniture instance.
If this is set, additional variations of this furniture type will show up in the FurnitureTool, and buying them will invoke this action that can then modify the furniture type.
This is used, for example, for TinyLife.Objects.FurnitureType.FoodPlate and TinyLife.Objects.FurnitureType.CustomPainting.

public Action<Furniture>[] BuyableVariations;

Field Value

System.Action<Furniture>[]

FurnitureType.TypeSettings.Categories Field

A set of ObjectCategory flags that this furniture should have

public ObjectCategory Categories;

Field Value

ObjectCategory

FurnitureType.TypeSettings.ColorMap Field

An array of indices that determines which layers should use which color schemes.
A furniture will always have the same amount of layers as there are color map entries.

public int[] ColorMap;

Field Value

System.Int32[]

FurnitureType.TypeSettings.ColorSchemes Field

An array of color schemes that this furniture type should have.
If ColorMap is not set, its value is determined automatically by the amount of color schemes supplied.

public ColorScheme[] ColorSchemes;

Field Value

ColorScheme[]

FurnitureType.TypeSettings.ConstructedType Field

A delegate to a System.Type that is constructed when this furniture type is instantiated using Construct(int[], Map, Vector2, Nullable<Guid>).
The type needs to have a constructor with the same signature as Furniture(Guid, FurnitureType, int[], Map, Vector2).
If this value is null, a Furniture instance will be constructed from this type if its Reliability is null, or a BreakableFurniture instance if it is non-null.

public Type ConstructedType;

Field Value

System.Type

FurnitureType.TypeSettings.CreateLights Field

The lights that should be created for an instance of this furniture type.
Note that, if this value is set, Construct(int[], Map, Vector2, Nullable<Guid>) will automatically construct an instance of LightFurniture, and any custom ConstructedType should extend LightFurniture as well.

public Func<LightFurniture,Light[]> CreateLights;

Field Value

System.Func<LightFurniture,Light[]>

FurnitureType.TypeSettings.DecorativeRating Field

A function that returns an integer for a given Furniture instance of this type.
The integer represents the decoration (or prettiness) rating of the object. The rating determines some EmotionModifier values.
A negative return value makes the object be perceived as ugly, whereas a positive rating makes the object be perceived as pretty.
By default, this function returns 0.

public Func<Furniture,int> DecorativeRating;

Field Value

System.Func<Furniture,System.Int32>

FurnitureType.TypeSettings.DefaultColors Field

The default color selection for this furniture type.
If not specified, this defaults to the first entries in each of the ColorSchemes.

public int[] DefaultColors;

Field Value

System.Int32[]

FurnitureType.TypeSettings.DefaultRotation Field

The rotation that this furniture type should have when picked from the FurnitureTool. MLEM.Misc.Direction2.Up by default.

public Direction2 DefaultRotation;

Field Value

MLEM.Misc.Direction2

FurnitureType.TypeSettings.ElectricityRating Field

This object's electricity rating. A higher electricity rating means the bills for the lot this object is on will be higher.
The electricity rating is also displayed in the furniture tool menu.

public float ElectricityRating;

Field Value

System.Single

FurnitureType.TypeSettings.HeldPivot Field

Whether, when this object is held by a Person, its textures should maintain their defined pivot points.
If this value is false, the item is centered, meaning that its center is in the person's hand.

public bool HeldPivot;

Field Value

System.Boolean

FurnitureType.TypeSettings.HeldScale Field

The scale that this furniture should be drawn with when held by a Person

public float HeldScale;

Field Value

System.Single

FurnitureType.TypeSettings.Icon Field

The build mode 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 build mode button for this object.

public TextureRegion Icon;

Field Value

MLEM.Textures.TextureRegion

FurnitureType.TypeSettings.Name Field

The name of the furniture type. Should be unique across all game content, including all mods.

public string Name;

Field Value

System.String

FurnitureType.TypeSettings.ObjectSpots Field

An array of ObjectSpot instances that this furniture type should have.
By default, there are no object spots.

public ObjectSpot[] ObjectSpots;

Field Value

ObjectSpot[]

FurnitureType.TypeSettings.Price Field

The price that this furniture should have

public float Price;

Field Value

System.Single

FurnitureType.TypeSettings.Reliability Field

The reliability of this furniture item, which should be a value between 1 and 10.
This value defaults to null, menaing this object is non-breakable.
Note that, if this value is non-null, Construct(int[], Map, Vector2, Nullable<Guid>) will construct a BreakableFurniture by default.

public Nullable<int> Reliability;

Field Value

System.Nullable<System.Int32>

FurnitureType.TypeSettings.Size Field

The size, in full tiles, that this furniture should take up

public Point Size;

Field Value

Microsoft.Xna.Framework.Point

FurnitureType.TypeSettings.Tab Field

The FurnitureTool tab that this object should display in.
This value defaults to the tab returned by GetDefaultTab(ObjectCategory).

public Tab Tab;

Field Value

Tab

FurnitureType.TypeSettings.TextureName Field

The name of the base texture that this furniture type should use.
If this is not explicitly set, it defaults to this furniture type's Name.

public string TextureName;

Field Value

System.String

FurnitureType.TypeSettings.Visibility Field

The visibility settings for this furniture type.
The visibility determines whether this object gets culled if the camera is far away, etc.
This value defaults to WhenVisible.

public Visibility Visibility;

Field Value

Visibility

FurnitureType.TypeSettings.WaterRating Field

This object's water consumption rating. A higher water consumption rating means the bills for the lot this object is on will be higher.
The water consumption rating is also displayed in the furniture tool menu.

public float WaterRating;

Field Value

System.Single

Methods

FurnitureType.TypeSettings.GetData<T>(string) Method

Returns a piece of generic data of the given type on this object.

public T GetData<T>(string key);

Type parameters

T
The type of the data stored

Parameters

key System.String
The key that the data is stored by

Returns

T
The data, or default if it doesn't exist

Implements GetData(string)

FurnitureType.TypeSettings.GetDataKeys() Method

Returns all of the generic data that this object stores.

public System.Collections.Generic.IReadOnlyCollection<string> GetDataKeys();

Returns

System.Collections.Generic.IReadOnlyCollection<System.String>
The generic data on this object

Implements GetDataKeys()

FurnitureType.TypeSettings.SetData(string, object) Method

Store a piece of generic data on this object.

public void SetData(string key, object data);

Parameters

key System.String
The key to store the data by

data System.Object
The data to store in the object

Implements SetData(string, object)