Table of Contents

Class FoodTypedItem

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 FoodTypedItem : Furniture, IGenericDataHolder, IUpdatingObject
Inheritance
JsonTypeSafeGenericDataHolder
FoodTypedItem
Implements
IGenericDataHolder
Derived
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

FoodTypedItem(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 FoodTypedItem(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

ExpirationTime

The (in-game) time that this object will expire on. Use Expired to see if this time has already passed.

[DataMember]
public TimeSpan ExpirationTime

Field Value

TimeSpan

FoodType

The FoodType that this food-typed item has

[DataMember]
public FoodType FoodType

Field Value

FoodType

ServingSize

The amount of servings that this item currently has. If this is greater than 1, this item is likely a FoodPlatter.

[DataMember]
public int ServingSize

Field Value

int

Properties

Expired

Returns whether this object is expired. This property compares the current in-game time to ExpirationTime.+

public bool Expired { get; }

Property Value

bool

Methods

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).

Update(GameTime, TimeSpan, float)

The update method, which is called every update frame by the underlying Map, as well as additional places like the FurnitureStorage. Because of this, some actions might only want to be invoked if an object IsInWorld. To call this method while invoking all required events, use DoUpdate(GameTime, TimeSpan, float).

public virtual void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)

Parameters

time GameTime

The game's time

passedInGame TimeSpan

The amount of time that has passed since the last call

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

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