Table of Contents

Class Painting

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

A furniture is an instance of a FurnitureType which is placed in the world, or in a Person's hand. To register a custom furniture, use Register(TypeSettings).

public class Painting : Furniture, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Painting
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Painting(Guid, FurnitureType, int[], Map, Vector2, float)

Creates a new furniture instance. By default, this is done using Construct<T>(int[], Map, Vector2, float, Guid?).

public Painting(Guid id, FurnitureType type, int[] colors, Map map, Vector2 pos, float floor)

Parameters

id Guid

The id to apply to the created furniture instance

type FurnitureType

The type to create an instance of

colors int[]

The colors to apply to the furniture

map Map

The map to create the furniture on

pos Vector2

The position that the furniture should have

floor float

The floor that this object is on.

Fields

EmitsCreativeEmotion

Stores whether this painting emits a Creative EmotionModifier when people are in the same room as it. This field is used by the PerfectPainter award personality.

[DataMember]
public bool EmitsCreativeEmotion

Field Value

bool

PaintingType

The type of painting that this object displays

[DataMember]
public PaintingType PaintingType

Field Value

PaintingType

Progress

The progress that has been done on this painting by the Creator so far. This value defaults to 1, which is 100%.

[DataMember]
public float Progress

Field Value

float

Methods

CanExecuteAction(ActionType, ActionInfo, bool, bool)

Returns whether the given action can be executed at this map object. By default, this method returns Valid for all actions, but Furniture additionally returns custom results based on whether the furniture is Broken or based on AreUtilitiesDisabled.

public override CanExecuteResult CanExecuteAction(ActionType action, ActionInfo info, bool automatic, bool isAuxiliary)

Parameters

action ActionType

The action that is querying whether it can be executed.

info ActionInfo

The action info.

automatic bool

Whether the action was started automatically.

isAuxiliary bool

Whether this object is auxiliary (or the main action object).

Returns

CanExecuteResult

Whether this object allows the action to be executed at it.

Draw(GameTime, object, Vector2, float, Vector2, Color?, Direction2, int[], float, bool, ParentInfo, float, List<Item>)

Draws this furniture in the world with the given settings. This is a more generalized version of Draw(GameTime, object, Vector2, Color?, List<Item>)

public override void Draw(GameTime time, object batch, Vector2 pos, float floor, Vector2 drawPos, Color? overrideColor, Direction2 rotation, int[] colors, float drawScale, bool pivot, ParentInfo parent, float depthOffset, List<StaticSpriteBatch.Item> items)

Parameters

time GameTime

The game time

batch object

The sprite batch to draw with, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.

pos Vector2

The position, in world space, that the furniture is at

floor float

The floor to draw at.

drawPos Vector2

The position, in draw space, to draw the furniture at

overrideColor Color?

An optional color to override the default colors of the furniture

rotation Direction2

The rotation of the furniture

colors int[]

The colors to draw the furniture with

drawScale float

The scale to draw the furniture with

pivot bool

Whether or not to move the furniture by its texture's pivot point

parent ParentInfo

The object that this furniture is latched on to, or null if there is none

depthOffset float

A value that is added onto the calculated depth of the object

items List<StaticSpriteBatch.Item>

A list of sprite batch items that items should be added to if the batch is a MLEM.Graphics.StaticSpriteBatch.

GetDescription(List<string>, bool)

This method allows adding a set of strings to the description list that get displayed when the object is hovered over in the build mode or household storage UIs. By default, this method adds various strings related to the ElectricityRating, Quality, Creator, and also invokes the OnGetDescription event.

public override void GetDescription(List<string> description, bool forHoverInfo)

Parameters

description List<string>

The description to add to.

forHoverInfo bool

Whether this method is being called by GetHoverInfo(Tooltip) (or by build mode).

GetPrice()

Returns the price of this furniture item, including its CustomPrice or its Type's base price, whether it was devalued through use, whether it is dirty, its Quality, and more.

public override float GetPrice()

Returns

float

This furniture item's price.

Validate()

This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method invokes OnValidated and OnEventsAttachable.

public override bool Validate()

Returns

bool

false if the object is not valid, true otherwise