Table of Contents

Class LotEmployment

Namespace
TinyLife.World
Assembly
Tiny Life.dll

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<ActionType[]>, bool, int)

Creates a new lot employment with the given settings

public LotEmployment(string name, TextureRegion icon, (int Start, int End) workHours, Func<ActionType[]> actions, bool forHireOnce = false, int maxAmount = 1)

Parameters

name string

The lot employment's name

icon TextureRegion

The icon to use for this lot employment.

workHours (int Start, int End)

The lot employment's work hours.

actions Func<ActionType[]>

The Actions that lot employees should execute

forHireOnce bool

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(Map, Lot, bool).

maxAmount int

The maximum amount of people that can simultaneously be employed in this position.

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

Func<IEnumerable<ActionType>>

Babysitter

public static readonly LotEmployment Babysitter

Field Value

LotEmployment

Barista

public static readonly LotEmployment Barista

Field Value

LotEmployment

Bartender

public static readonly LotEmployment Bartender

Field Value

LotEmployment

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(Map, Lot, bool).

public readonly bool ForHireOnce

Field Value

bool

GymTrainer

public static readonly LotEmployment GymTrainer

Field Value

LotEmployment

Icon

The icon of this lot employment.

public readonly TextureRegion Icon

Field Value

TextureRegion

Librarian

public static readonly LotEmployment Librarian

Field Value

LotEmployment

MailCarrier

public static readonly LotEmployment MailCarrier

Field Value

LotEmployment

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

List<LotEmployment>

MaxAmount

The maximum amount of people that can simultaneously be employed in this position.

public readonly int MaxAmount

Field Value

int

MuseumCurator

public static readonly LotEmployment MuseumCurator

Field Value

LotEmployment

Name

The name of this lot employment

public readonly string Name

Field Value

string

TrashCollector

public static readonly LotEmployment TrashCollector

Field Value

LotEmployment

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

(int Start, int End)

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

Func<Person, ActionType, float>

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

Func<Person, MapObject, ObjectCategory, float>

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

float

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

ObjectCategory

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

TimeSpan

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

Func<LotEmployment.Instance, Person, bool>

OffWorkDays

A set of weekdays where work should not be done.

public DayOfWeek[] OffWorkDays { get; init; }

Property Value

DayOfWeek[]

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

Action<LotEmployment.Instance, Person>

Methods

AddCurrentPerson(Map, Lot, Person, 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, bool manual = true)

Parameters

map Map

The map

employmentLot Lot

The lot, or null if this is a map wide employment

person Person

The person to set, or null to remove the currently employed person.

manual bool

Whether this person was set manually (by a user) or automatically (using UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>)

Returns

bool

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 Map

The map that the employment is on.

employmentLot Lot

The lot, or null for a MapWideEmployments entry

Returns

IEnumerable<Person>

The person that currently works in this lot employment, or null if there is none

HireOnceForLot(Map, 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(Map map, Lot workLot, bool generateAdditional = true)

Parameters

map Map

The map to use.

workLot Lot

The lot to work at.

generateAdditional bool

Whether additional employees should be generated if none are free.

Returns

Person

The hired person, or null if no person could be hired.

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 Map

The 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)

Parameters

map Map

The map to remove people from.

employmentLot Lot

The lot, or null if this is a map wide employment

shouldRemove Func<Person, bool>

A predicate that checks whether a given person should be removed. If this is null, all people will be removed.