TinyLifeExampleMod/Api/TinyLife/World/Lot.md

5.2 KiB

Lot

Namespace: TinyLife > World

Assembly: Tiny Life.dll

Implements IGenericDataHolder, IPricedObject

Summary

A lot is a designated area in the world (created using the TinyLife.Tools.LotTool). In the way it works, it acts similarly to a small TinyLife.World.Map, allowing the retrieval of various object types only in its designated area. A lot has a TinyLife.World.LotType, which determines what things can be done on the lot.

Constructors

Name Summary
Lot ( Map, Rectangle ) Creates a new lot on the given map with the given area

Fields

Type Name Summary
Rectangle Area The area in the world that this lot occupies
Guid Id The unique id of this lot. This is randomly generated when the lot is first added to the world, and then persists across savings to disk.
String Name The name of this lot, as set by the player in build mode
LotType Type The TinyLife.World.LotType that this lot has. This value defaults to the "Residential" lot type.

Properties

Type Name Summary
Household Household The household that is currently occupying this TinyLife.World.Lot. This can only be non-null if the TinyLife.World.Lot.Type has TinyLife.World.LotType.IsResidential set to true.

Methods

Return Name Summary
Boolean AreRequirementsMet ( ) Returns whether this lot TinyLife.World.Lot.Type's TinyLife.World.LotType.RequiredFurniture requirements are currently met
Boolean CanImport ( ExportedLot ) A method that calculates whether the given TinyLife.World.ExportedLot can be imported. A lot can be imported if the TinyLife.World.Lot.Household has enough money, and if this lot's TinyLife.World.Lot.Area is greater than or equal to the exported lot's area.
Boolean CanMove ( Direction2 ) Returns whether or not the entire lot can be moved in the given direction. The decision is based on this lot's TinyLife.World.Lot.GetCoveredArea and its TinyLife.World.Lot.Area.
ExportedLot Export ( ) Exports this lot's data, including all of its TinyLife.Objects.Furniture, TinyLife.World.Wall and TinyLife.World.Roof obejects and its TinyLife.World.Tile ground. Note that this does not change the lot itself, as it doesn't remove or add anything to it.
RectangleF GetCoveredArea ( ) Returns a MLEM.Misc.RectangleF that represents the area that this lot actually covers. The area covered by this lot is always bounded by its TinyLife.World.Lot.Area, but will be smaller if there are fewer objects on the lot.
Wall GetFrontDoor ( ) Returns the TinyLife.World.Wall that this lot's front door is located in. The front door is the door that is closest to this lot's TinyLife.Objects.FurnitureType.Mailbox that also connects a non-room (the outside) to a room (the inside).
Vector2 GetHomeLocation ( Person ) Returns the home location of the given TinyLife.Objects.Person on this lot. The home position is the position of the front door on a residential lot (TinyLife.World.LotType.IsResidential) or the closest border position to the passed TinyLife.Objects.Person otherwise.
IEnumerable<T> GetObjects ( ) Returns the set of all of the TinyLife.Objects.MapObject instances on this lot's map that are contained in this lot's TinyLife.World.Lot.Area.
Single GetPrice ( )
IEnumerable<Roof> GetRoofs ( ) Returns a set of all of the TinyLife.World.Roof instances on this lot's map that are contained in this lot's TinyLife.World.Lot.Area
IEnumerable<Wall> GetWalls ( ) Returns a set of all of the TinyLife.World.Wall instances on this lot's map that are contained in this lot's TinyLife.World.Lot.Area
void Import ( ExportedLot ) Imports the given TinyLife.World.ExportedLot onto this lot. Note that everything that was previously on this lot will be removed (and the money will be returned to this lot's TinyLife.World.Lot.Household). Also note that the TinyLife.World.Lot.Household stays the same, and all tiles outside of the exported lot's area (if it is smaller) are replaced with Grass.
void Move ( Direction2 ) Move the entire lot in the given direction (by one tile). Note that TinyLife.World.Lot.CanMove(MLEM.Misc.Direction2) is not called internally.
void Validate ( Map )