Table of Contents

Class ActionSpot

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

An action spot is a AbstractSpot extension that is used by Furniture to declare a location that a PersonLike can interact with the furniture at

public class ActionSpot : AbstractSpot
Inheritance
ActionSpot
Inherited Members
Extension Methods

Constructors

ActionSpot(Vector2, params Direction2[])

Creates a new action spot with the given settings

public ActionSpot(Vector2 offset, params Direction2[] validDirections)

Parameters

offset Vector2

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

validDirections Direction2[]

The directions that this spot can be accessed from

ActionSpot(Vector2, Vector2, float, params Direction2[])

Creates a new action spot with the given settings

public ActionSpot(Vector2 offset, Vector2 visualOffset, float yOffset, 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

yOffset float

The offset on the visual y axis

validDirections Direction2[]

The directions that this spot can be accessed from

ActionSpot(Vector2, float, params Direction2[])

Creates a new action spot with the given settings

public ActionSpot(Vector2 offset, float yOffset, params Direction2[] validDirections)

Parameters

offset Vector2

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

yOffset float

The offset on the visual y axis

validDirections Direction2[]

The directions that this spot can be accessed from

Fields

CategoryRestriction

The categories that this ActionSpot is restricted to. This is used by things like ModernBed to declare separate spots for sitting on and sleeping on. By default, this is set to null.

public ObjectCategory CategoryRestriction

Field Value

ObjectCategory

Methods

AllSpots(Point, ObjectCategory)

Returns an array of action spots with four valid directions for each location within the given size. This is the default behavior for furniture that doesn't have manually set action spots.

public static ActionSpot[] AllSpots(Point size, ObjectCategory categoryRestriction = null)

Parameters

size Point

The size of the furniture

categoryRestriction ObjectCategory

An optional CategoryRestriction

Returns

ActionSpot[]

An array of all spots within the size

BedSpots(bool, float, float)

A helper method that returns an array of ActionSpot instances at the locations that they have to be for a bed. The spots returned also contain spots that a person can sit on if there's not already someone laying in the bed. This method can be used for single and double beds.

public static ActionSpot[] BedSpots(bool single = false, float sleepDrawLayer = 3, float sitDrawLayer = 4)

Parameters

single bool

Whether the bed in question is a single bed (or a double bed)

sleepDrawLayer float

The layer that sleeping people should be drawn on.

sitDrawLayer float

The layer that sitting people should be drawn on.

Returns

ActionSpot[]

A set of action spots for the bed

BenchSpots(bool, float)

A helper method that returns an array of ActionSpot instances at locations relevant for benches and sofas. This is used by objects like SimpleBench and SimpleSofa.

public static ActionSpot[] BenchSpots(bool threeSeater = false, float drawLayer = 2)

Parameters

threeSeater bool

Whether the bench is a three-seater (three tiles large)

drawLayer float

The layer that people should be drawn on when sitting.

Returns

ActionSpot[]

An array of action spots for benches and sofas

ChairSpots(float)

A helper method that returns an array of ActionSpot instances at locations relevant for regular chairs.

public static ActionSpot[] ChairSpots(float drawLayer = 1)

Parameters

drawLayer float

The layer that people should be drawn on when sitting.

Returns

ActionSpot[]

An array of action spots for chairs

CribSpots(float)

A helper method that returns an array of ActionSpot instances at the locations that they have to be for a crib for babies to sleep in.

public static ActionSpot[] CribSpots(float drawLayer = 3)

Parameters

drawLayer float

The layer that people in the crib should be drawn on.

Returns

ActionSpot[]

A set of action spots for the crib.

GetFreeDirections(Furniture, PersonLike)

Returns a set of MLEM.Maths.Direction2 values that this spot can be accessed from. Valid directions will have an empty space that a PersonLike can stand in, but not necessarily walk to. The returned value is used by GetFreeActionSpots(PersonLike, ObjectCategory) and GetFreeActionSpotInfo(PersonLike, ObjectCategory) to find a location adjacent to this action spot that a PersonLike can walk to.

public IEnumerable<Direction2> GetFreeDirections(Furniture furniture, PersonLike person)

Parameters

furniture Furniture

The furnituret that this action spot belongs to

person PersonLike

The person trying to use this action spot

Returns

IEnumerable<Direction2>

A set of directions that are considered free, or an empty set if there are none

GetOccupants(Furniture, bool, bool)

Returns a set of the PersonLike instances that are currently occupying this action spot. Note that an action spot is also marked as occupied if the person is currently on their way to it.

public IEnumerable<PersonLike> GetOccupants(Furniture furniture, bool visualOnly = false, bool includeGroup = false)

Parameters

furniture Furniture

The furnituret that this action spot belongs to

visualOnly bool

Whether only occupants that occupy this spot visually, using VisuallyOccupiedSpot, should be returned.

includeGroup bool

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

Returns

IEnumerable<PersonLike>

A set of people interacting with this action spot

GetPicnicBenchDrawLayer(Furniture)

This is a helper method used by PicnicTableSpots(Point). Since picnic tables have their benches attached, their DrawLayer needs to be based on the CameraRotation, which is what this method calculates.

public static float GetPicnicBenchDrawLayer(Furniture furniture)

Parameters

furniture Furniture

The object whose draw layer to get

Returns

float

The draw layer as required by DrawLayer

PicnicTableSpots(Point)

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

public static ActionSpot[] PicnicTableSpots(Point size)

Parameters

size Point

The size of the picnic table furniture

Returns

ActionSpot[]

An array of action spots for picnic tables

SinkSpots()

A helper method that returns an array of ActionSpot instances at locations relevant for kitchen and bathroom sinks.

public static ActionSpot[] SinkSpots()

Returns

ActionSpot[]

An array of action spots for sinks.