Class LotEmployment
A lot employment is a job that a Person executes somewhat perpetually. A person with a LotEmployment does not live on a Lot or in a Household, but instead either works at their lot employment or "leaves the city" through an BeAwayFromLotEmploymentAction. Lot employments can be added to lots using Employments or to a map using MapWideEmployments.
public class LotEmployment
- Inheritance
-
LotEmployment
- Inherited Members
- Extension Methods
Constructors
LotEmployment(string, TextureRegion, (int Start, int End), Func<IEnumerable<ActionType>>, bool, int)
Creates a new lot employment with the given settings
public LotEmployment(string name, TextureRegion icon, (int Start, int End) workHours, Func<IEnumerable<ActionType>> actions, bool forHireOnce = false, int maxAmount = 1)
Parameters
name
stringThe lot employment's name
icon
TextureRegionThe icon to use for this lot employment.
workHours
(int Start, int End)The lot employment's work hours.
actions
Func<IEnumerable<ActionType>>The Actions that lot employees should execute. Using actions with the Nothing category will cause any instances of the action to act as if they had the Self category instead. Note that, for an Action returned by this function to have an effect, its PassivePriority needs to be greater than 0.
forHireOnce
boolWhether this lot employment is intended for one-off hires. If this is true, the person will never autonomously start work, and has to be hired for a lot using HireOnceForLot(Lot, bool).
maxAmount
intThe maximum amount of people that can simultaneously be employed in this position. By default, this only has an effect in HireOnceForLot(Lot, bool) and when manually invoking AddCurrentPerson(Map, Lot, Person, AppliedMigrations, bool, bool).
Fields
Actions
A set of ActionType instances that a person working in this employment should choose to randomly execute very often. Using actions with the Nothing category will cause any instances of the action to act as if they had the Self category instead. Note that, for an Action returned by this function to have an effect, its PassivePriority needs to be greater than 0.
public readonly Func<IEnumerable<ActionType>> Actions
Field Value
Babysitter
public static readonly LotEmployment Babysitter
Field Value
Barista
public static readonly LotEmployment Barista
Field Value
Bartender
public static readonly LotEmployment Bartender
Field Value
ForHireOnce
Whether this lot employment is intended for one-off hires. If this is true, the person will never autonomously start work, and has to be hired for a lot using HireOnceForLot(Lot, bool). Additionally, employments that are for hire once won't automatically have members assigned or generated in UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>).
public readonly bool ForHireOnce
Field Value
GymTrainer
public static readonly LotEmployment GymTrainer
Field Value
Icon
The icon of this lot employment.
public readonly TextureRegion Icon
Field Value
- TextureRegion
Librarian
public static readonly LotEmployment Librarian
Field Value
MailCarrier
public static readonly LotEmployment MailCarrier
Field Value
MapWideEmployments
A list of lot employments that are map-wide, that is, that aren't bound to a Lot. To add more map-wide lot employments, just add additional entries to this list.
public static readonly List<LotEmployment> MapWideEmployments
Field Value
MaxAmount
The maximum amount of people that can simultaneously be employed in this position. By default, this only has an effect in HireOnceForLot(Lot, bool) and when manually invoking AddCurrentPerson(Map, Lot, Person, AppliedMigrations, bool, bool).
public readonly int MaxAmount
Field Value
MuseumCurator
public static readonly LotEmployment MuseumCurator
Field Value
Name
The name of this lot employment
public readonly string Name
Field Value
TrashCollector
public static readonly LotEmployment TrashCollector
Field Value
WorkHours
The range of hours that this lot employment is active in. During times outside of these hours, people with this employment will automatically enqueue and execute a BeAwayFromLotEmploymentAction.
public readonly (int Start, int End) WorkHours
Field Value
Properties
ActionPriorityMultiplier
A function that can optionally be used to make certain actions have a higher priority for people with this lot employment. The returned float will be multiplied with the default priority for the given ActionType.
public Func<Person, ActionType, float> ActionPriorityMultiplier { get; init; }
Property Value
AiPriorityMultiplier
A function that can optionally be used to make certain objects have a higher priority for usage with a given action. The returned float will be multiplied with the default priority for the given MapObject.
public Func<Person, MapObject, ObjectCategory, float> AiPriorityMultiplier { get; init; }
Property Value
Hidden
A property that determines whether instances of this lot employment should be hidden from the player in the household selection and build mode UIs. This defaults to false.
public bool Hidden { get; init; }
Property Value
HourlyFee
The amount of tiny bucks that a person with this lot employment will earn per hour if hired once using ForHireOnce.
public float HourlyFee { get; init; }
Property Value
IdleObjects
A set of ObjectCategory flags that represent the item types that a person with this lot employment will idle around if they have nothing else to do. If this is set to a non-Nothing category, people with this lot employment will automatically enqueue the LotEmploymentIdle action if there is nothing else to do currently.
public ObjectCategory IdleObjects { get; init; }
Property Value
IdleTime
The amount of in-game time that a person with this lot employment will idle at one of their IdleObjects for. Defaults to 5 minutes.
public TimeSpan IdleTime { get; init; }
Property Value
IsFinished
A function that can be used to finish the lot employment's work hours before the current time is outside of WorkHours. This is used by the mail carrier to make them stop working once all mail is delivered.
public Func<LotEmployment.Instance, Person, bool> IsFinished { get; init; }
Property Value
IsRequired
A function that optionally returns whether this lot employment type is actualy required on the given Map and Lot. If this is nonnull and returns false, the lot employment is not displayed, and a person is not added to it.
public Func<Map, Lot, bool> IsRequired { get; init; }
Property Value
OffWorkDays
A set of weekdays where work should not be done.
public DayOfWeek[] OffWorkDays { get; init; }
Property Value
OnFinished
An action that is invoked when this lot employment's work is finished in FinishWork(bool).
public Action<LotEmployment.Instance, Person> OnFinished { get; init; }
Property Value
Methods
AddCurrentPerson(Map, Lot, Person, AppliedMigrations, bool, bool)
Sets the current person for this lot employment on the given Map and Lot.
If this employment is a MapWideEmployments entry, the employmentLot
should be null.
public bool AddCurrentPerson(Map map, Lot employmentLot, Person person, AppliedMigrations appliedMigrations, bool manual = true, bool enqueueAwayAction = true)
Parameters
map
MapThe map
employmentLot
LotThe lot, or null if this is a map wide employment
person
PersonThe person to set, or null to remove the currently employed person.
appliedMigrations
AppliedMigrationsThe set of migrations that have already been applied on the given
person
.manual
boolWhether this person was set manually (by a user) or automatically (using UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>)
enqueueAwayAction
boolWhether the BeAwayFromLotEmployment action should be immediately enqueued.
Returns
GetCurrentPeople(Map, Lot)
Returns the Person that is currently in charge of this lot employment. To check for MapWideEmployments, a null lot can be passed.
public IEnumerable<Person> GetCurrentPeople(Map map, Lot employmentLot)
Parameters
map
MapThe map that the employment is on.
employmentLot
LotThe lot, or null for a MapWideEmployments entry. Please note that this parameter does not check the WorkLot, only the EmploymentLot.
Returns
- IEnumerable<Person>
The person that currently works in this lot employment, or null if there is none
HireOnceForLot(Lot, bool)
Causes a person that works at this lot employment to be hired as a one-off laborer at the given workLot
.
If generateAdditional
is true, and there is no lot employee currently free, a new one will be generated if MaxAmount has not been reached yet.
public Person HireOnceForLot(Lot workLot, bool generateAdditional = true)
Parameters
workLot
LotThe lot to work at.
generateAdditional
boolWhether additional employees should be generated if none are free.
Returns
Exceptions
- InvalidOperationException
Thrown if this lot employment is not ForHireOnce.
IsDuringWorkHours(Map)
Whether the given map's Time is during WorkHours, and not during OffWorkDays.
public bool IsDuringWorkHours(Map map)
Parameters
map
MapThe map whose time to use.
Returns
- bool
Whether the map's time is during work hours.
RemoveCurrentPeople(Map, Lot, Func<Person, bool>)
Removes all people that match the given predicate (or all people, if shouldRemove
is null), from this lot employment.
public void RemoveCurrentPeople(Map map, Lot employmentLot, Func<Person, bool> shouldRemove = null)