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

Map

The map that this lot is on.

public Map Map { get; }

Property Value

Map

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

CanOccupy(IEnumerable<AgeGroup>, Func<int, int, bool>)

Whether the given set of household members, referenced only by their AgeGroup, can occupy this lot.

public bool CanOccupy(IEnumerable<AgeGroup> householdMembers, Func<int, int, bool> canSleepTogether)

Parameters

householdMembers IEnumerable<AgeGroup>

The household members' individual age groups.

canSleepTogether Func<int, int, bool>

A function that determines whether the two household members at the given indices in the householdMembers collection can sleep together in the same double bed.

Returns

bool

Whether the household can occupy this lot.

CanOccupy(IList<Person>)

Whether the given set of household members can occupy this lot.

public bool CanOccupy(IList<Person> householdMembers)

Parameters

householdMembers IList<Person>

The household members.

Returns

bool

Whether the household can occupy this lot.

CanOccupy((List<AgeGroup>, Dictionary<(int Person, int Other), Relation>))

Whether the given generated household can occupy this lot.

public bool CanOccupy((List<AgeGroup>, Dictionary<(int Person, int Other), Household.Relation>) generated)

Parameters

generated (List<AgeGroup>, Dictionary<(int Person, int Other), Household.Relation>)

The generated household, gathered from Generate(Random).

Returns

bool

Whether the generated household can occupy this lot.

CanVisitRightNow(Person)

Determines whether the given person can automatically choose to visit this lot right now. Various data is considered, including the DisallowFriendsVisiting and DisallowStrangersVisiting settings, as well as this lot's GetCurrentVisitPriority(Lot, Person, TimeSpan?).

public bool CanVisitRightNow(Person person)

Parameters

person Person

The person.

Returns

bool

Whether the person can automatically visit this lot right now.

Export()

Exports this lot's data, including all of its Furniture, WallLike 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()

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 the first entry in RequiredFurniture.

public (Wall Wall, Vector2 OutdoorPos) GetFrontDoor()

Returns

(Wall Wall, Vector2 OutdoorPos)

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>() where T : MapObject

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>

GetRooms()

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

public IEnumerable<Room> GetRooms()

Returns

IEnumerable<Room>

The rooms on this lot.

GetStairs()

Returns a set of all of the Stairs on this lot's map that are contained in this lot's Area, both partially and fully.

public IEnumerable<Stairs> GetStairs()

Returns

IEnumerable<Stairs>

The stairs on this lot.

GetTiles()

Returns a set of all of the tiles on this lot's map that are contained in this lot's Area, including all tiles on non-ground floors.

public IEnumerable<(Point Pos, int Floor, Tile Tile)> GetTiles()

Returns

IEnumerable<(Point Pos, int Floor, Tile Tile)>

All tiles on this lot.

GetValidOccupyingAges()

Returns a set of ages that can potentially occupy this lot, based on the available types of beds. Note that this method does not check whether there is an adequate amount of beds available.

public AgeGroup GetValidOccupyingAges()

Returns

AgeGroup

A combined flag that represents the ages that can potentially occupy this lot.

GetWalls<T>()

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

public IEnumerable<T> GetWalls<T>() where T : WallLike

Returns

IEnumerable<T>

This lot's walls

Type Parameters

T

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, as well as additional values like the lot size, and the CityNative personality.

public Dictionary<string, float> GetWeeklyBills()

Returns

Dictionary<string, float>

The amount of weekly bills, in tiny bucks

HasBasicAmenities()

Whether this lot is considered to have basic residential amenities, which allows it to be populated automatically using PopulateLots(). Basic amenities include at least two rooms, a fridge, a counter, a toilet, a shower, a bed, a table and a chair.

public bool HasBasicAmenities()

Returns

bool

Whether this lot has basic amenities.

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