Class ActionSpot
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
Vector2The 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
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
yOffset
floatThe 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
Vector2The offset on both the x and y axis that this spot has
yOffset
floatThe 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
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
PointThe size of the furniture
categoryRestriction
ObjectCategoryAn 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
boolWhether the bed in question is a single bed (or a double bed)
sleepDrawLayer
floatThe layer that sleeping people should be drawn on.
sitDrawLayer
floatThe 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
boolWhether the bench is a three-seater (three tiles large)
drawLayer
floatThe 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
floatThe 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
floatThe 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
FurnitureThe furnituret that this action spot belongs to
person
PersonLikeThe 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
FurnitureThe furnituret that this action spot belongs to
visualOnly
boolWhether only occupants that occupy this spot visually, using VisuallyOccupiedSpot, should be returned.
includeGroup
boolWhether 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
FurnitureThe object whose draw layer to get
Returns
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
PointThe 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.