Table of Contents

Class Lot

Namespace
TinyLife.World
Assembly
Tiny Life.dll

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

[DataContract]
public class Lot : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Lot
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Lot(Map, Rectangle)

Creates a new lot on the given map with the given area

public Lot(Map map, Rectangle area)

Parameters

map Map

The map

area Rectangle

The area

Fields

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.

[DataMember]
public readonly Guid Id

Field Value

Guid

Name

The name of this lot, as set by the player in build mode

[DataMember]
public string Name

Field Value

string

Properties

Area

The area in the world that this lot occupies

[DataMember]
public Rectangle Area { get; }

Property Value

Rectangle

Household

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

public Household Household { get; }

Property Value

Household

Type

The LotType that this lot has. This value defaults to the "Residential" lot type.

public LotType Type { get; set; }

Property Value

LotType

Methods

AreRequirementsMet()

Returns whether this lot Type's RequiredFurniture requirements are currently met

public bool AreRequirementsMet()

Returns

bool

true if the requirements are met, false otherwise

CanImport(ExportedLot)

A method that calculates whether the given ExportedLot can be imported. A lot can be imported if the Household has enough money, and if this lot's Area is greater than or equal to the exported lot's area.

public bool CanImport(ExportedLot import)

Parameters

import ExportedLot

The lot to import

Returns

bool

true if the lot can be imported, false otherwise

Export()

Exports this lot's data, including all of its Furniture, Wall and Roof obejects and its Tile ground. Note that this does not change the lot itself, as it doesn't remove or add anything to it.

public ExportedLot Export()

Returns

ExportedLot

An exported version of this lot

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 Area, but will be smaller if there are fewer objects on the lot.

public RectangleF GetCoveredArea()

Returns

RectangleF

The area that this lot covers

GetDefaultTile()

Returns the default tile for this lot, which is the tile that is most likely to be the "ground tile" in this area. This is a heuristic based on the tiles that are at the borders of this lot.

public Tile GetDefaultTile()

Returns

Tile

This lot's default tile.

GetFrontDoor(Vector2)

Returns this lot's front door, or null if there is no Wall that matches the required conditions. A lot's front door is the door that is closest to the lot's object of interest, which is a RequiredFurniture.

public (Wall, Vector2) GetFrontDoor(Vector2 position)

Parameters

position Vector2

The position that the front door should be closest to.

Returns

(Wall, Vector2)

The lot's front door, or null if there is none.

GetHomeLocation(Person)

Returns the home location of the given Person on this lot. The home position is the position of the front door, or the closest border position to the passed Person otherwise.

public Vector2 GetHomeLocation(Person person)

Parameters

person Person

The person whose home location to retrieve

Returns

Vector2

The person's home location on this lot

GetObjects<T>()

Returns the set of all of the MapObject instances on this lot's map that are contained in this lot's Area.

public IEnumerable<T> GetObjects<T>()

Returns

IEnumerable<T>

This lot's objects

Type Parameters

T

The type of objects to receive

GetPrice()

Returns this lot's current price, including the prices of all furniture objects, walls, roofs, tiles and the price of its Area.

public float GetPrice()

Returns

float

This lot's total price.

GetRoofs()

Returns a set of all of the Roof instances on this lot's map that are contained in this lot's Area

public IEnumerable<Roof> GetRoofs()

Returns

IEnumerable<Roof>

GetWalls()

Returns a set of all of the Wall instances on this lot's map that are contained in this lot's Area

public IEnumerable<Wall> GetWalls()

Returns

IEnumerable<Wall>

This lot's walls

GetWeeklyBills()

Returns the amount of tiny bucks that need to be paid weekly by a Household living on this lot. The bills result from the ElectricityRating and WaterRating of the objects on the lot.

public float GetWeeklyBills()

Returns

float

The amount of weekly bills, in tiny bucks

Import(ExportedLot, string, bool, bool)

Imports the given 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 Household). Also note that the Household stays the same, and all tiles outside of the exported lot's area (if it is smaller) are replaced with Grass.

public void Import(ExportedLot lot, string lotName, bool exact = false, bool forceClear = false)

Parameters

lot ExportedLot
lotName string

The name to export this lot as.

exact bool

Whether an exact copy of the lot should be imported. If this is false, the imported lot is moved to best fit the lot's dimensions

forceClear bool

Whether the lot should be force-cleared before importing, meaning even NonSellable objects will be removed

Validate(Map)

This method is called when this object is loaded from disk.

public void Validate(Map map)

Parameters

map Map

Events

OnGetWeeklyBills

An event that is invoked when weekly bills are calculated for this lot's Household in GetWeeklyBills(). Mods can subscribe to this event to add additional costs or reduce the default costs.

public static event Lot.WeeklyBillsDelegate OnGetWeeklyBills

Event Type

Lot.WeeklyBillsDelegate