Table of Contents

Class ObjectSpot

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

An object spot is a AbstractSpot extension that is used by Furniture to declare a location that another Furniture object can be slotted into. This behavior is used for things like plates on counters, flower pots on bedside tables etc.

public class ObjectSpot : AbstractSpot
Inheritance
ObjectSpot
Inherited Members
Extension Methods

Constructors

ObjectSpot(Vector2, Vector2, Predicate<FurnitureType>, float, params Direction2[])

Creates a new object spot with the given settings

public ObjectSpot(Vector2 offset, Vector2 visualOffset, Predicate<FurnitureType> isFurnitureAllowed, float yOffset = 0, params Direction2[] validDirections)

Parameters

offset Vector2

The offset on both the x and y axis that this spot has

visualOffset Vector2

The visual offset on both the x and y axis that this spot has

isFurnitureAllowed Predicate<FurnitureType>

A predicate that determines if the given FurnitureType is allowed to be put into this spot

yOffset float

The offset on the visual y axis

validDirections Direction2[]

The directions that this spot can be accessed from

ObjectSpot(Vector2, Predicate<FurnitureType>, float, params Direction2[])

Creates a new object spot with the given settings

public ObjectSpot(Vector2 offset, Predicate<FurnitureType> isFurnitureAllowed, float yOffset = 0, params Direction2[] validDirections)

Parameters

offset Vector2

The offset on both the x and y axis that this spot has

isFurnitureAllowed Predicate<FurnitureType>

A predicate that determines if the given FurnitureType is allowed to be put into this spot

yOffset float

The offset on the visual y axis

validDirections Direction2[]

The directions that this spot can be accessed from

Fields

IsFurnitureAllowed

A predicate that determines if the given FurnitureType is allowed to be put into this object spot.

protected readonly Predicate<FurnitureType> IsFurnitureAllowed

Field Value

Predicate<FurnitureType>

Methods

BarSpots(float, float)

A helper method to create a set of ObjectSpot instances for bars

public static ObjectSpot[] BarSpots(float yOffset = -0.8125, float drawLayer = 1)

Parameters

yOffset float
drawLayer float

Returns

ObjectSpot[]

A set of object spots for bars

CounterSpots(bool, float, float)

A helper method to create a set of ObjectSpot instnaces for counters and stoves. The resulting set contains a single object spot for SmallObject and CounterObject object, or PreparedFood and Pot if stove is true.

public static ObjectSpot[] CounterSpots(bool stove = false, float yOffset = -0.8125, float drawLayer = 2)

Parameters

stove bool

Whether the object is a stove (or a counter)

yOffset float

The y offset that the countertops should be ad. Defaults to -13 / 16.

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

A set of object spots for the stove or counter

DeskSpots(float, bool, float)

A helper method to create a set of ObjectSpot instances for a desk spot and two chair attachment spots on both sides of the desk, as well as a few spots for decorative objects with the SmallObject category.

public static ObjectSpot[] DeskSpots(float yOffset = -0.625, bool chairs = true, float drawLayer = 1)

Parameters

yOffset float
chairs bool
drawLayer float

Returns

ObjectSpot[]

A set of object spots for desks

DoubleShelfSpots(float, float)

A helper method to create a set of ObjectSpot instances for things that can store two objects side by side (or one big object in the center). This method is used by furniture like the SimpleDrawer.

public static ObjectSpot[] DoubleShelfSpots(float height = 1, float drawLayer = 1)

Parameters

height float

The height of the object's spots. Defaults to 1.

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

A set of object spots for shelf-like objects

GetContents<T>(Furniture, bool)

Returns the Furniture objects that are currently slotted into this spot

public IEnumerable<T> GetContents<T>(Furniture furniture, bool includeGroup = false) where T : Furniture

Parameters

furniture Furniture

The furniture that this spot belongs to

includeGroup bool

Whether to include other object spots that have at least one of the same Group

Returns

IEnumerable<T>

A set of children of this spot, or an empty set if there are none

Type Parameters

T

The type the child furnitures are expected to be

IsContentAllowed(Furniture, FurnitureType)

Returns whether the given FurnitureType is allowed on this object spot hosted by the given Furniture instance.

public bool IsContentAllowed(Furniture furniture, FurnitureType content)

Parameters

furniture Furniture

The furniture that has this object spot.

content FurnitureType

The content to query.

Returns

bool

Whether the content is allowed on the furniture.

PicnicTableSpots(Point, float)

A helper method that returns an array of ObjectSpot instances at locations relevant for picnic-style tables that have attached benches. This is used by objects like SimplePicnicTable.

public static ObjectSpot[] PicnicTableSpots(Point size, float drawLayer = 1)

Parameters

size Point

The size of the picnic table furniture

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

An array of object spots for picnic tables

SingleShelfSpots(float, float)

A helper method to create a set of ObjectSpot instances for a shelf that can hold one item.

public static ObjectSpot[] SingleShelfSpots(float height = -0.8125, float drawLayer = 1)

Parameters

height float

The height of the object's spots. Defaults to -13/16.

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

A set of object spots for single shelves.

TableSpots(Point, float, float)

A helper method to create a set of ObjectSpot instances for a table of the given size. The resulting set of object spots will have spots for Chair objects on each side as well as SmallObject objects on each tile position.

public static ObjectSpot[] TableSpots(Point size, float tabletopHeight = -0.625, float drawLayer = 1)

Parameters

size Point

The size that the table has in tiles

tabletopHeight float

The height of the tabletops. Defaults to -10 / 16.

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

A set of object spots for the table

TreeSpots(float, float)

A helper method to create a set of ObjectSpot instances for trees that can have objects, like the MapleFairyLights, added to them.

public static ObjectSpot[] TreeSpots(float yOffset = -2, float drawLayer = 1)

Parameters

yOffset float

The y offset.

drawLayer float

The DrawLayer to use.

Returns

ObjectSpot[]

A set of object spots for trees.