FoodTypedItem - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.Objects

FoodTypedItem Class

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 : TinyLife.Objects.Furniture,
TinyLife.Objects.IUpdatingObject

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

Derived
Food

Implements IUpdatingObject

Constructors

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

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

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

Parameters

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

Fields

FoodTypedItem.Creator Field

The System.Guid of the Person that created this item

public Guid Creator;

Field Value

System.Guid

FoodTypedItem.ExpirationTime Field

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

public TimeSpan ExpirationTime;

Field Value

System.TimeSpan

FoodTypedItem.FoodType Field

The FoodType that this food-typed item has

public FoodType FoodType;

Field Value

FoodType

FoodTypedItem.ServingSize Field

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

public int ServingSize;

Field Value

System.Int32

Properties

FoodTypedItem.Expired Property

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

public bool Expired { get; }

Property Value

System.Boolean

Methods

FoodTypedItem.GetHoverInfo() Method

Returns a MLEM.Ui.Elements.Tooltip object that is displayed whenever the mouse is hovered over this object in the world.
By default, this method returns null, which will cause no tooltip to be displayed.

public override MLEM.Ui.Elements.Tooltip GetHoverInfo();

Returns

MLEM.Ui.Elements.Tooltip
The tooltip to display

FoodTypedItem.Update(GameTime, TimeSpan, GameSpeed) Method

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

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

Parameters

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)

FoodTypedItem.Validate() Method

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

System.Boolean
false if the object is not valid, true otherwise