Lot - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

Lot Class

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.

public class Lot : MLEM.Misc.GenericDataHolder,
TinyLife.World.IPricedObject

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Lot

Implements IPricedObject

Constructors

Lot.Lot(Map, Rectangle) Constructor

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

public Lot(TinyLife.World.Map map, Microsoft.Xna.Framework.Rectangle area);

Parameters

map Map
The map

area Microsoft.Xna.Framework.Rectangle
The area

Fields

Lot.Id Field

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.

public readonly Guid Id;

Field Value

System.Guid

Lot.Name Field

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

public string Name;

Field Value

System.String

Lot.Type Field

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

public LotType Type;

Field Value

LotType

Properties

Lot.Area Property

The area in the world that this lot occupies

public Microsoft.Xna.Framework.Rectangle Area { get; set; }

Property Value

Microsoft.Xna.Framework.Rectangle

Lot.Household Property

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

public TinyLife.World.Household Household { get; }

Property Value

Household

Methods

Lot.AreRequirementsMet() Method

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

public bool AreRequirementsMet();

Returns

System.Boolean
true if the requirements are met, false otherwise

Lot.CanImport(ExportedLot) Method

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(TinyLife.World.ExportedLot import);

Parameters

import ExportedLot
The lot to import

Returns

System.Boolean
true if the lot can be imported, false otherwise

Lot.Export() Method

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 TinyLife.World.ExportedLot Export();

Returns

ExportedLot
An exported version of this lot

Lot.GetCoveredArea() Method

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 MLEM.Misc.RectangleF GetCoveredArea();

Returns

MLEM.Misc.RectangleF
The area that this lot covers

Lot.GetHomeLocation(Person) Method

Returns the home location of the given Person on this lot.
The home position is the position of the front door on a residential lot (IsResidential) or the closest border position to the passed Person otherwise.

public Microsoft.Xna.Framework.Vector2 GetHomeLocation(TinyLife.Objects.Person person);

Parameters

person Person
The person whose home location to retrieve

Returns

Microsoft.Xna.Framework.Vector2
The person's home location on this lot

Lot.GetObjects<T>() Method

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

public System.Collections.Generic.IEnumerable<T> GetObjects<T>();

Type parameters

T
The type of objects to receive

Returns

System.Collections.Generic.IEnumerable<T>
This lot's objects

Lot.GetPrice() Method

Returns the price that this object can be bought or sold for.
Note that, like in the case of the Painting, the returned price isn't necessarily the full price that the object can be sold for. Instead, the price returned here should be the price that this object has when bought or sold from the FurnitureTool or similar.

public float GetPrice();

Returns

System.Single
The object's price

Implements GetPrice()

Lot.GetRoofs() Method

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

public System.Collections.Generic.IEnumerable<TinyLife.World.Roof> GetRoofs();

Returns

System.Collections.Generic.IEnumerable<Roof>

Lot.GetWalls() Method

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

public System.Collections.Generic.IEnumerable<TinyLife.World.Wall> GetWalls();

Returns

System.Collections.Generic.IEnumerable<Wall>
This lot's walls

Lot.GetWeeklyBills() Method

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

System.Single
The amount of weekly bills, in tiny bucks

Lot.Import(ExportedLot, bool, bool) Method

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(TinyLife.World.ExportedLot lot, bool exact=false, bool forceClear=false);

Parameters

lot ExportedLot

exact System.Boolean
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 System.Boolean
Whether the lot should be force-cleared before importing, meaning even NonSellable objects will be removed

Lot.Validate(Map) Method

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

public void Validate(TinyLife.World.Map map);

Parameters

map Map