Class LotType
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
stringThe name of this lot type
icon
TextureRegionThe icon that this lot type should display.
isResidential
boolWhether 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
Cafe
public static readonly LotType Cafe
Field Value
GenericPublicLot
public static readonly LotType GenericPublicLot
Field Value
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
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
KidsPlayground
public static readonly LotType KidsPlayground
Field Value
Library
public static readonly LotType Library
Field Value
Museum
public static readonly LotType Museum
Field Value
Name
The name of this lot type
public readonly string Name
Field Value
Park
public static readonly LotType Park
Field Value
RecCenter
public static readonly LotType RecCenter
Field Value
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
Residential
public static readonly LotType Residential
Field Value
Types
A registry for all LotType objects that the game and mods define
public static readonly ReadOnlyDictionary<string, LotType> Types
Field Value
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
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
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
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
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
LotThe lot.
person
PersonLikeThe person whose visitation priority to query.
time
TimeSpan?
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
LotThe lot.
basePriority
floatThe base priority, which will be multiplied with the visitor scale factor.
maxVisitors
intThe 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
LotTypeThe lot type to register
Returns
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