AbstractSpot - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life


AbstractSpot Class

An AbstractSpot is a base class for ObjectSpot and ActionSpot.

public abstract class AbstractSpot

Inheritance System.Object 🡒 AbstractSpot



AbstractSpot.AbstractSpot(Vector2, Vector2, float, Direction2[]) Constructor

Creates a new spot with the given data.
This is called by ObjectSpot and ActionSpot.

protected AbstractSpot(Microsoft.Xna.Framework.Vector2 offset, Microsoft.Xna.Framework.Vector2 visualOffset, float yOffset, MLEM.Misc.Direction2[] validDirections);


offset Microsoft.Xna.Framework.Vector2
The offset on both the x and y axis that this spot has

visualOffset Microsoft.Xna.Framework.Vector2
The visual offset on both the x and y axis that this spot has

yOffset System.Single
The offset on the visual y axis

validDirections MLEM.Misc.Direction2[]
The directions that this spot can be accessed from


AbstractSpot.DrawLayer Field

The layer that a person slotted into this action spot using OccupyActionSpot(Furniture, ActionSpot, bool, Nullable<Direction2>) is drawn on.
By default, this is set to return 0, meaning it will be drawn on top of the first layer of this furniture.

public Func<Furniture,int> DrawLayer;

Field Value


AbstractSpot.Group Field

The groups that this spot has, which is interpreted as a bit flag.
Two action spots with overlapping groups ((g1 AND g2) != 0) cannot both be occupied by two different people.
This is used by things lke TinyLife.Objects.FurnitureType.ModernBed to stop people from sitting on a side there someone is already sleeping.
By default, this is set to 0, meaning there is no group set.

public int Group;

Field Value


AbstractSpot.Offset Field

The offset on both the x and y axis that this spot has from the position of the Furniture it belongs to

protected internal Vector2 Offset;

Field Value


AbstractSpot.ValidDirections Field

The MLEM.Misc.Direction2 values that this spot can be accessed from.
These directions are relative to the owning Furniture's MLEM.Misc.Direction2.Up direction.
Note that, for a lot of actions, including Sit(Furniture, GameSpeed, ActionSpot), the first entry in this array will be chosen as the Person's rotation.

protected readonly Direction2[] ValidDirections;

Field Value


AbstractSpot.VisualOffset Field

The visual offset on both the x and y axis that this spot has from the position of the Furniture it belongs to.
By default, this gets set to the same value as Offset.

protected internal Vector2 VisualOffset;

Field Value



AbstractSpot.YOffset Property

The offset on the visual y axis that the Furniture or Person slotted into this spot should render with

public float YOffset { get; set; }

Property Value



AbstractSpot.DoGroupsOverlap(AbstractSpot) Method

Returns whether the passed AbstractSpot's Group and this spot's Group overlap.
Two overlapping groups are groups for which (g1 AND g2) != 0.

public bool DoGroupsOverlap(TinyLife.Objects.AbstractSpot other);


other AbstractSpot
The action spot whose groups to compare


Whether at least one group overlaps

AbstractSpot.GetLocation(Furniture, bool) Method

Returns the location that this spot has in world space, based on the given Furniture and its position and rotation.

public Microsoft.Xna.Framework.Vector2 GetLocation(TinyLife.Objects.Furniture furniture, bool visual);


furniture Furniture
The furniture that this spot belongs to

visual System.Boolean
Whetehr the VisualOffset should be used instead of the Offset


This spot's location in world space

AbstractSpot.GetValidDirections(Direction2) Method

Returns the ValidDirections of this spot, but rotated by the given MLEM.Misc.Direction2.

public System.Collections.Generic.IEnumerable<MLEM.Misc.Direction2> GetValidDirections(MLEM.Misc.Direction2 rotation);


rotation MLEM.Misc.Direction2
The rotation


The rotations that are valid for this spot