Class ObjectSpot
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
Vector2The offset on both the x and y axis that this spot has
visualOffset
Vector2The 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
floatThe 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
Vector2The 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
floatThe 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
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
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
boolWhether the object is a stove (or a counter)
yOffset
floatThe y offset that the countertops should be ad. Defaults to -13 / 16.
drawLayer
floatThe 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
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
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
FurnitureThe furniture that this spot belongs to
includeGroup
boolWhether 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
FurnitureThe furniture that has this object spot.
content
FurnitureTypeThe content to query.
Returns
- bool
Whether the
content
is allowed on thefurniture
.
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
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
floatThe height of the object's spots. Defaults to -13/16.
drawLayer
floatThe 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
PointThe size that the table has in tiles
tabletopHeight
floatThe height of the tabletops. Defaults to -10 / 16.
drawLayer
floatThe 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
Returns
- ObjectSpot[]
A set of object spots for trees.