Table of Contents

Struct FurnitureType.TypeSettings

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

A set of settings that define the properties of a FurnitureType

public struct FurnitureType.TypeSettings : IGenericDataHolder
Implements
IGenericDataHolder
Inherited Members
Extension Methods

Constructors

TypeSettings(string, Point, ObjectCategory, float, params ColorScheme[])

Initializes a new FurnitureType.TypeSettings instance with the given data

public TypeSettings(string name, Point size, ObjectCategory categories, float price, params ColorScheme[] colorSchemes)

Parameters

name string

The name that this furniture type should have

size Point

The size that this furniture type should have

categories ObjectCategory

The categories that this furniture type should have

price float

The price of this furniture type

colorSchemes ColorScheme[]

The color schemes that this furniture type should have. Cannot be empty.

Fields

ActionSpots

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[]

BrokenBehavior

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

public BreakableFurniture.BrokenBehavior BrokenBehavior

Field Value

BreakableFurniture.BrokenBehavior

BuyableVariations

An array of actions that can modify the passed Furniture instance to allow for multiple variations of it to be displayed as a group in the furniture tool similarly. This is used, for example, for FoodPlate and CustomPainting. If this is null or empty (the former of which it is by default), this furniture item will have no variations.

public Func<Action<Furniture>[]> BuyableVariations

Field Value

Func<Action<Furniture>[]>

CanExecuteAction

A function that can be used to allow or disallow certain ActionType instances to execute or not. By default, this function is null, meaning no special conditions are created by this FurnitureType, and all actions that themselves are valid can be executed on this furniture item.

public Func<(ActionType Type, ActionInfo Info, bool Automatic, bool IsAuxiliary), CanExecuteResult> CanExecuteAction

Field Value

Func<(ActionType Type, ActionInfo Info, bool Automatic, bool IsAuxiliary), CanExecuteResult>

Categories

A set of ObjectCategory flags that this furniture should have

public ObjectCategory Categories

Field Value

ObjectCategory

Colors

The color settings to use for this furniture type.

public ColorSettings Colors

Field Value

ColorSettings

ConstructedType

A delegate to a Type that is constructed when this furniture type is instantiated using Construct<T>(int[], Map, Vector2, float, Guid?). The type needs to have a constructor with the same signature as Furniture(Guid, FurnitureType, int[], Map, Vector2, float). 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

Type

DecorativeRating

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, float> DecorativeRating

Field Value

Func<Furniture, float>

DefaultRotation

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

public Direction2 DefaultRotation

Field Value

Direction2

DirtyOverlayTextureName

The name of an overlay texture that should be drawn on top of this object if it is Dirty. Giving this field a value will automatically allow the object to get dirty after a while of being used. The textures loaded through this texture name act similarly to the ones loaded through TextureName, in that they adhere to the object's possible rotations, and have the same amount of layers as this Colors' Map has entries. By default, the texture to use is "approximated" using GetDefaultDirtyOverlayTextureName(ObjectCategory).

public string DirtyOverlayTextureName

Field Value

string

DistanceFromObstructions

A minimum distance from obstructions (walls and roofs) that this object has to have to be placed. This value is used in GetWallsInTheWay<T>(Vector2, float, Direction2, float, ICollection<WallLike>) and GetRoofingInTheWay(Vector2, int, Direction2, float, ICollection<Roof>) by inflating the object's Size. This value defaults to 0, and it is used by objects like trees.

public int DistanceFromObstructions

Field Value

int

EfficiencyModifier

This object's efficiency modifier, which is multiplied with a person's efficiency if this object is an involved object in a person's current action. This value is used in GetEfficiencyModifier(PersonLike, ActionInfo, bool, SkillType, float).

public float EfficiencyModifier

Field Value

float

ElectricityRating

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

float

GetDisplayName

A function that is used in GetDisplayName to determine the display name that this furniture type's instances should have. Note that, when this function is invoked, the Furniture instance passed may be null.

public Func<string, Furniture, string> GetDisplayName

Field Value

Func<string, Furniture, string>

HeldArmsOut

Whether, when this object is held by a PersonLike, the StandingArmsOut and WalkingArmsOut poses should be used instead of the regular Standing and Walking poses. This looks better for bigger objects like CustomPainting.

public bool HeldArmsOut

Field Value

bool

HeldPivot

Whether, when this object is held by a PersonLike, 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

bool

Icon

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

TextureRegion

IsAllowedInSpot

A function that can be used to allow or disallow this object to be slotted into an ObjectSpot on a given Furniture instance. By default, this function is null, meaning no special conditions are created by this FurnitureType, and all object spots that allow this object will be able to accept it.

public Func<(Furniture Parent, ObjectSpot Spot), bool> IsAllowedInSpot

Field Value

Func<(Furniture Parent, ObjectSpot Spot), bool>

LightSettings

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

public LightFurniture.Settings LightSettings

Field Value

LightFurniture.Settings

Migrations

The set of migrations that should be applied to furniture objects of this type when loaded from disk.

public List<Migration<Furniture>> Migrations

Field Value

List<Migration<Furniture>>

Name

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

public string Name

Field Value

string

ObjectSpots

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

public ObjectSpot[] ObjectSpots

Field Value

ObjectSpot[]

OnDescription

An action that is invoked when the GetDescription(List<string>, bool) method is called on a furniture instance that uses these type settings. This action can be used to add additional description lines, or remove existing ones.

public Action<List<string>, bool> OnDescription

Field Value

Action<List<string>, bool>

Price

The price that this furniture should have

public float Price

Field Value

float

Reliability

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<T>(int[], Map, Vector2, float, Guid?) will construct a BreakableFurniture by default.

public int? Reliability

Field Value

int?

RestoreNeedModifier

This object's need restoration modifier, which is multiplied with a person's need restoration speed if this object is an involved object in a person's current action. This value is used in GetRestoreNeedModifier(PersonLike, ActionInfo, bool, NeedType).

public float RestoreNeedModifier

Field Value

float

Size

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

public Point Size

Field Value

Point

Tab

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

public FurnitureTool.Tab Tab

Field Value

FurnitureTool.Tab

TextureName

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

string

Visibility

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

WaterRating

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

float

Methods

GetDataKeys()

Returns all of the generic data that this object stores.

public readonly IEnumerable<string> GetDataKeys()

Returns

IEnumerable<string>

The generic data on this object

GetData<T>(string)

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

public readonly T GetData<T>(string key)

Parameters

key string

The key that the data is stored by

Returns

T

The data, or default if it doesn't exist

Type Parameters

T

The type of the data stored

SetData<T>(string, T)

Store a piece of generic data on this object.

public void SetData<T>(string key, T data)

Parameters

key string

The key to store the data by

data T

The data to store in the object

Type Parameters

T