BreakableFurniture - Ellpeck/TinyLifeExampleMod Wiki

Original URL:

Tiny Life


BreakableFurniture Class

Breakable furniture is Furniture that can be Broken and then repaired.
An object of this class is automatically returned in Construct(int[], Map, Vector2, Nullable<Guid>) if no ConstructedType is set.

public class BreakableFurniture : TinyLife.Objects.Furniture,

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 MapObject 🡒 Furniture 🡒 BreakableFurniture


Implements IUpdatingObject


BreakableFurniture.BreakableFurniture(Guid, FurnitureType, int[], Map, Vector2) Constructor

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

public BreakableFurniture(System.Guid id, TinyLife.Objects.FurnitureType type, int[] colors, TinyLife.World.Map map, Microsoft.Xna.Framework.Vector2 pos);


id System.Guid
The id to apply to the created furniture instance

type FurnitureType
The type to create an instance of

colors System.Int32[]
The colors to apply to the furniture

map Map
The map to create the furniture on

pos Microsoft.Xna.Framework.Vector2
The position that the furniture should have


BreakableFurniture.Broken Field

A field that stores whether this furniture is currently broken

public bool Broken;

Field Value



BreakableFurniture.ActionUpdate(Action, GameTime, TimeSpan, GameSpeed, bool) Method

This method is called when an Action that this object is involved in updates, which is every Microsoft.Xna.Framework.Game.Update(Microsoft.Xna.Framework.GameTime) frame.
This object counts as involved in the action if its ActionInfo's GetInvolvedObjects<T>(ObjectCategory, bool) includes this object
By default, this method does nothing.

public override void ActionUpdate(TinyLife.Actions.Action action, Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed, bool isAuxiliary);


action Action
The action

time Microsoft.Xna.Framework.GameTime
The current game time

passedInGame System.TimeSpan
The amount of time that has passed, in game time

speed GameSpeed
The game's current speed setting

isAuxiliary System.Boolean
Whether this object counts as an auxiliary object. If this value is false, the object is th eGetActionObject<T>()

BreakableFurniture.GetDescription() Method

Returns a set of lines that are displayed in build mode when this furniture is hovered over, either in the buy menu or in the FurnitureStorage.
By default, info about Reliability and ElectricityRating is returned.

public override System.Collections.Generic.IEnumerable<string> GetDescription();


A set of description lines for this furniture item

BreakableFurniture.GetPrice() Method

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 override float GetPrice();


The object's price

Implements GetPrice()

BreakableFurniture.Update(GameTime, TimeSpan, GameSpeed) Method

The update method, which is called every update frame by the underlying Map

public virtual void Update(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);


time Microsoft.Xna.Framework.GameTime
The game's time

passedInGame System.TimeSpan
The amount of time that has passed since the last call

speed GameSpeed
The game's speed

Implements Update(GameTime, TimeSpan, GameSpeed)

BreakableFurniture.WearDown(TimeSpan) Method

Causes this furniture to wear down, increasing the likelihood of it becoming Broken and randomly breaking it

public void WearDown(System.TimeSpan passedInGame);


passedInGame System.TimeSpan
The amount of in-game time that this furniture should be worn down by