TinyLifeExampleMod/Api/TinyLife/Objects/Furniture.md

9.9 KiB

Furniture

Namespace: TinyLife > Objects

Assembly: Tiny Life.dll

Implements IGenericDataHolder, IPricedObject

Summary

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

Constructors

Name Summary
Furniture ( Guid, FurnitureType, Int32[], Map, Vector2 ) Creates a new furniture instance. By default, this is done using TinyLife.Objects.FurnitureType.Construct(System.Int32[],TinyLife.World.Map,Microsoft.Xna.Framework.Vector2,System.Nullable{System.Guid}).

Fields

Type Name Summary
Int32[] Colors The indices of the colors that this furniture has. Refer to TinyLife.Objects.FurnitureType.TypeSettings.ColorSchemes for the actual colors that these indices represent.
Direction2 Rotation The current rotation of this furniture. Since furniture has a wide variety of looks, the specific value of the rotation doesn't necessarily have much practical meaning.
FurnitureType Type The TinyLife.Objects.FurnitureType that this furniture has

Properties

Type Name Summary
RectangleF Area A MLEM.Misc.RectangleF that represents the area that this furniture piece is currently taking up, based on its TinyLife.Objects.FurnitureType.GetSize(MLEM.Misc.Direction2) and its TinyLife.Objects.MapObject.Position
Furniture ParentFurniture The TinyLife.Objects.Furniture that this furniture is currently latched on to. If this value is non-null, TinyLife.Objects.Furniture.ParentObjectSpot returns the object spot that this furniture is in.
ObjectSpot ParentObjectSpot The TinyLife.Objects.ObjectSpot that this furniture is currently in. If this value is non-null, TinyLife.Objects.Furniture.ParentFurniture returns the furniture that this object spot belongs to.
Vector2 VisualPosition The position (in world space) that this furniture is at. This only differs from this object's TinyLife.Objects.MapObject.Position if the TinyLife.Objects.Furniture.ParentObjectSpot's TinyLife.Objects.AbstractSpot.YOffset is non-zero.

Methods

Return Name Summary
T AddChild ( FurnitureType, Direction2, Int32[], Nullable<Guid>, Nullable<Vector2> ) Adds a child to this furniture, setting its parent (TinyLife.Objects.Furniture.SetParent(TinyLife.Objects.Furniture,TinyLife.Objects.ObjectSpot)) to this furniture.
Boolean AddChild ( Furniture, Direction2, Nullable<Vector2> ) Adds a child to this furniture, setting its parent (TinyLife.Objects.Furniture.SetParent(TinyLife.Objects.Furniture,TinyLife.Objects.ObjectSpot)) to this furniture. The object spot selected is the first available object spot.
void Draw ( GameTime, SpriteBatch, Vector2, Nullable<Color> )
void Draw ( GameTime, SpriteBatch, Vector2, Vector2, Nullable<Color>, Direction2, Int32[], Single, Boolean, Furniture, ObjectSpot, Single, Boolean ) Draws this furniture in the world with the given settings. This is a more generalized version of TinyLife.Objects.Furniture.Draw(Microsoft.Xna.Framework.GameTime,Microsoft.Xna.Framework.Graphics.SpriteBatch,Microsoft.Xna.Framework.Vector2,System.Nullable{Microsoft.Xna.Framework.Color})
void DrawUi ( GameTime, SpriteBatch, Element, Single, Int32[] ) Draws this furniture in a ui context, rather than a world context. Scale is determined based on the element that is passed.
ActionInfo GetActionSpotInfo ( Person, ActionSpot, Direction2 ) Returns a TinyLife.Actions.ActionInfo that corresponds to the given TinyLife.Objects.ActionSpot and rotation
Int32 GetAiPriority ( Person, ObjectCategory )
ObjectCategory GetCategories ( Person )
IEnumerable<T> GetChildren ( ) Returns a list of all of the children of this furniture. Children are all furnitures in the world that have their TinyLife.Objects.Furniture.ParentFurniture set to this furniture instance.
IEnumerable<String> GetDescription ( ) 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 TinyLife.World.Household.FurnitureStorage. By default, an empty set is returned.
ValueTuple<ActionSpot, Direction2> GetFreeActionSpot ( Person, ObjectCategory ) Returns the first free action spot from TinyLife.Objects.Furniture.GetFreeActionSpots(TinyLife.Objects.Person,TinyLife.Objects.ObjectCategory).
ActionInfo GetFreeActionSpotInfo ( Person, ObjectCategory ) Returns the first free action spot from TinyLife.Objects.Furniture.GetFreeActionSpot(TinyLife.Objects.Person,TinyLife.Objects.ObjectCategory), but packed into an TinyLife.Actions.ActionInfo.
IEnumerable<ValueTuple<ActionSpot, Direction2>> GetFreeActionSpots ( Person, ObjectCategory ) Returns a list of TinyLife.Objects.ActionSpot instances that are part of this furniture, which are considered free. Free, in this instance, is any spot that has the given category and is not currently occupied by another person.
ObjectSpot GetFreeObjectSpot ( FurnitureType, Nullable<Vector2> ) Returns the first free TinyLife.Objects.ObjectSpot on this furniture. Free, in this case, is any object spot that isn't already occupied by a different furniture.
Single GetPrice ( )
Boolean Intersects ( RectangleF )
void OnAdded ( )
void OnRemoved ( )
IEnumerable<T> RemoveChildren ( Predicate<T> ) Removes all of the children from this furniture that match the given predicate. Children are all furnitures in the world that have their TinyLife.Objects.Furniture.ParentFurniture set to this furniture instance.
void SetChild ( ObjectSpot, FurnitureType, Direction2, Int32[], Nullable<Guid> ) Sets the child element in the given object spot to the given furniture. If there are already children in the given object spot, those are removed prior to adding the new child.
void SetChild ( ObjectSpot, Furniture, Direction2 ) Sets the child element in the given object spot to the given furniture. If there are already children in the given object spot, those are removed prior to adding the new child.
void SetParent ( Furniture, ObjectSpot ) Sets the parent of this furniture, changing its TinyLife.Objects.MapObject.Position and settings its TinyLife.Objects.Furniture.ParentObjectSpot value.
Boolean Validate ( )