Class Lot
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
-
JsonTypeSafeGenericDataHolderLot
- 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
MapThe map
area
RectangleThe 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
Name
The name of this lot, as set by the player in build mode
[DataMember]
public string Name
Field Value
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
Map
The map that this lot is on.
public Map Map { get; }
Property Value
Type
The LotType that this lot has. This value defaults to the "Residential" lot type.
public LotType Type { get; set; }
Property Value
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
ExportedLotThe 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<PersonLike>)
Whether the given set of household members can occupy this lot.
public bool CanOccupy(IList<PersonLike> householdMembers)
Parameters
householdMembers
IList<PersonLike>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(PersonLike)
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, PersonLike, TimeSpan?).
public bool CanVisitRightNow(PersonLike person)
Parameters
person
PersonLikeThe person.
Returns
- bool
Whether the person can automatically visit this lot right now.
Clear(bool, bool)
Clears this lot, removing all objects from it.
public void Clear(bool force, bool unlinkParentsAndChildren)
Parameters
force
boolWhether objects that have the NonSellable category should also be removed.
unlinkParentsAndChildren
boolWhether the UnlinkParentsAndChildren() method should be called for any Furniture removed from this lot.
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.Maths.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.
GetExportedLots()
Returns a set of all exported lots currently available to the game, including default exported lots and custom exported lots.
public static IEnumerable<(FileInfo File, ExportedLot Lot, string DisplayName, bool Custom, bool Hidden)> GetExportedLots()
Returns
- IEnumerable<(FileInfo File, ExportedLot Lot, string DisplayName, bool Custom, bool Hidden)>
The exported lots available to the game.
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(PersonLike)
Returns the home location of the given PersonLike on this lot. The home position is the position of the front door, or the closest border position to the passed PersonLike otherwise.
public Vector2 GetHomeLocation(PersonLike person)
Parameters
person
PersonLikeThe 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()
public IEnumerable<Roof> GetRoofs()
Returns
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
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
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
ExportedLotlotName
stringThe name to export this lot as.
exact
boolWhether 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
boolWhether 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