Table of Contents

Class LotType

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A lot type is data for a Lot that determines the required furniture on the lot as well as whether the lot is residential or not. Additionally, custom lot types can define different reasons and interactions for PersonLike objects to visit lots of the type.

[JsonConverter(typeof(MigratingStaticJsonConverter<LotType>), new object[] { typeof(LotType), "PrivateTypes", true })]
public class LotType
Inheritance
LotType
Inherited Members
Extension Methods

Constructors

LotType(string, TextureRegion, bool, Func<Lot, PersonLike, float>, params (Predicate<Furniture>, int, string)[])

Creates a new lot type with the given settings

public LotType(string name, TextureRegion icon, bool isResidential, Func<Lot, PersonLike, float> getVisitPriority, params (Predicate<Furniture>, int, string)[] requiredFurniture)

Parameters

name string

The name of this lot type

icon TextureRegion

The icon that this lot type should display.

isResidential bool

Whether lots of this type should be considered residential

getVisitPriority Func<Lot, PersonLike, float>

A function that returns this lot type's visitation priority. It's recommended to use a helper method like GetScalingVisitPriority(Lot, float, int).

requiredFurniture (Predicate<Furniture> Predicate, int Amount, string Name)[]

A set of furniture and amounts that have to be present on lots of this type, as well as an unlocalized name for the requirement

Fields

Bar

public static readonly LotType Bar

Field Value

LotType

Cafe

public static readonly LotType Cafe

Field Value

LotType

GenericPublicLot

public static readonly LotType GenericPublicLot

Field Value

LotType

GetVisitPriority

A function that returns, for a Lot with this lot type, and a PersonLike trying ot visit the lot, how likely it is for the lot to be chosen. It is recommended to use a helper method like GetScalingVisitPriority(Lot, float, int). The higher the return value is, the more likely it is for this lot to be chosen. For reference, the "Park" lot type always returns 200. See also GetCurrentVisitPriority(Lot, PersonLike, TimeSpan?) and CanVisitRightNow(PersonLike).

public readonly Func<Lot, PersonLike, float> GetVisitPriority

Field Value

Func<Lot, PersonLike, float>

Gym

public static readonly LotType Gym

Field Value

LotType

Icon

The icon that this lot type should display.

public readonly TextureRegion Icon

Field Value

TextureRegion

IsResidential

Whether this lot is residential. A residential lot is one that Households can move into.

public readonly bool IsResidential

Field Value

bool

KidsPlayground

public static readonly LotType KidsPlayground

Field Value

LotType

Library

public static readonly LotType Library

Field Value

LotType

Museum

public static readonly LotType Museum

Field Value

LotType

Name

The name of this lot type

public readonly string Name

Field Value

string

Park

public static readonly LotType Park

Field Value

LotType

RecCenter

public static readonly LotType RecCenter

Field Value

LotType

RequiredFurniture

A set of furniture that is required on the lot. Each entry determines the Furniture required, as well as the amount of that item that is required on the lot and an unlocalized display name for the requirement.

public readonly (Predicate<Furniture> Predicate, int Amount, string Name)[] RequiredFurniture

Field Value

(Predicate<Furniture> Predicate, int Amount, string Name)[]

Residential

public static readonly LotType Residential

Field Value

LotType

Types

A registry for all LotType objects that the game and mods define

public static readonly ReadOnlyDictionary<string, LotType> Types

Field Value

ReadOnlyDictionary<string, LotType>

Properties

CanExecuteAction

A function that optionally determines whether a certain ActionType can be executed on this lot. This function also receives a ActionInfo, and a bool that indicates whether the action is started automatically. This function is useful for lots like Cafe, where using a coffee machine is disallowed if the person is not a lot employee.

public Func<ActionType, ActionInfo, bool, CanExecuteResult> CanExecuteAction { get; init; }

Property Value

Func<ActionType, ActionInfo, bool, CanExecuteResult>

DisplayName

Returns the display name of this lot, which is the Icon followed by a localized version of the Name.

public string DisplayName { get; }

Property Value

string

Employments

A set of LotEmployment instances that this lot requires to keep running. Players have the ability to add people from their exported households to work in a lot employment position.

public LotEmployment[] Employments { get; init; }

Property Value

LotEmployment[]

VisitHours

The visitation hours that this lot has, which is used in GetCurrentVisitPriority(Lot, PersonLike, TimeSpan?). The default value for this property is 6 to 23.

public (int, int) VisitHours { get; init; }

Property Value

(int Start, int End)

Methods

GetCurrentVisitPriority(Lot, PersonLike, TimeSpan?)

Returns this lot's current visitation priority, which is a combination of the GetVisitPriority function, this lot's VisitHours, the OnGetCurrentVisitPriority event, as well as the lot's Map's GetVisitPriority(PersonLike) method. Note that visitation priority doesn't factor in whether the lot's Map is the same as the person's. See also CanVisitRightNow(PersonLike).

public float GetCurrentVisitPriority(Lot lot, PersonLike person, TimeSpan? time = null)

Parameters

lot Lot

The lot.

person PersonLike

The person whose visitation priority to query.

time TimeSpan?

The current time, or null to use the Time.

Returns

float

The current visitation priority for the lot.

GetScalingVisitPriority(Lot, float, int)

A helper method intended to be used with GetVisitPriority that scales the visitation priority with the amount of people that are currently on the lot, both from the current household and other households.

public static float GetScalingVisitPriority(Lot lot, float basePriority, int maxVisitors = 50)

Parameters

lot Lot

The lot.

basePriority float

The base priority, which will be multiplied with the visitor scale factor.

maxVisitors int

The maximum amount of visitors the lot should be able to have before a priority of 0 is returned.

Returns

float

The scaling visit priority for the given lot.

Register(LotType)

Registers a new lot type to the Types registry

public static LotType Register(LotType type)

Parameters

type LotType

The lot type to register

Returns

LotType

Events

OnGetCurrentVisitPriority

An event that is invoked in GetCurrentVisitPriority(Lot, PersonLike, TimeSpan?), which allows modifying the visitation priority of this lot.

public static event LotType.CurrentVisitPriorityDelegate OnGetCurrentVisitPriority

Event Type

LotType.CurrentVisitPriorityDelegate