Table of Contents

Class Person

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

A person is a MapObject placed on a Map that represents a person. It stores its actions, clothes, data and movement.

public class Person : MapObject, IGenericDataHolder, IUpdatingObject
Inheritance
JsonTypeSafeGenericDataHolder
Person
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Person(Map, Vector2, float)

Creates a new person with the given settings. To create a new person externally, use Create(Map, Random, AgeGroup, bool, bool, bool, bool, Person[]).

[JsonConstructor]
protected Person(Map map, Vector2 position, float floor)

Parameters

map Map

The map.

position Vector2

The position.

floor float

The floor.

Fields

ActionQueue

The actions that are currently enqueued to be executed by this person. Each entry is the action that is enqueued along with a boolean value that represents whether this action should be force-started (true) or whether it should do the necessary checks (false). Use EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]) and CancelAction(Action, Action, bool) to modify this list.

[DataMember]
public readonly List<(Action, bool)> ActionQueue

Field Value

List<(Action, bool)>

AgeGroups

A set of all AgeGroup enum values that are explicitly defined.

public static readonly AgeGroup[] AgeGroups

Field Value

AgeGroup[]

AnimateHeldObject

Whether or not the GetHeldObject<T>(bool) should be animated with this person's movement animation. Note that this value is not saved to disk, and is reset to true every Update(GameTime, TimeSpan, float) frame.

public bool AnimateHeldObject

Field Value

bool

AnimationSpeed

The speed that this person's animation should run with. Note that this value is not saved to disk, and is reset to 1 every Update(GameTime, TimeSpan, float) frame.

public float AnimationSpeed

Field Value

float

CurrentActions

The actions that are currently being executed by this person. Use EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[]) and CancelAction(Action, Action, bool) to modify this list.

[DataMember]
public readonly List<Action> CurrentActions

Field Value

List<Action>

CurrentAgeDays

The amount of in-game days that this person has had their current Age for. See DaysLived for a full amount of days lived.

[DataMember]
public int CurrentAgeDays

Field Value

int

CurrentPose

This person's current Pose. Note that this value is reset to the GetDefaultPose(AgeGroup) for this person's Age every Update(GameTime, TimeSpan, float) frame.

[DataMember]
public Pose CurrentPose

Field Value

Pose

DaysLived

The amount of in-game days that this person has lived for in total. See CurrentAgeDays for the amount of days with their current Age.

[DataMember]
public int DaysLived

Field Value

int

DefaultWalkSpeed

The default walk speed for a person, which is used in GetWalkSpeed(), and additionally determines a person's animation speed.

public const float DefaultWalkSpeed = 0.05

Field Value

float

Description

This person's description

[DataMember]
public string Description

Field Value

string

DiaperDirty

Whether this person's diaper is dirty.

[DataMember(EmitDefaultValue = false)]
public bool DiaperDirty

Field Value

bool

EmotionModifiers

The EmotionModifier.Instance objects that are currently applied to this person. To access this collection efficiently, use AddEmotion(EmotionModifier, int, TimeSpan, IEmotionSource, bool), RemoveEmotion(EmotionModifier) and LowerEmotion(EmotionType, float, float).

[DataMember]
public readonly List<EmotionModifier.Instance> EmotionModifiers

Field Value

List<EmotionModifier.Instance>

FirstName

This person's first name

[DataMember]
public string FirstName

Field Value

string

HeldObjectRotation

The rotation that the GetHeldObject<T>(bool) should assume in this person's hand. If this value is set to null, the held object's rotation will be set to the person's Rotation. Note that this value is not saved to disk, and is reset to null every Update(GameTime, TimeSpan, float) frame.

public Direction2? HeldObjectRotation

Field Value

Direction2?

IsDead

Stores whether this person is currently dead. For a person to die, use Die(DeathReason) or Enqueue(Person, DeathReason).

[DataMember]
public bool IsDead

Field Value

bool

IsInLabor

Whether this person is currently in labor. Note that, when a person is in labor, their PregnancyHoursRemaining have already reached 0.

[DataMember(EmitDefaultValue = false)]
public bool IsInLabor

Field Value

bool

Jobs

The jobs that this person currently has. Currently, multiple jobs are supported in-game, but not properly enforced, meaning if a person has multiple jobs whose work hours overlap, unexpected behaviors might occur. To modify this collection, please use AddJob(JobType, int) and RemoveJob(JobType) to raise the proper events.

[DataMember]
public readonly List<Job> Jobs

Field Value

List<Job>

LastBedSleptIn

The id of the last bed Furniture that this person has slept in, or Empty if no such bed exists

[DataMember(EmitDefaultValue = false)]
public Guid LastBedSleptIn

Field Value

Guid

LastName

This person's last name

[DataMember]
public string LastName

Field Value

string

LotEmployment

The LotEmployment.Instance that this person works in. If this value is non-null, it implicitly means that this person does not have a HomeLot or Household that they are a part of.

[DataMember(EmitDefaultValue = false)]
public LotEmployment.Instance LotEmployment

Field Value

LotEmployment.Instance

Memories

A set of Memory instances that this person currently has or tracks. To edit and query this collection easily, AddMemory<T>(MemoryType, ActionInfo, int, TimeSpan?)/>, GetMemories<T>(MemoryType) and GetTimeSinceMemory<T>(MemoryType, Func<T, bool>) can be used.

[DataMember]
[JsonConverter(typeof(Person.MemoriesConverter))]
public readonly Dictionary<string, HashSet<Memory>> Memories

Field Value

Dictionary<string, HashSet<Memory>>

Needs

This person's Need data. When this person is instantiated, all of their needs are gathered from Types automatically. To access this collection efficiently, use GetNeed(NeedType) and GetNeedPercentage(NeedType).

[DataMember]
public readonly Dictionary<string, Need> Needs

Field Value

Dictionary<string, Need>

Outfits

A list of the outfits that this person has, gathered by the CharacterCreator. Each outfit is a dictionary that matches a WornClothes item to its layer.

[DataMember]
[JsonConverter(typeof(Person.OutfitsConverter))]
public readonly List<Outfit> Outfits

Field Value

List<Outfit>

PersonalityTypes

The names of the PersonalityType values that this person has. To access this collection efficiently, use HasPersonality(PersonalityType).

[DataMember]
public readonly HashSet<PersonalityType> PersonalityTypes

Field Value

HashSet<PersonalityType>

PhoneColors

This person's mobile phone colors.

[DataMember]
public int[] PhoneColors

Field Value

int[]

PregnancyAbility

This person's PregnancyAbility.

[DataMember]
public PregnancyAbility PregnancyAbility

Field Value

PregnancyAbility

Projects

The Project instances that this person currently has. Use StartProject(Project), GetProject(string, string), GetProjects(string) and Remove() to modify this collection effectively.

[DataMember]
public readonly List<Project> Projects

Field Value

List<Project>

Pronouns

This person's pronouns.

[DataMember]
public string Pronouns

Field Value

string

Relationships

This person's Relationship data. To access this collection efficiently, use GetRelationship(Person, bool) and ChangeFriendship(Person, float).

[DataMember]
public readonly List<Relationship> Relationships

Field Value

List<Relationship>

Skills

This person's Skill data. To access this collection efficiently, use GetSkillLevel(SkillType) and GainSkill(SkillType, float, ActionInfo, float).

[DataMember]
public readonly Dictionary<string, Skill> Skills

Field Value

Dictionary<string, Skill>

SpeakSounds

All of the Microsoft.Xna.Framework.Audio.SoundEffect instances that a Person can use for speaking, which are returned in GetRandomSpeakSound(VoiceStyle, SpeakStyle, List<SoundEffect>, TimeSpan?). Mods can simply add to this collection to add new speak sounds.

public static readonly Dictionary<(VoiceStyle, SpeakStyle), List<SoundEffect>> SpeakSounds

Field Value

Dictionary<(VoiceStyle, SpeakStyle), List<SoundEffect>>

SpeakStyles

All defined SpeakStyle enum values.

public static readonly SpeakStyle[] SpeakStyles

Field Value

SpeakStyle[]

Tint

A color that this person should render with. Note that this value is not saved to disk, and is reset to null every Update(GameTime, TimeSpan, float) frame.

public Color? Tint

Field Value

Color?

VoicePitch

The pitch of this person's voice, used for speaking (Speak(SpeakStyle, float, float)). The voice pitch should be between -1 and 1, but the character creator only sets it between -0.5 and 0.5.

[DataMember]
public float VoicePitch

Field Value

float

VoiceStyle

The style of this person's voice, used for speaking (Speak(SpeakStyle, float, float)). Note that, if this person is a Child or Baby, the Child or Baby styles will be used regardless of this field's value.

[DataMember]
public VoiceStyle VoiceStyle

Field Value

VoiceStyle

VoiceStyles

All defined VoiceStyle enum values.

public static readonly VoiceStyle[] VoiceStyles

Field Value

VoiceStyle[]

WasInvitedIn

Whether this person was already invited in to their VisitingLot.

[DataMember(EmitDefaultValue = false)]
public bool WasInvitedIn

Field Value

bool

WornLayers

The ClothesLayer flags that represent what layers this person is currently wearing. Note that this value is reset to ~0 (every layer) every Update(GameTime, TimeSpan, float) frame. Setting this value to 0 (no layer) will also stop the Emote and GetHeldObject<T>(bool) from drawing.

[DataMember]
public ClothesLayer WornLayers

Field Value

ClothesLayer

Properties

Age

The AgeGroup that this person currently has.

public AgeGroup Age { get; set; }

Property Value

AgeGroup

AllActions

A concatenation of CurrentActions and ActionQueue that represents all actions that the current person has knowledge about

public IEnumerable<Action> AllActions { get; }

Property Value

IEnumerable<Action>

CurrentEmote

The Emote that this person is currently displaying. Use DisplayEmote(EmoteCategory, bool, float, float) to modify this property.

public Emote CurrentEmote { get; protected set; }

Property Value

Emote

CurrentMode

A property that returns the current IUpdatingObject.UpdateMode for this updating object. This property defaults to returning MajorIfActive. When moving updating objects between update modes (ie changing the return value), objects are moved automatically after the respective update is invoked. This means that update mode changes don't occur immediately. See the documentation for each IUpdatingObject.UpdateMode for more information.

public IUpdatingObject.UpdateMode CurrentMode { get; }

Property Value

IUpdatingObject.UpdateMode

CurrentOutfit

Returns the outfit that this person is currently wearing, which is the Outfits entry at the CurrentOutfitIndex.

public Outfit CurrentOutfit { get; }

Property Value

Outfit

CurrentOutfitIndex

The index of the outfit, in the Outfits list, that this person is currently wearing. To change this value, use SetCurrentOutfit(ClothesIntention) or SetCurrentOutfit(int).

[DataMember]
public int CurrentOutfitIndex { get; }

Property Value

int

CurrentRoomDecorativeRating

The decorative rating of the CurrentRoom, resulting from the DecorativeRating of the contained furniture

public int CurrentRoomDecorativeRating { get; }

Property Value

int

CurrentSpeakStyle

The current speak styles that speaking sounds are chosen from. Use Speak(SpeakStyle, float, float) to modify this property.

public SpeakStyle? CurrentSpeakStyle { get; protected set; }

Property Value

SpeakStyle?

DrawSize

The size, in draw space pixels, that a person's texture takes up.

public static Point DrawSize { get; }

Property Value

Point

Emotion

The EmotionType that this person currently has, resulting from their current EmotionModifiers

public EmotionType Emotion { get; }

Property Value

EmotionType

EmotionAmount

The total sum of all emotion modifiers that cause the current Emotion.

public int EmotionAmount { get; }

Property Value

int

FullName

This person's full name, which is a concatenation of their FirstName and LastName.

public string FullName { get; }

Property Value

string

FullNamePronouns

This person's full name and pronouns, which is a concatenation of their FullName, and their pronouns in parentheses.

public string FullNamePronouns { get; }

Property Value

string

HomeLot

The Lot that this household lives on. For exported households, this might be null.

public Lot HomeLot { get; }

Property Value

Lot

Household

The Household that this person is a part of

public Household Household { get; }

Property Value

Household

IsAllowedToDie

Returns whether this person is allowed to die. A person is allowed to die if they are an Adult or older, and if they're not pregnant.

public bool IsAllowedToDie { get; }

Property Value

bool

IsCurrentHousehold

A property that indicates whether or not this household is the same as CurrentHousehold

public bool IsCurrentHousehold { get; }

Property Value

bool

IsMoving

This property stores whether this person is currently moving. A person is considered moving when their Position has changed since the last update frame.

public bool IsMoving { get; protected set; }

Property Value

bool

IsPregnant

Whether this person is currently considered pregnant. This property returns true if PregnancyHoursRemaining is greater than 0 or if IsInLabor is true.

public bool IsPregnant { get; }

Property Value

bool

IsRegularVisitor

A property that computes whether this person is a regular visitor. A person is considered a regular visitor if they have no Household, but also have no LotEmployment, and are not dead (IsDead).

public bool IsRegularVisitor { get; }

Property Value

bool

Job

The Job that this person currently has.

[DataMember(EmitDefaultValue = false)]
[Obsolete("Use the new Jobs collection instead")]
public Job Job { get; protected set; }

Property Value

Job

LifeGoal

This person's current LifeGoal.Instance

public LifeGoal.Instance LifeGoal { get; set; }

Property Value

LifeGoal.Instance

LifeSpan

This person's LifeSpan, which is determined by PerSaveOptions and whether this person IsCurrentHousehold.

public LifeSpan LifeSpan { get; }

Property Value

LifeSpan

LotVisitCooldown

The amount of time that has to pass before this person can visit another lot. If VisitingLot is set using VisitLot(Lot), this value will be set to 2 hours or 4 hours of in-game time, based on whether the visited lot is their home lot or not.

[DataMember(EmitDefaultValue = false)]
public TimeSpan LotVisitCooldown { get; protected set; }

Property Value

TimeSpan

Money

The money that this household has, rounded by two digits after the decimal point

public float Money { get; set; }

Property Value

float

OccupiedFurniture

The set of Furniture and their occresponding ActionSpot that this person is currently occupying in some capacity. Note that this value is not saved to disk, and is cleared every Update(GameTime, TimeSpan, float) frame, unless Stay is set to true. To edit this value, use OccupyActionSpot(Furniture, ActionSpot, bool, Direction2?, bool).

public IEnumerable<(Furniture Furniture, ActionSpot Spot, bool Stay)> OccupiedFurniture { get; }

Property Value

IEnumerable<(Furniture Furniture, ActionSpot Spot, bool Stay)>

ParentInfo

Returns a ParentInfo for this object in its current context. By default, this method returns default, and Furniture returns a ParentInfo based on its current attachments.

public override ParentInfo ParentInfo { get; }

Property Value

ParentInfo

Portrait

The Microsoft.Xna.Framework.Graphics.RenderTarget2D that this person's portrait is rendered onto. This will automatically be updated and can be used for rendering of any kind.

public RenderTarget2D Portrait { get; }

Property Value

RenderTarget2D

PregnancyHoursRemaining

The amount of hours that this person will be pregnant for before they have a chance to start IsInLabor. To set this value, use SetPregnancyStatus(int, Guid, bool).

[DataMember(EmitDefaultValue = false)]
public float PregnancyHoursRemaining { get; }

Property Value

float

PregnancyPartner

The Id of the person that caused this person's current pregnancy, or Empty if this person is not pregnant, or became pregnant through means that don't involve a second party. To set this value, use SetPregnancyStatus(int, Guid, bool).

[DataMember(EmitDefaultValue = false)]
public Guid PregnancyPartner { get; }

Property Value

Guid

RandomlyGenerated

A property that stores whether this person has been randomly generated by invoking the Create(Map, Random, AgeGroup, bool, bool, bool, bool, Person[]) method with a nonnull Random.

[DataMember(EmitDefaultValue = false)]
public bool RandomlyGenerated { get; protected set; }

Property Value

bool

RecentActions

A set of Memory instances of the ActionDone types that this person has recently done. The last three or fewer instances of any given ActionType will be returned as part of this collection.

public IEnumerable<(ActionType Type, Memory Memory)> RecentActions { get; }

Property Value

IEnumerable<(ActionType Type, Memory Memory)>

RelationshipInterestingness

Returns the "interestingness" of this person's Relationships, which is the sum of the absolute values of all relationships' FriendLevel and RomanceLevel values. This can be used for sorting by how interesting a person is for keepign around rather than deleting.

public float RelationshipInterestingness { get; }

Property Value

float

Rotation

The MLEM.Misc.Direction2 that this person is currently facing in

public Direction2 Rotation { get; set; }

Property Value

Direction2

VisitingLot

The Lot that is currently being visited by this person, or null if they're not visiting a lot right now. A visited lot is a lot that was actively moved to using VisitLotAction, GoHomeAction or a similar action. To modify this value, use VisitLot(Lot).

public Lot VisitingLot { get; }

Property Value

Lot

VisualPosition

The visual position of this person, which is influenced by their Position and a visual override that can additionally be set using OccupyActionSpot(Furniture, ActionSpot, bool, Direction2?, bool). Note that this value is reset to Position every Update(GameTime, TimeSpan, float) frame. Also note that the visual position does not affect collision detection or most interactions.

public Vector2 VisualPosition { get; set; }

Property Value

Vector2

VisuallyOccupiedSpot

The ActionSpot and corresponding Furniture that this person is visually occupying in the OccupiedFurniture collection. If this tuple has no value, or any of its entries are null, this person is not visually occupying any of the spots. Note that this value is not saved to disk, and is reset to -1 every Update(GameTime, TimeSpan, float) frame, unless Stay is set to true. To edit this value, use OccupyActionSpot(Furniture, ActionSpot, bool, Direction2?, bool).

public (Furniture Furniture, ActionSpot Spot, bool Stay) VisuallyOccupiedSpot { get; }

Property Value

(Furniture Furniture, ActionSpot Spot, bool Stay)

Methods

AddEmotion(EmotionModifier, int, TimeSpan, IEmotionSource, bool)

Adds the given EmotionModifier with the given intensity and time

public virtual bool AddEmotion(EmotionModifier type, int amount, TimeSpan time, IEmotionSource source, bool increaseExisting = false)

Parameters

type EmotionModifier

The type of emotion to add

amount int

The intensity of the emotion to add

time TimeSpan

The amount of in-game time the emotion should last for

source IEmotionSource

The emotion source that caused this emotion. Supported objects include FurnitureType, ActionType, NeedType and more. May be null.

increaseExisting bool

Whether existing emotion modifiers of the same type should be increased by the given time and amount. If this is false, existing emotions get removed instead.

Returns

bool

Whether the emotion could be added or it was already applied. If increaseExisting is true, this method always returns true.

AddJob(JobType, int)

Adds an instance of the given JobType to this person's list of Jobs and raises the OnJobChanged event.

public virtual bool AddJob(JobType type, int level = 0)

Parameters

type JobType

The type of job to add.

level int

The level to start the job at, defaults to 0.

Returns

bool

Whether the job could be added. If this is false, then this person already has a job of the given type.

AddMemory<T>(MemoryType, ActionInfo, int, TimeSpan?)

Adds a Memory to the Memories list of this person.

public virtual T AddMemory<T>(MemoryType type, ActionInfo info, int toKeep = 0, TimeSpan? timeOccured = null) where T : Memory

Parameters

type MemoryType

The type of memory to add.

info ActionInfo

The action info to attach to this memory, or null to use FromSelf(Person).

toKeep int

An amount of memories of the given type to keep, also counting the newly added one. Oldest memories will be removed first.

timeOccured TimeSpan?

The time that this memory occured on, or null to use Time.

Returns

T

The added memory.

Type Parameters

T

CanApplyPersonality(PersonalityType)

Returns whether the given personality type can be applied to this person. The return value is determined by this person's existing PersonalityTypes and the personality type's AllowedAges and IsCompatible(PersonalityType) value.

public virtual bool CanApplyPersonality(PersonalityType type)

Parameters

type PersonalityType

Returns

bool

Whether the personality type can apply to this person.

CanExecuteAction(ActionType, ActionInfo, bool)

Returns the given action type's CanExecute delegate's result and also checks additional conditions like RequiredSkill, RequiredEmotion, CanExecuteAction and CanExecuteAction(ActionType, ActionInfo, bool, bool). This method additionally catches and handles any exceptions by printing them out as a Notifications notification to the player.

public virtual CanExecuteResult CanExecuteAction(ActionType type, ActionInfo info, bool automatic)

Parameters

type ActionType

The action to execute.

info ActionInfo

The action info

automatic bool

Whether the action is automatically executed

Returns

CanExecuteResult

A CanExecuteResult that represents whether the action can be executed right now

CancelAction(Action, Action, bool)

Tries to cancel the given action, removing it from CurrentActions or ActionQueue in the process. If the action in question cannot be canceled, this method returns false.

public virtual bool CancelAction(Action action, Action cancelSource = null, bool force = false)

Parameters

action Action

The action to cancel

cancelSource Action

The action that is responsible for this cancelation, or null by default

force bool

Whether to cancel the action even if CanCancel(Action) returns false

Returns

bool

Whether the action could be canceled successfully

ChangeFriendship(Person, float)

Changes the FriendLevel Relationship wit the given person by the given amount. Additionally, a friendship Particle is displayed and a Notifications is displayed if the friendship type changes.

public virtual void ChangeFriendship(Person person, float amount)

Parameters

person Person

The person to change friendship with

amount float

The amount to change friendship by, can be negative

ChangeRomance(Person, float)

Changes the RomanceLevel Relationship wit the given person by the given amount. Additionally, a romance Particle is displayed.

public virtual void ChangeRomance(Person person, float amount)

Parameters

person Person

The person to change romance with

amount float

The amount to change romance by, can be negative

Create(Map, Random, AgeGroup, bool, bool, bool, bool, Person[])

Creates a new person with the given settings, optionally randomly generating the returned person's FirstName, LastName, Age, Outfits and more.

public static Person Create(Map map, Random random, AgeGroup allowedAges = (AgeGroup)-1, bool markRandomlyGenerated = true, bool initializeName = true, bool initializePersonality = true, bool generateMultipleOutfits = true, Person[] geneticInfluences = null)

Parameters

map Map

The map to create the person for.

random Random

The Random instance to use for generating the person.

allowedAges AgeGroup

A set of AgeGroup flags that the person is allowed to have.

markRandomlyGenerated bool

Whether to mark the person as RandomlyGenerated.

initializeName bool

Whether to initialize the person's FirstName, LastName and Pronouns.

initializePersonality bool

Whether to initialize the person's PersonalityTypes.

generateMultipleOutfits bool

Whether to generate multiple outfits, rather than just one default one.

geneticInfluences Person[]

A set of people that count as genetic influences, from which hair, eye and skin colors will randomly be chosen.

Returns

Person

The generated person.

DepleteNeed(NeedType, float, float)

Depletes this person's Need with the given NeedType by the given amount Note that, when the "NoNeed" cheat is active, this method does nothing.

public virtual void DepleteNeed(NeedType type, float amount, float speedMultiplier)

Parameters

type NeedType

The type of need to deplete

amount float

The amount to deplete the need by, out of Max.

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Die(DeathReason)

Causes this person to die, removing it from the world and optionally spawning a Gravestone.

public virtual bool Die(DeathReason reason)

Parameters

reason DeathReason

The reason for this person's death

Returns

bool

DisplayEmote(EmoteCategory, bool, float, float)

Causes this person to display a Emote over its head for 1 to 3 seconds

public virtual void DisplayEmote(EmoteCategory possibleCategories, bool thought, float minimumSeconds = 1, float maximumSeconds = 3)

Parameters

possibleCategories EmoteCategory

A combined flag that represents the categories to pick emotes from

thought bool

Whether the emote should be a thought bubble, rather than a speech bubble.

minimumSeconds float

The minimum amount of real-time seconds that the emote should be displayed for, or 1 by default

maximumSeconds float

The maximum amount of real-time seconds that the emote should be displayed for, or 3 by default

DisplayEmoteAndSpeak(EmoteCategory, SpeakStyle?, float, float)

This is a combined helper method that invokes DisplayEmote(EmoteCategory, bool, float, float) and optionally Speak(SpeakStyle, float, float) together. Since both methods choose a random amount of time for their actions independently, the emote display might end at a different time than the speaking sound.

public virtual void DisplayEmoteAndSpeak(EmoteCategory emoteCategories, SpeakStyle? speakStyles, float minimumSeconds = 1, float maximumSeconds = 3)

Parameters

emoteCategories EmoteCategory

The emote categories to choose from, can be a combined flag-

speakStyles SpeakStyle?

The speak styles to choose from, can be a combined flag. If this is null, the displayed emote will be a thought.

minimumSeconds float

The minimum amount of time, in seconds, to speak and display the emote for

maximumSeconds float

The maximum amount of time, in seconds, to speak and display the emote for

Draw(GameTime, object, Vector2, Color?, List<Item>)

Draws this object on the current Map, at the current Position. To draw a map object while invoking all the required events, use DoDraw(GameTime, object, Color?, bool, List<Item>).

public override void Draw(GameTime time, object batch, Vector2 _, Color? overrideColor, List<StaticSpriteBatch.Item> items)

Parameters

time GameTime

The current time

batch object

The sprite batch to use for drawing, which is either a Microsoft.Xna.Framework.Graphics.SpriteBatch or MLEM.Graphics.StaticSpriteBatch.

_ Vector2
overrideColor Color?

The color that should be used instead of this object's actual color. If null, the object's regular color should be used.

items List<StaticSpriteBatch.Item>

A list of sprite batch items that items should be added to if the batch is a MLEM.Graphics.StaticSpriteBatch.

DrawLooks(SpriteBatch, Vector2, Vector2, float, ParentInfo, Color?, float)

Draws this person's looks in the world, which includes their clothes and shadow by default.

protected virtual void DrawLooks(SpriteBatch batch, Vector2 drawPos, Vector2 depthPos, float floor, ParentInfo parent, Color? overrideColor = null, float scale = 1)

Parameters

batch SpriteBatch

The sprite batch to use for drawing.

drawPos Vector2

The draw position in screen space.

depthPos Vector2

The position to use for calculating depth.

floor float

The floor to draw on.

parent ParentInfo

This person's parent info.

overrideColor Color?

An override color to use instead of this person's default colors.

scale float

The scale to draw with.

DrawUi(SpriteBatch, Vector2, Direction2, float, Outfit, Pose, AgeGroup)

Draws a person with the given Outfit in ui space.

public static void DrawUi(SpriteBatch batch, Vector2 pos, Direction2 rotation, float scale, Outfit outfit, Pose pose, AgeGroup age)

Parameters

batch SpriteBatch

The sprite batch to use for drawing.

pos Vector2

The ui space position to use for drawing.

rotation Direction2

The rotation the person should have when being drawn.

scale float

The scale to draw with.

outfit Outfit

The outfit to draw.

pose Pose

The pose to draw.

age AgeGroup

The age to draw with.

DrawUi(SpriteBatch, Vector2, float, Direction2)

Renders this person on a ui level rather than a world level

public virtual void DrawUi(SpriteBatch batch, Vector2 pos, float scale, Direction2 rotation = Direction2.Right)

Parameters

batch SpriteBatch

The sprite batch to use for drawing

pos Vector2

The position, in screen space, to draw at

scale float

The scale to draw with

rotation Direction2

The rotation that this person should be drawn with. Defaults to MLEM.Misc.Direction2.Right.

EarnMoney(float, object)

Causes this person's Money to be increased, but additionally triggers the EarnMoney AmountGoal. This method should only be used if the money is earned in a "manual" way, like when selling a homemade painting or publishing a book.

public virtual void EarnMoney(float money, object triggerObject)

Parameters

money float

The money to earn.

triggerObject object

The object that caused the money to be earned, which is passed to Trigger(IGoalTriggerable, object, GoalTrigger, params object[]). Note that this needs to be compatible with the EarnMoney's ValidObjects.

EnqueueAction<T>(ActionType, ActionInfo, bool, bool, bool, params ActionArgument[])

Enqueues the given action into ActionQueue to be executed later.

public virtual T EnqueueAction<T>(ActionType type, ActionInfo info, bool automatic, bool priority = false, bool force = false, params ActionArgument[] chosenArguments) where T : Action

Parameters

type ActionType

The type of action to enqueue

info ActionInfo

The action information

automatic bool

Whether this action is considered to have started automatically (or invoked by a player)

priority bool

Whether to add this action to the start of the action queue rather than the end

force bool

Whether to start the action even if CanExecute returns false

chosenArguments ActionArgument[]

The arguments for the action to start, or an empty array or null if this action has no arguments, or if a random set of arguments should be chosen

Returns

T

The created action, or null if the action cannot be executed or the maximum amount of entries in the ActionQueue is reached.

Type Parameters

T

FaceObject(MapObject, ActionSpot)

A utility method that causes this person> to face in the direction of the given obj (and optionally its specific ActionSpot). This method returns false if this person is occupying a furniture object, or if they're standing in the same location as the obj.

public bool FaceObject(MapObject obj, ActionSpot spot = null)

Parameters

obj MapObject
spot ActionSpot

Returns

bool

Whether it was possible to face in the object's direction.

~Person()

protected ~Person()

FocusCameraOnEvent(bool, bool)

A helper method that causes the game camera to focus on this person if it is relevant. This person is considered relevant if its Household is current or if the CurrentLot is visible to the CurrentHousehold.

public virtual bool FocusCameraOnEvent(bool onlyIfImportant, bool switchToMap = true)

Parameters

onlyIfImportant bool

Whether only Tinies that are considered important should be focused on. An important Tiny is one that at least one person in the currently active household knows.

switchToMap bool

Whether the camera should be switched to this person's Map.

Returns

bool

GainSkill(SkillType, float, ActionInfo, float)

Causes this person to gain the skill with the given SkillType and raises it by the given amount. Note that PersonalityTypes influence the skinn gain automatically.

public virtual bool GainSkill(SkillType type, float amount, ActionInfo info, float speedMultiplier)

Parameters

type SkillType

The type of skill to gain

amount float

The amount of skill points to gain

info ActionInfo

An optional action info whose GetInvolvedObjects<T>(ObjectCategory, bool, bool) can influence the efficiency

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Returns

bool

GenerateAnimationGroup(ClothesLayer, int, IReadOnlyDictionary<Point, TextureRegion>, Point)

Generates a MLEM.Animations.SpriteAnimationGroup for the given settings. This method is called in SetAnimationsFromLooks() for each clothes layer, as well as this person's shadow.

protected virtual SpriteAnimationGroup GenerateAnimationGroup(ClothesLayer clothesLayer, int layerAmount, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion)

Parameters

clothesLayer ClothesLayer

The clothes layer.

layerAmount int

The amount of layers the clothing item has.

textures IReadOnlyDictionary<Point, TextureRegion>

The textures to use.

textureRegion Point

The initial texture region to use.

Returns

SpriteAnimationGroup

The generated MLEM.Animations.SpriteAnimationGroup.

GetAction<T>(Guid, bool)

Returns the action in this person's AllActions set whose Id matches the given id and the given type T.

public T GetAction<T>(Guid id, bool regardChildren = false) where T : Action

Parameters

id Guid

The id of the action to query.

regardChildren bool

Whether child actions should be queried. If this is true, GetChild<T>(Guid, bool) is used.

Returns

T

The action with the given id and type T, or null if none are found.

Type Parameters

T

The type of action to find and return.

GetAiPriorityForObject(MapObject, ObjectCategory)

Returns the AI priority for the given obj and the given categories. This method checks the GetAiPriority(Person, ObjectCategory) method, as well as any LotEmployment-speciifc AI priorities, and invokes the OnGetAiPriorityForObject event.

public virtual float GetAiPriorityForObject(MapObject obj, ObjectCategory categories)

Parameters

obj MapObject

The object.

categories ObjectCategory

The categories.

Returns

float

The AI priority for the object.

GetCategories(Person)

Returns a set of ObjectCategory flags that this object has, based on the given Person.

public override ObjectCategory GetCategories(Person person)

Parameters

person Person

The person to query categories for

Returns

ObjectCategory

A set of categories that this object has

GetCurrentGoals()

Returns a set of GoalSet objects that this person is currently working on. To add more current goals, use OnGetCurrentGoals.

public virtual List<IGoalTriggerable> GetCurrentGoals()

Returns

List<IGoalTriggerable>

This person's current goals

GetDebugLines(GameImpl, List<string>)

Returns the debug lines that should be displayed in Debug when hovering over this object. By default, OnGetDebugLines is invoked, and the id and position of this object are appended to the list of lines.

public override void GetDebugLines(GameImpl game, List<string> lines)

Parameters

game GameImpl

The game.

lines List<string>

The list of lines to append debug lines to.

GetEfficiencyModifier(float, ActionInfo, SkillType, float)

Returns a multiplier (which will be close to 1) of how "efficiently" this person currently works and moves. This value is influenced by the speedMultiplier, the level of the passed skill as well as this person's Emotion and PersonalityTypes.

public virtual float GetEfficiencyModifier(float speedMultiplier = 1, ActionInfo info = null, SkillType skill = null, float levelModifier = 0.1)

Parameters

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

info ActionInfo

An optional action info whose GetInvolvedObjects<T>(ObjectCategory, bool, bool) can influence the efficiency

skill SkillType

A skill that optionally influences the efficiency

levelModifier float

The amount that each skill level should influence the efficiency by. Defaults to 0.1.

Returns

float

The person's efficiency, which is a value close to or equal to 1

GetEmotionSkillBoost(SkillType)

Returns a modifier that skills with the given SkillType should be boosted by, based on this person's current Emotion. This method is used by GetEfficiencyModifier(float, ActionInfo, SkillType, float), and is also used to display the emotion image in the skills menu.

public virtual float GetEmotionSkillBoost(SkillType skill)

Parameters

skill SkillType

Returns

float

GetFreeActionSpotInfo(Person, ObjectCategory)

Returns the first free action spot, packed into an ActionInfo.

public override ActionInfo GetFreeActionSpotInfo(Person person, ObjectCategory context = null)

Parameters

person Person

The person to query free action spots for

context ObjectCategory

The object category that this action spot needs to have

Returns

ActionInfo

The first free action spot as an ActionInfo

GetFreeTalkingSpots(Person)

Returns a set of locations, in world space, that this person can be talked to from while standing in its current location

public virtual IEnumerable<Vector2> GetFreeTalkingSpots(Person person)

Parameters

person Person

Returns

IEnumerable<Vector2>

A set of free talking spots

GetHeldActionInfo()

Returns a ActionInfo for the GetHeldObject<T>(bool), or null if there is none. Note that, if the held object is marked as being fake, this method also returns null.

public virtual ActionInfo GetHeldActionInfo()

Returns

ActionInfo

The held action info.

GetHeldItemDepthOffset()

Returns this person's held item's depth offset, which is used by ParentInfo for drawing.

public virtual float GetHeldItemDepthOffset()

Returns

float

This person's held item's depth offset.

GetHeldItemDrawOffset(bool)

Returns this person's held item's draw offset, which is used by ParentInfo for drawing.

public virtual Vector2 GetHeldItemDrawOffset(bool includeItemOffsets)

Parameters

includeItemOffsets bool

Returns

Vector2

This person's held item's draw offset.

GetHeldObject<T>(bool)

Returns the Furniture that this person is currently holding in their hands, which will always be on the same map as this person's Map. Note that, if the held object is not of the required type T, null is returned.

public virtual T GetHeldObject<T>(bool alsoReturnFake = true) where T : MapObject

Parameters

alsoReturnFake bool

Returns

T

The held furniture

Type Parameters

T

The type that the held furniture is expected to have

GetHoverInfo(Tooltip)

Allows adding a set of paragraphs and other ui elements to the given tooltip, which is then displayed when this object is hovered over using the cursor in the world. By default, this method raises OnGetHoverInfo for MapObject, and adds additional information for Furniture and Person.

public override void GetHoverInfo(Tooltip tooltip)

Parameters

tooltip Tooltip

The tooltip that will be displayed.

GetMemories<T>(MemoryType)

Returns all Memory instances that this person currently tracks that match the given MemoryType.

public virtual IEnumerable<T> GetMemories<T>(MemoryType type) where T : Memory

Parameters

type MemoryType

The memory type to match.

Returns

IEnumerable<T>

The memories of the given type.

Type Parameters

T

GetMemories<TKey, TMem>(IDictionary<TKey, MemoryType>)

Returns all Memory instances that this person currently tracks that match the given set of MemoryType.

public virtual IEnumerable<(TKey Key, TMem Memory)> GetMemories<TKey, TMem>(IDictionary<TKey, MemoryType> types) where TMem : Memory

Parameters

types IDictionary<TKey, MemoryType>

The memory types to match.

Returns

IEnumerable<(TKey Key, TMem Memory)>

The memories of the given types.

Type Parameters

TKey
TMem

GetNeed(NeedType)

Returns the Need Value of the given type for this person

public float GetNeed(NeedType type)

Parameters

type NeedType

The type of need that should be returned

Returns

float

This person's need value

GetNeedPercentage(NeedType)

Returns the Need Percentage of the given type for this person

public float GetNeedPercentage(NeedType type)

Parameters

type NeedType

The type of need that should be returned

Returns

float

This person's need percentage

GetPassiveActionPriority(ActionType)

Returns the passive priority for the given ActionType. This method evaluates the action's own PassivePriority and adds additional factors like Extroverted and Introverted modifiers for social actions. You can use OnGetPassiveActionPriority to change the return value of this method.

public virtual float GetPassiveActionPriority(ActionType type)

Parameters

type ActionType

The type of action to get the passive priority for

Returns

float

The action's passive priority

GetPersonalitySkillBoost(SkillType)

Returns a modifier that skills with the given SkillType should be boosted by, based on this person's PersonalityTypes. This method is used by GetEfficiencyModifier(float, ActionInfo, SkillType, float).

public virtual float GetPersonalitySkillBoost(SkillType skill)

Parameters

skill SkillType

The skill category whose personality skill boost to return

Returns

float

A modifier that skills should be boosted by

GetPivot()

Returns this person's screen-space pivot position, based on the current animation frame.

public virtual Vector2 GetPivot()

Returns

Vector2

This person's screen-space pivot position.

GetProject(string, string)

Returns a project of the given Type with the given Name.

public Project GetProject(string type, string name)

Parameters

type string

The Type of the project to return

name string

The Name of the project to return

Returns

Project

The matching project, or null if there is none

GetProjects(string)

Returns all of the projects of the given Type that this person has. To access all projects regardless of type, iterate the Projects list instead.

public IEnumerable<Project> GetProjects(string type)

Parameters

type string

The Type of project to return

Returns

IEnumerable<Project>

A set of projects that match the given type

GetRandomOutfit(ClothesIntention)

Returns the index of the Outfits collection that best matches the given ClothesIntention.

public virtual int GetRandomOutfit(ClothesIntention intention)

Parameters

intention ClothesIntention

The intention to match the best outfit to.

Returns

int

The index in the Outfits collection that best matches the intention, or -1 there is no match.

GetRandomSpeakSound(VoiceStyle, SpeakStyle, List<SoundEffect>, TimeSpan?)

Returns a random sound effect which is a speak sound that matches any of the given SpeakStyle flag values

public static SoundEffect GetRandomSpeakSound(VoiceStyle voice, SpeakStyle style, List<SoundEffect> avoid = null, TimeSpan? maxLength = null)

Parameters

voice VoiceStyle

The VoiceStyle to use.

style SpeakStyle

The styles to chooose sounds from, can be a combined flag

avoid List<SoundEffect>

A list of sounds that will not be chosen from, even if they match the passed styles

maxLength TimeSpan?

The maximum length for the returned sound effect to have, or null to return sounds of any length

Returns

SoundEffect

A random sound effect that matches the given properties

GetRelationship(Person, bool)

Returns the current relationship level for the given Person. Note that this returns this person's Relationships entry, which might have different values from the passed Person's.

public Relationship GetRelationship(Person person, bool initialize)

Parameters

person Person

The person to get relationship values for

initialize bool

Whether a new relationship should be added to the relationships menu if no relationship exists yet

Returns

Relationship

The relationship, or null if there is none and initialize is false

GetSkill(SkillType, bool)

Returns the Skill instance that this person has for the given SkillType. If this person does not have the skill yet, and initialize is false or the skill's RequiredAges don't match this person's Age, null is returned.

public virtual Skill GetSkill(SkillType type, bool initialize)

Parameters

type SkillType

The type of skill to query.

initialize bool

Whether the skill should be added if it doesn't exist already.

Returns

Skill

The skill instance, or null if this person doesn't have the skill yet, and initialize is false or the skill's RequiredAges don't match this person's Age.

GetSkillLevel(SkillType)

Returns the level of the Skill of the given type that this person has. If this person does not have the given skill, 0 is returned.

public int GetSkillLevel(SkillType type)

Parameters

type SkillType

The type of skill to query

Returns

int

The person's skill level

GetSkillPointPercentage(SkillType)

Returns the percentage that this person has in the given skill's current level. This is a shorthand for PointPercentage.

public float GetSkillPointPercentage(SkillType type)

Parameters

type SkillType

The type of skill to query

Returns

float

The person's skill point percentage

GetSkillTotalPercentage(SkillType)

Returns the total skill level percentage of the given skill for this person. This is a shorthand for TotalPercentage.

public float GetSkillTotalPercentage(SkillType type)

Parameters

type SkillType

The type of skill to query

Returns

float

The person's total skill level percentage

GetTimeSinceMemory<T>(MemoryType, Func<T, bool>)

Returns the time since a memory of the given MemoryType has occured. If there are multiple memories of the given type, the minimum time is returned. If there is no memory of the given type, null is returned.

public virtual TimeSpan? GetTimeSinceMemory<T>(MemoryType type, Func<T, bool> condition = null) where T : Memory

Parameters

type MemoryType

The memory type to query.

condition Func<T, bool>

An additional condition to determine whether memories should be included in the search.

Returns

TimeSpan?

The time since the given memory type.

Type Parameters

T

GetTimeSinceMemory<T>(params MemoryType[])

Returns the time since a memory of one of the given MemoryType values has occured. If there are multiple memories that match the given types, the minimum time is returned. If there is no memory of any of the given types, null is returned.

public virtual TimeSpan? GetTimeSinceMemory<T>(params MemoryType[] types) where T : Memory

Parameters

types MemoryType[]

The memory types to query.

Returns

TimeSpan?

The time since the given memory type.

Type Parameters

T

GetValidClothes(ClothesLayer)

Returns the clothes from the Types registry that match the given ClothesLayer that this person can wear, based on their Age and other factors.

public virtual IEnumerable<Clothes> GetValidClothes(ClothesLayer layer)

Parameters

layer ClothesLayer

The layer

Returns

IEnumerable<Clothes>

The clothes that match

GetWalkSpeed()

Returns this person's current walk speed, per update frame. The walk speed is influenced by their PersonalityTypes and Emotion.

public virtual float GetWalkSpeed()

Returns

float

The walk speed

GoToExitRoad(Vector2)

Teleports this person to the nearest exit road using GetClosestFreeExitPoint(Vector2).

public virtual void GoToExitRoad(Vector2 closestPosition)

Parameters

closestPosition Vector2

GoToRandomHomeLocation()

Causes this person to teleport to a random location close to their HomeLot's home location (GetHomeLocation(Person)). Note that this method expects this person's Map to be the same as the HomeLot's Map.

public virtual void GoToRandomHomeLocation()

HasEmotionModifier(EmotionModifier)

Returns whether this person has the given EmotionModifier in their EmotionModifiers list

public bool HasEmotionModifier(EmotionModifier type)

Parameters

type EmotionModifier

The type of emotion modifier to query

Returns

bool

Whether the emotion modifier is active

HasHouseholdMember(Guid)

Returns whether the given person Id is a part of this household

public bool HasHouseholdMember(Guid person)

Parameters

person Guid

The unique id of the person to query

Returns

bool

true if the person is part of this household, false otherwise

HasHouseholdMember(Person)

Returns whether the given person Id is a part of this household

public bool HasHouseholdMember(Person person)

Parameters

person Person

The unique id of the person to query

Returns

bool

true if the person is part of this household, false otherwise

HasPersonality(PersonalityType)

Returns whether this person has the given PersonalityType

public bool HasPersonality(PersonalityType type)

Parameters

type PersonalityType

The personality type to query

Returns

bool

true if this person has this personality type, false otherwise

HasRecentlyFailed(ActionType, float)

Returns whether an action of the given type has recently failed for this person. A failed action is one that has returned the Failed completion type in its IsCompleted() method.

public virtual bool HasRecentlyFailed(ActionType type, float hours = 1)

Parameters

type ActionType

The action type to query.

hours float

The amount of hours that have to have passed since the last failure (if there is one) for this method to return false. Defaults to 1.

Returns

bool

Whether the given action type has recently failed.

HasSkillLevel(SkillType, int)

Returns whether this person has a Skill of the given type and whether its value is high enough.

public bool HasSkillLevel(SkillType type, int level)

Parameters

type SkillType

The type of skill to query

level int

The level that the skill has to be

Returns

bool

true if the person has this skill level, false otherwise

ImportAtExitRoad(Map)

Imports this person at a nearby exit road, additionally validating them, setting a new Id for them and adding them to the given map.

public virtual void ImportAtExitRoad(Map map)

Parameters

map Map

The map to import on.

InitializeAction(Action)

A method that is called by this person's Update(GameTime, TimeSpan, float) method when an action from the ActionQueue is moved to CurrentActions. By default, this method raises the OnActionInitialized event and calls Initialize().

protected virtual void InitializeAction(Action action)

Parameters

action Action

The action.

Intersects(RectangleF)

Returns whether this map object intersects with the given rectangle. This is used for GetObjects<T>(RectangleF)

public override bool Intersects(RectangleF rectangle)

Parameters

rectangle RectangleF

The area that should be checked for

Returns

bool

true if this object intersects with the given rectangle

IsCloseForTalking(Vector2, float)

Returns true if pos is considered close enough for talking. For a person to be close enough for talking, they have to be at least 0.25 and at most 2.5 tiles away and in the same Room.

public virtual bool IsCloseForTalking(Vector2 pos, float floor)

Parameters

pos Vector2

The position of the person to query closeness for

floor float

The floor that the other person is on.

Returns

bool

Whether the person is close enough to talk to

IsIdMatch(Guid)

Returns whether this person's Id or any entry in their ID history (SetNewId(Map, IEnumerable<Person>, IEnumerable<Furniture>)) matches the Guid passed. To compare whether two people are an ID match, use IsIdMatch(Person).

public bool IsIdMatch(Guid id)

Parameters

id Guid

The id to compare this person's ids to

Returns

bool

Whether any of this person's id match

IsIdMatch(Person)

Returns whether this person and the other person have matching Id values or whether their ID histories (SetNewId(Map, IEnumerable<Person>, IEnumerable<Furniture>)) overlap. If this method returns two, this person and the other person can be considered the same person to a certain degree, as it means that they are copies of each other, or copies of the same person.

public bool IsIdMatch(Person other)

Parameters

other Person

The person to compare this person to

Returns

bool

Whether this person and the passed person have matching ids

LowerEmotion(EmotionType, float, float)

Lowers any EmotionModifiers of the given EmotionType by the given percentage. Each modifier's Time will be lowered by the percentage of their TotalTime.

public virtual bool LowerEmotion(EmotionType type, float percentage, float speedMultiplier = 1)

Parameters

type EmotionType

The type of emotion to lower

percentage float

The percentage to lower the emotion by

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Returns

bool

Whether the emotion could be lowered, or this person had no emotion modifiers of the given type

LowerEmotionModifier(EmotionModifier, float, float)

Lowers the specified emotion modifier by the specified percentage. This differs from LowerEmotion(EmotionType, float, float) in that only the specific modifier is lowered.

public virtual bool LowerEmotionModifier(EmotionModifier modifier, float percentage, float speedMultiplier = 1)

Parameters

modifier EmotionModifier

The emotion modifier to lower

percentage float

The percentage to lower the emotion by

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Returns

bool

Whether the emotion could be lowered, or this person had no emotion modifiers of the given type

MoveToMap(Map, Vector2, float)

Moves this object to the given map, changing the current Map in the process.

public override bool MoveToMap(Map map, Vector2 position, float floor)

Parameters

map Map

The map to move to.

position Vector2

The position on the new map to move to.

floor float

The floor to move to.

Returns

bool

Whether moving to the map was successful, which is false if this object is already on the map.

MoveToMapExitRoad(Map, Vector2)

Causes this person to move to the given map and sets their position to a free exit road closest to the closestPosition.

public virtual bool MoveToMapExitRoad(Map map, Vector2 closestPosition)

Parameters

map Map

The map to move to.

closestPosition Vector2

The position that the exit road should be closest to.

Returns

bool

Whether moving this person was successful. Returns the return value of MoveToMap(Map, Vector2, float).

OccupyActionSpot(Furniture, ActionSpot, bool, Direction2?, bool)

Causes the given action spot of the given furniture to be marked as occupied. Optionally, the VisualPosition can also be changed, causing this person to look as if they were sitting, standing or laying on the furniture. Note that the values set in this method are reset every Update(GameTime, TimeSpan, float) call if stayOccupied is false. To exit an action spot that was marked as stayOccupied, this method can be called with furniture and/or spot set to null.

public virtual void OccupyActionSpot(Furniture furniture, ActionSpot spot, bool visual = false, Direction2? rotation = null, bool stayOccupied = false)

Parameters

furniture Furniture

The furniture to occupy.

spot ActionSpot

The action spot to occupy on the furniture.

visual bool

Whether or not the visual position should be updated to enter the spot, causing VisuallyOccupiedSpot to contain the given furniture and spot. Note that, when furniture or spot is null, this value has no effect.

rotation Direction2?

The rotation that this person should get, or null to use the spot's default rotation.

stayOccupied bool

Whether this person should continue to occupy this action spot after the current update frame is over.

OccupyFreeActionSpot(ActionInfo, ObjectCategory, bool, Direction2?, bool)

This is a shorthand method for OccupyFreeActionSpot(Furniture, ObjectCategory, bool, Direction2?, bool) Note that this method needs to be called every update frame for the person to keep occupying the action spot.

public virtual bool OccupyFreeActionSpot(ActionInfo info, ObjectCategory context = null, bool visual = false, Direction2? rotation = null, bool stayOccupied = false)

Parameters

info ActionInfo

The action info whose action object to occupy.

context ObjectCategory

The category that the action spot should have

visual bool

Whether or not the action spot should be entered visually.

rotation Direction2?

The rotation that the person should have, or the action spot's rotation by default

stayOccupied bool

Whether this person should continue to occupy this action spot after the current update frame is over.

Returns

bool

Whether or not we were able to occupy a free action spot

OccupyFreeActionSpot(Furniture, ObjectCategory, bool, Direction2?, bool)

This is a shorthand method for GetFreeActionSpot(Person, ObjectCategory) and OccupyActionSpot(Furniture, ActionSpot, bool, Direction2?, bool). Note that this method needs to be called every update frame for the person to keep occupying the action spot.

public virtual bool OccupyFreeActionSpot(Furniture furniture, ObjectCategory context = null, bool visual = false, Direction2? rotation = null, bool stayOccupied = false)

Parameters

furniture Furniture

The furniture whose object spot to occupy

context ObjectCategory

The category that the action spot should have

visual bool

Whether or not the action spot should be entered visually.

rotation Direction2?

The rotation that the person should have, or the action spot's rotation by default

stayOccupied bool

Whether this person should continue to occupy this action spot after the current update frame is over.

Returns

bool

Whether or not we were able to occupy a free action spot

OnActionCompleted(Action, CompletionType)

A method that is called in this person's Update(GameTime, TimeSpan, float) when an Action completes. By default, this method does multiple things, including raising the OnActionsCompleted event and calling OnCompleted(CompletionType), as well as multiple things related to specific action results, like adding PersonalityType-based emotions.

protected virtual void OnActionCompleted(Action action, CompletionType completion)

Parameters

action Action
completion CompletionType

OnAgeChanged(AgeGroup)

A method that is called by Age.set when this person's Age has just changed. Their previous age is stored in lastAge.

protected virtual void OnAgeChanged(AgeGroup lastAge)

Parameters

lastAge AgeGroup

This person's previous age.

OnCameraRotationChanged(Direction2, Direction2)

This method is invoked when the game's camera rotation changes. Additionally, the old and new rotations are passed.

public override void OnCameraRotationChanged(Direction2 oldRotation, Direction2 newRotation)

Parameters

oldRotation Direction2

The old camera rotation

newRotation Direction2

The new camera rotation

PrepareForPermanentRemoval()

Prepares this person for permanent removal, which includes removing all references to this person from other people's Relationships. This method should only be called when a person is about to be irrevocably deleted.

public virtual void PrepareForPermanentRemoval()

RemoveEmotion(EmotionModifier)

Removes the given EmotionModifier from this person's EmotionModifiers

public virtual bool RemoveEmotion(EmotionModifier type)

Parameters

type EmotionModifier

The type of emotion to remove

Returns

bool

Whether the emotion could be removed (or wasn't contained in the first place)

RemoveHeldObject<T>()

Removes this person's held object from the world and returns it.

public virtual T RemoveHeldObject<T>() where T : MapObject

Returns

T

The held object that was removed, or null if it did not match, or there was none.

Type Parameters

T

The type of object to remove. If this person's held object does not match, it is not removed.

RemoveJob(JobType)

Removes instances of the given JobType from this person's list of Jobs and raises the OnJobChanged event.

public virtual bool RemoveJob(JobType type)

Parameters

type JobType

The type to remove.

Returns

bool

Whether this person has a job of the given type.

RemoveMemory<T>(MemoryType, int, Func<T, bool>)

Removes all Memory instances of the given type T and MemoryType from this person's Memories collection, and returns the amount of memories removed.

public virtual int RemoveMemory<T>(MemoryType type, int toKeep = 0, Func<T, bool> condition = null) where T : Memory

Parameters

type MemoryType

The memory type to match.

toKeep int

An amount of memories of the given type to keep. Oldest memories will be removed first.

condition Func<T, bool>

An additional condition to determine whether memories should be included in the search.

Returns

int

How many memories were removed.

Type Parameters

T

ResetToStatic(bool, bool)

Resets this map object to a static state when the Map that is on is exported.

public override bool ResetToStatic(bool thorough, bool custom)

Parameters

thorough bool

Whether a more thorough reset is expected, which usually involves normalizing additional data and cleaning up player data entirely.

custom bool

Whether the static reset is happening in a custom context, that is, a Household being exported normally rather than through cheats, or a custom Map being exported.

Returns

bool

Whether this object should stay on the map after the static reset. If false is returned, this object is removed.

RestoreNeed(NeedType, float, ActionInfo, float)

Restores this person's Need of the given type by the given amount. Also invokes OnRestoreNeed and modifies the restored amount by the person's current Emotion.

public virtual void RestoreNeed(NeedType type, float amount, ActionInfo info, float speedMultiplier)

Parameters

type NeedType

The type of need to restore

amount float

The amount to restore this need by, out of Max.

info ActionInfo

The action info of the action that is causing the need to be restored. Can be null if the need is not being restored by an action.

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

RestoreNeed(NeedType, float, ActionInfo, SkillType, float)

Restores this person's Need of the given type by the given amount, additionally taking into account the person's level at the given SkillType. The higher the level of the given skill is, the higher the percentage of maxAmount that the Need will be restored with. This is useful for rewarding Entertainment based on the level in a skill that is currently being built.

public void RestoreNeed(NeedType type, float maxAmount, ActionInfo info, SkillType requiredSkill, float speedMultiplier)

Parameters

type NeedType

The type of need to restore.

maxAmount float

The maximum amount to restore this need by, out of Max.

info ActionInfo

The action info of the action that is causing the need to be restored. Can be null if the need is not being restored by an action.

requiredSkill SkillType

The skill required to restore the given need.

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

SetAnimationsFromLooks()

A method that is called in various places to update this person's animation data. By default, this method calls GenerateAnimationGroup(ClothesLayer, int, IReadOnlyDictionary<Point, TextureRegion>, Point) for each clothes layer as well as this person's shadow.

public virtual void SetAnimationsFromLooks()

SetCurrentOutfit(int)

Sets this person's CurrentOutfitIndex to the given index. Additionally, this method updates this person's animation and portrait to the new outfit.

public virtual void SetCurrentOutfit(int index)

Parameters

index int

The index to set

SetCurrentOutfit(ClothesIntention)

Sets the current outfit to an outfit that matches the given ClothesIntention. This method returns whether GetRandomOutfit(ClothesIntention) returned a valid outfit index or if no matching outfit could be found. Note that, if this person is already wearing an outfit that matches the intention, the outfit will not be changed, and this method returns true.

public virtual bool SetCurrentOutfit(ClothesIntention intention)

Parameters

intention ClothesIntention

The intention to match the best outfit to.

Returns

bool

True if an outfit could be found, or false if no matching outfit could be found.

SetHeldObject(MapObject, bool)

Sets this person's held object to the given instance. Note that the obj has to be on the same map as this person's Map.

public virtual void SetHeldObject(MapObject obj, bool fake = false)

Parameters

obj MapObject

The furniture to hold

fake bool

Whether the object set to be held is considered fake. A fake object will not be taken into account when a IsEmptyHanded(ActionInfo, bool) check occurs. Fake items are expected to be removed at the end of an Action that adds them.

SetHeldObject<T>(FurnitureType, int[], Guid?, bool)

Sets the person's held object to the given furniture type, with the given data, and returns the created instance. Note that the returned object will automatically be added to the same map as this person's Map.

public virtual T SetHeldObject<T>(FurnitureType type, int[] colors = null, Guid? id = null, bool fake = false) where T : Furniture

Parameters

type FurnitureType

The type of furniture to construct

colors int[]

The colors that the constructed furniture should have, or null to use the defaults

id Guid?

The id that this furniture should have, or null to choose a random one

fake bool

Whether the object set to be held is considered fake. A fake object will not be taken into account when a IsEmptyHanded(ActionInfo, bool) check occurs. Fake items are expected to be removed at the end of an Action that adds them.

Returns

T

The created furniture instance

Type Parameters

T

The type that the created furniture is expected to have

SetJob(JobType, int)

Sets this person's current Jobs to the passed single value. If null is passed, the person's job gets removed.

[Obsolete("Use the new AddJob and RemoveJob instead")]
public virtual void SetJob(JobType type, int level = 0)

Parameters

type JobType

The job to start

level int

The level to start this job with

SetNewId(Map, IEnumerable<Person>, IEnumerable<Furniture>)

Sets a new Id for this person, and also updates any furniture and relationship references for them. Optionally, a set of additional people and furniture that might not currently be on the map can be passed.

public virtual void SetNewId(Map map, IEnumerable<Person> possibleAdditionalRelationships = null, IEnumerable<Furniture> possibleAdditionalFurniture = null)

Parameters

map Map

The map that the person will be added to

possibleAdditionalRelationships IEnumerable<Person>

A set of people, in addition to the map's people, that this person might have a relationship to

possibleAdditionalFurniture IEnumerable<Furniture>

A set of objects, in addition to the map's objects, that this person might have created

SetPregnancyStatus(int, Guid, bool)

Sets this person's pregnancy status to the given parameters. This person's PregnancyHoursRemaining, as well as their PregnancyPartner will be set. If memories is true, the FoundOutPregnancy memory will be removed, and the MayBePregnant memory will be added if hours is greater than 0.

public virtual void SetPregnancyStatus(int hours, Guid partner, bool memories = true)

Parameters

hours int

The amount of hours this person should be pregnant for at the minimum.

partner Guid

The Id of this person's pregnancy partner.

memories bool

Whether the appropriate Memory instances should be added to this person.

ShouldDrawHeldItem()

Returns whether or not to draw this person's held object at the given time, whicih is used by ParentInfo for drawing.

public virtual bool ShouldDrawHeldItem()

Returns

bool

Whether or not to draw this person's held object.

Speak(SpeakStyle, float, float)

Causes this person to play speaking sounds with their VoicePitch applied for the given amount of time

public virtual void Speak(SpeakStyle possibleStyles, float minimumSeconds = 1, float maximumSeconds = 3)

Parameters

possibleStyles SpeakStyle

The speak styles to choose sounds from, can be a combined flag

minimumSeconds float

The minimum amount of time, in seconds, to speak for

maximumSeconds float

The maximum amount of time, in seconds, to speak for

StartProject(Project)

Starts a new project, adding it to the Projects list of this person

public virtual Project StartProject(Project project)

Parameters

project Project

The project to start

Returns

Project

The project that was passed, for chaining

StopEmoting()

Causes this person to stop displaying the current emote immediately

public virtual void StopEmoting()

StopSpeaking()

Causes this person to stop speaking, resetting their CurrentSpeakStyle and interrupting any currently playing speak sounds

public virtual void StopSpeaking()

ToCreatedByString()

Returns a string representation of this person using the localized "Created by:" prefix

public virtual string ToCreatedByString()

Returns

string

A "created by" string

Update(GameTime, TimeSpan, float)

The update method, which is called every update frame by the underlying Map, as well as additional places like the FurnitureStorage. Because of this, some actions might only want to be invoked if an object IsInWorld. To call this method while invoking all required events, use DoUpdate(GameTime, TimeSpan, float).

public virtual void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)

Parameters

time GameTime

The game's time

passedInGame TimeSpan

The amount of time that has passed since the last call

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

UpdateAction(Action, GameTime, TimeSpan, float, IEnumerable<IGoalTriggerable>)

A method that is called by this person's Update(GameTime, TimeSpan, float) method when an Action is to be updated. By default, this method does multiple things including raising the OnActionUpdated event and calling Update(GameTime, TimeSpan, float).

protected virtual void UpdateAction(Action action, GameTime time, TimeSpan passedInGame, float speedMultiplier, IEnumerable<IGoalTriggerable> goals)

Parameters

action Action

The action to update.

time GameTime

The game's time.

passedInGame TimeSpan

The amount of time that has passed in-game since the last update.

speedMultiplier float

The current speed multiplier.

goals IEnumerable<IGoalTriggerable>

This person's goals, which is always equal to GetCurrentGoals().

UpdateAnimations(TimeSpan, float)

A method called in Update(GameTime, TimeSpan, float), as well as when this person's rotation changes in OnCameraRotationChanged(Direction2, Direction2) to update this person's animation data to the proper state for the current update frame.

protected virtual void UpdateAnimations(TimeSpan elapsedGameTime, float speedMultiplier)

Parameters

elapsedGameTime TimeSpan

The amount of time elapsed since the last animation update.

speedMultiplier float

The speed multiplier.

Validate()

This method is called when this object is loaded from disk. Returning false on this method causes the object to be removed from the map. By default, this method invokes OnValidated and OnEventsAttachable.

public override bool Validate()

Returns

bool

false if the object is not valid, true otherwise

ValidateClothes()

Validates this person's current Outfits, removing any invalid ones and adding clothes to layers that require them. This method is called automatically in Validate(), as well as when a Household preview is loaded.

public virtual void ValidateClothes()

VisitLot(Lot)

Marks the given lot as the one that this person is currently visiting. To mark this person as not currently visiting any lots, null can be passed.

public virtual void VisitLot(Lot lot)

Parameters

lot Lot

The lot to mark as visited, or null to mark this person as not visiting any lot.

Events

OnActionInitialized

An event that is invoked when an Action is initialized. This event can be subscribed to using OnEventsAttachable.

public event Action<Action, EventPhase> OnActionInitialized

Event Type

Action<Action, EventPhase>

OnActionUpdated

An event that is invoked when an Action is updated in Update(GameTime, TimeSpan, float). This event can be subscribed to using OnEventsAttachable.

public event ObjectUpdateDelegate<Action> OnActionUpdated

Event Type

ObjectUpdateDelegate<Action>

OnActionsChanged

An event that is invoked when the CurrentActions or ActionQueue of this person changed This event can be subscribed to using OnEventsAttachable.

public event Action<Person> OnActionsChanged

Event Type

Action<Person>

OnActionsCompleted

An event that is invoked when an Action is completed, no matter the resulting CompletionType. This event can be subscribed to using OnEventsAttachable.

public event Action<Action, CompletionType, EventPhase> OnActionsCompleted

Event Type

Action<Action, CompletionType, EventPhase>

OnChangeFriendship

An event that is invoked in ChangeFriendship(Person, float). This event can be used to change the amount of friendship gained. This event can be subscribed to using OnEventsAttachable.

public event Person.RelationshipChangeDelegate OnChangeFriendship

Event Type

Person.RelationshipChangeDelegate

OnChangeRomance

An event that is invoked in ChangeRomance(Person, float). This event can be used to change the amount of romance gained. This event can be subscribed to using OnEventsAttachable.

public event Person.RelationshipChangeDelegate OnChangeRomance

Event Type

Person.RelationshipChangeDelegate

OnEmotionChanged

An event that is invoked when the Emotion changes. This event can be subscribed to using OnEventsAttachable.

public event Action<Person> OnEmotionChanged

Event Type

Action<Person>

OnEmotionModifiersChanged

An event that is invoked when the EmotionModifiers change. This event can be subscribed to using OnEventsAttachable.

public event Person.EmotionModifiersChangedDelegate OnEmotionModifiersChanged

Event Type

Person.EmotionModifiersChangedDelegate

OnGetAiPriorityForObject

A delegate that can optionally be used to modify the AI priority for a given object in GetAiPriorityForObject(MapObject, ObjectCategory). This event can be subscribed to using OnEventsAttachable.

public event Person.AiPriorityForObjectDelegate OnGetAiPriorityForObject

Event Type

Person.AiPriorityForObjectDelegate

OnGetCurrentGoals

An event that is invoked in GetCurrentGoals(). This event allows adding more goals to a person that should be tracked by AutoGoalInfo goals. This event can be subscribed to using OnEventsAttachable.

public event Action<List<IGoalTriggerable>> OnGetCurrentGoals

Event Type

Action<List<IGoalTriggerable>>

OnGetEfficiencyModifier

An event that is invoked at the end of GetEfficiencyModifier(float, ActionInfo, SkillType, float), after the default efficiency modifier is evaulated. This event can be used to change this person's efficiency based on additional mod factors. This event can be subscribed to using OnEventsAttachable.

public event Person.EfficiencyModifierDelegate OnGetEfficiencyModifier

Event Type

Person.EfficiencyModifierDelegate

OnGetEmotionSkillBoost

An event that is invoked at the end of GetEmotionSkillBoost(SkillType), after the default emotion skill boost is evaluated. This event can be subscribed to using OnEventsAttachable.

public event Person.SkillBoostDelegate OnGetEmotionSkillBoost

Event Type

Person.SkillBoostDelegate

OnGetPassiveActionPriority

An event that is invoked at the end of GetPassiveActionPriority(ActionType), after the default action priority is evaulated. This event can be used to change the action priority based on additional mod factors. This event can be subscribed to using OnEventsAttachable.

public event Person.PassiveActionPriorityDelegate OnGetPassiveActionPriority

Event Type

Person.PassiveActionPriorityDelegate

OnGetPersonalitySkillBoost

An event that is invoked at the end of GetPersonalitySkillBoost(SkillType), after the default personality skill boost is evaluated. This event can be subscribed to using OnEventsAttachable.

public event Person.SkillBoostDelegate OnGetPersonalitySkillBoost

Event Type

Person.SkillBoostDelegate

OnGetWalkSpeed

An event that is invoked at the end of GetWalkSpeed(), after the default walk speed is evaluated. This event can be used to change this person's walk speed based on additional mod factors. This event can be subscribed to using OnEventsAttachable.

public event Person.WalkSpeedDelegate OnGetWalkSpeed

Event Type

Person.WalkSpeedDelegate

OnJobChanged

An event that is invoked when the Jobs collection changes. This event can be subscribed to using OnEventsAttachable.

public event Action<Person> OnJobChanged

Event Type

Action<Person>

OnLifeGoalChanged

An event that is invoked when a person's current LifeGoal is changed. This event can be subscribed to using OnEventsAttachable.

public event Action<LifeGoal.Instance> OnLifeGoalChanged

Event Type

Action<LifeGoal.Instance>

OnMemoriesChanged

An event that is invoked when this person's Memories change in AddMemory(Memory) and RemoveMemory<T>(MemoryType, int, Func<T, bool>). This event can be subscribed to using OnEventsAttachable.

public event Action<Memory> OnMemoriesChanged

Event Type

Action<Memory>

OnNewSkillLearned

An event that is invoked when the Skills list gains a new entry, meaning the person learned a new skill This event can be subscribed to using OnEventsAttachable.

public event Action<Person> OnNewSkillLearned

Event Type

Action<Person>

OnOutfitChanged

An event that is invoked when this person's CurrentOutfitIndex changes. This event can be subscribed to using OnEventsAttachable.

public event Action OnOutfitChanged

Event Type

Action

OnRestoreNeed

An event that is invoked in RestoreNeed(NeedType, float, ActionInfo, float). This event allows modifying the amount that a need is restored by based on custom factors. This event can be subscribed to using OnEventsAttachable.

public event Person.RestoreNeedDelegate OnRestoreNeed

Event Type

Person.RestoreNeedDelegate