Search Results for

    Show / Hide Table of Contents

    Class Person

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

    Inheritance
    System.Object
    MLEM.Data.Json.JsonTypeSafeGenericDataHolder
    MapObject
    Person
    Implements
    MLEM.Misc.IGenericDataHolder
    IUpdatingObject
    Inherited Members
    MapObject.PersonRotationOrder
    MapObject.OnCreated
    MapObject.OnValidated
    MapObject.OnEventsAttachable
    MapObject.OnDraw
    MapObject.OnUpdate
    MapObject.OnGetHoverInfo
    MapObject.Position
    MapObject.Visibility
    MapObject.Id
    MapObject.Map
    MapObject.CurrentLot
    MapObject.CurrentRoom
    MapObject.IsInWorld
    MapObject.OnAdded()
    MapObject.OnRemoved()
    MapObject.GetAiPriority(Person, ObjectCategory)
    MapObject.CanExecuteAction(ActionType, ActionInfo, Boolean, Boolean)
    MapObject.OnActionCompleted(Action, CompletionType, Boolean)
    MapObject.ActionUpdate(Action, GameTime, TimeSpan, Single, Boolean)
    MapObject.SetMapAndValidate(Map)
    MapObject.HasCategory(Person, ObjectCategory)
    MapObject.GetEfficiencyModifier(Person, ActionInfo, Boolean, SkillType, Single)
    MapObject.GetRestoreNeedModifier(Person, ActionInfo, Boolean, NeedType)
    MapObject.IsFreeSpot(Point)
    MapObject.GetPathCostModifier(Point)
    MapObject.DoDraw(GameTime, Object, Nullable<Color>, Boolean, List<StaticSpriteBatch.Item>)
    MapObject.DoUpdate(GameTime, TimeSpan, Single)
    MapObject.DrawColumns(Map, Vector2, Object, Vector2, TextureRegion, Color, Single, Point, List<StaticSpriteBatch.Item>, Boolean, ParentInfo, Single, SpriteEffects, Boolean, Boolean, Boolean)
    MapObject.GetModCategory(String)
    MLEM.Data.Json.JsonTypeSafeGenericDataHolder.SetData(System.String, System.Object)
    MLEM.Data.Json.JsonTypeSafeGenericDataHolder.SetData<T>(System.String, T)
    MLEM.Data.Json.JsonTypeSafeGenericDataHolder.GetData<T>(System.String)
    MLEM.Data.Json.JsonTypeSafeGenericDataHolder.GetDataKeys()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: TinyLife.Objects
    Assembly: Tiny Life.dll
    Syntax
    public class Person : MapObject, IGenericDataHolder, IUpdatingObject

    Constructors

    Person(Map, Vector2)

    Creates a new person with the given settings

    Declaration
    public Person(Map map, Vector2 position)
    Parameters
    Type Name Description
    Map map

    The map to place this person on

    Microsoft.Xna.Framework.Vector2 position

    The position to place this person on

    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(ActionType, ActionInfo, Boolean, ActionVariety, Boolean, Boolean) and CancelAction(Action, Action, Boolean) to modify this list.

    Declaration
    [DataMember]
    public readonly List<(Action, bool)> ActionQueue
    Field Value
    Type Description
    System.Collections.Generic.List<System.ValueTuple<Action, System.Boolean>>

    AgeGroups

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

    Declaration
    public static readonly AgeGroup[] AgeGroups
    Field Value
    Type Description
    AgeGroup[]

    AnimateHeldObject

    Whether or not the GetHeldObject<T>(Boolean) 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, Single) frame.

    Declaration
    public bool AnimateHeldObject
    Field Value
    Type Description
    System.Boolean

    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, Single) frame.

    Declaration
    public float AnimationSpeed
    Field Value
    Type Description
    System.Single

    CurrentActions

    The actions that are currently being executed by this person. Use EnqueueAction(ActionType, ActionInfo, Boolean, ActionVariety, Boolean, Boolean) and CancelAction(Action, Action, Boolean) to modify this list.

    Declaration
    [DataMember]
    public readonly List<Action> CurrentActions
    Field Value
    Type Description
    System.Collections.Generic.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.

    Declaration
    [DataMember]
    public int CurrentAgeDays
    Field Value
    Type Description
    System.Int32

    CurrentPose

    This person's current Person.Pose. Note that this value is reset to Standing every Update(GameTime, TimeSpan, Single) frame.

    Declaration
    [DataMember]
    public Person.Pose CurrentPose
    Field Value
    Type Description
    Person.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.

    Declaration
    [DataMember]
    public int DaysLived
    Field Value
    Type Description
    System.Int32

    Description

    This person's description

    Declaration
    [DataMember]
    public string Description
    Field Value
    Type Description
    System.String

    EmotionModifiers

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

    Declaration
    [DataMember]
    public readonly List<EmotionModifier.Instance> EmotionModifiers
    Field Value
    Type Description
    System.Collections.Generic.List<EmotionModifier.Instance>

    FirstName

    This person's first name

    Declaration
    [DataMember]
    public string FirstName
    Field Value
    Type Description
    System.String

    HeldObjectRotation

    The rotation that the GetHeldObject<T>(Boolean) 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, Single) frame.

    Declaration
    public Direction2? HeldObjectRotation
    Field Value
    Type Description
    System.Nullable<MLEM.Misc.Direction2>

    LastBedSleptIn

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

    Declaration
    [DataMember(EmitDefaultValue = false)]
    public Guid LastBedSleptIn
    Field Value
    Type Description
    System.Guid

    LastName

    This person's last name

    Declaration
    [DataMember]
    public string LastName
    Field Value
    Type Description
    System.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.

    Declaration
    [DataMember(EmitDefaultValue = false)]
    public LotEmployment.Instance LotEmployment
    Field Value
    Type Description
    LotEmployment.Instance

    MaxRecentActionsAmount

    The maximum amount of recent actions that is stored in RecentActions

    Declaration
    public const int MaxRecentActionsAmount = 200
    Field Value
    Type Description
    System.Int32

    Memories

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

    Declaration
    [DataMember]
    public readonly List<Memory> Memories
    Field Value
    Type Description
    System.Collections.Generic.List<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).

    Declaration
    [DataMember]
    public readonly Dictionary<string, Need> Needs
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, Need>

    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, Single) frame. To edit this value, use OccupyActionSpot(Furniture, ActionSpot, Boolean, Nullable<Direction2>).

    Declaration
    public readonly List<(Furniture Furniture, ActionSpot Spot)> OccupiedFurniture
    Field Value
    Type Description
    System.Collections.Generic.List<System.ValueTuple<Furniture, ActionSpot>>

    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.

    Declaration
    [DataMember]
    [JsonConverter(typeof(Person.OutfitsConverter))]
    public readonly List<Outfit> Outfits
    Field Value
    Type Description
    System.Collections.Generic.List<Outfit>

    PersonalityTypes

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

    Declaration
    [DataMember]
    public readonly HashSet<PersonalityType> PersonalityTypes
    Field Value
    Type Description
    System.Collections.Generic.HashSet<PersonalityType>

    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.

    Declaration
    public readonly RenderTarget2D Portrait
    Field Value
    Type Description
    Microsoft.Xna.Framework.Graphics.RenderTarget2D

    Projects

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

    Declaration
    [DataMember]
    public readonly List<Project> Projects
    Field Value
    Type Description
    System.Collections.Generic.List<Project>

    RecentActions

    The ActionType of actions that this person has done recently, in order that they have been done in, with the most recent action being at the end of the list. Note that the size of this list never exceeds MaxRecentActionsAmount. Completed actions are added to this queue automatically.

    Declaration
    [DataMember]
    public readonly List<ActionType> RecentActions
    Field Value
    Type Description
    System.Collections.Generic.List<ActionType>

    Relationships

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

    Declaration
    [DataMember]
    public readonly List<Relationship> Relationships
    Field Value
    Type Description
    System.Collections.Generic.List<Relationship>

    Skills

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

    Declaration
    [DataMember]
    public readonly Dictionary<string, Skill> Skills
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.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>, Nullable<TimeSpan>). Mods can simply add to this collection to add new speak sounds.

    Declaration
    public static readonly Dictionary<(VoiceStyle, SpeakStyle), List<SoundEffect>> SpeakSounds
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.ValueTuple<VoiceStyle, SpeakStyle>, System.Collections.Generic.List<Microsoft.Xna.Framework.Audio.SoundEffect>>

    SpeakStyles

    Declaration
    public static readonly SpeakStyle[] SpeakStyles
    Field Value
    Type Description
    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, Single) frame.

    Declaration
    public Color? Tint
    Field Value
    Type Description
    System.Nullable<Microsoft.Xna.Framework.Color>

    VoicePitch

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

    Declaration
    [DataMember]
    public float VoicePitch
    Field Value
    Type Description
    System.Single

    VoiceStyle

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

    Declaration
    [DataMember]
    public VoiceStyle VoiceStyle
    Field Value
    Type Description
    VoiceStyle

    VoiceStyles

    Declaration
    public static readonly VoiceStyle[] VoiceStyles
    Field Value
    Type Description
    VoiceStyle[]

    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, Single) frame. Setting this value to 0 (no layer) will also stop the Emote and GetHeldObject<T>(Boolean) from drawing.

    Declaration
    [DataMember]
    public ClothesLayer WornLayers
    Field Value
    Type Description
    ClothesLayer

    Properties

    Age

    The AgeGroup that this person currently has.

    Declaration
    public AgeGroup Age { get; set; }
    Property Value
    Type Description
    AgeGroup

    AllActions

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

    Declaration
    public IEnumerable<Action> AllActions { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<Action>

    CurrentEmote

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

    Declaration
    public Emote CurrentEmote { get; }
    Property Value
    Type Description
    Emote

    CurrentOutfit

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

    Declaration
    public Outfit CurrentOutfit { get; }
    Property Value
    Type Description
    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(Int32).

    Declaration
    [DataMember]
    public int CurrentOutfitIndex { get; }
    Property Value
    Type Description
    System.Int32

    CurrentRoomDecorativeRating

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

    Declaration
    public int CurrentRoomDecorativeRating { get; }
    Property Value
    Type Description
    System.Int32

    CurrentSpeakStyle

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

    Declaration
    public SpeakStyle? CurrentSpeakStyle { get; }
    Property Value
    Type Description
    System.Nullable<SpeakStyle>

    DrawSize

    The size, in draw space pixels, that this person's texture takes up. This is gathered from the Body layer of its texture data.

    Declaration
    public Point DrawSize { get; }
    Property Value
    Type Description
    Microsoft.Xna.Framework.Point

    Emotion

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

    Declaration
    public EmotionType Emotion { get; }
    Property Value
    Type Description
    EmotionType

    FullName

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

    Declaration
    public string FullName { get; }
    Property Value
    Type Description
    System.String

    HomeLot

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

    Declaration
    public Lot HomeLot { get; }
    Property Value
    Type Description
    Lot

    Household

    The Household that this person is a part of

    Declaration
    public Household Household { get; }
    Property Value
    Type Description
    Household

    IsCurrentHousehold

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

    Declaration
    public bool IsCurrentHousehold { get; }
    Property Value
    Type Description
    System.Boolean

    IsDead

    A property that computes whether this person is dead. Note that a person has to be on a Map's TinyLife.World.Map.DeadPeople list for this property to function correctly.

    Declaration
    public bool IsDead { get; }
    Property Value
    Type Description
    System.Boolean

    IsMinorUpdateNow

    A property that returns whether this updating object should currently update minorly, rather than majorly. A minor update means that Update(GameTime, TimeSpan, Single) is only called once every 10 in-game minutes (see MinorUpdateMinutes), but all of the parameters to Update(GameTime, TimeSpan, Single) are modified accordingly to maintain proper time calculations. Note that this property is only queried every 10 in-game minutes, as switching between major and minor update schedules only happens when a minor update is executed. For example, a Person updates minorly when they're out of town to aid the game's performance.

    Declaration
    public bool IsMinorUpdateNow { get; }
    Property Value
    Type Description
    System.Boolean

    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.

    Declaration
    public bool IsMoving { get; }
    Property Value
    Type Description
    System.Boolean

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

    Declaration
    public bool IsRegularVisitor { get; }
    Property Value
    Type Description
    System.Boolean

    Job

    The Job that this person currently has. To edit this value, use SetJob(JobType, Int32).

    Declaration
    [DataMember]
    public Job Job { get; }
    Property Value
    Type Description
    Job

    LastVisitedLot

    The Lot that was last visited by this person. A visited lot is a lot that was actively moved to using TinyLife.Actions.VisitLotAction, TinyLife.Actions.GoHomeAction or if the person is currently occupying this lot. To modify this value, use VisitLot(Lot).

    Declaration
    public Lot LastVisitedLot { get; }
    Property Value
    Type Description
    Lot

    LifeGoal

    This person's current LifeGoal.Instance

    Declaration
    public LifeGoal.Instance LifeGoal { get; set; }
    Property Value
    Type Description
    LifeGoal.Instance

    LotVisitCooldown

    The amount of time that has to pass before this person can visit another lot. If LastVisitedLot 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.

    Declaration
    [DataMember(EmitDefaultValue = false)]
    public TimeSpan LotVisitCooldown { get; }
    Property Value
    Type Description
    System.TimeSpan

    Money

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

    Declaration
    public float Money { get; set; }
    Property Value
    Type Description
    System.Single

    ParentInfo

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

    Declaration
    public override ParentInfo ParentInfo { get; }
    Property Value
    Type Description
    ParentInfo
    Overrides
    MapObject.ParentInfo

    RandomlyGenerated

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

    Declaration
    [DataMember(EmitDefaultValue = false)]
    public bool RandomlyGenerated { get; }
    Property Value
    Type Description
    System.Boolean

    Rotation

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

    Declaration
    public Direction2 Rotation { get; set; }
    Property Value
    Type Description
    MLEM.Misc.Direction2

    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, Single) frame. To edit this value, use OccupyActionSpot(Furniture, ActionSpot, Boolean, Nullable<Direction2>).

    Declaration
    public (Furniture Furniture, ActionSpot Spot) VisuallyOccupiedSpot { get; }
    Property Value
    Type Description
    System.ValueTuple<Furniture, ActionSpot>

    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, Boolean, Nullable<Direction2>). Note that this value is reset to Position every Update(GameTime, TimeSpan, Single) frame. Also note that the visual position does not affect collision detection or most interactions.

    Declaration
    public Vector2 VisualPosition { get; set; }
    Property Value
    Type Description
    Microsoft.Xna.Framework.Vector2

    Methods

    AddEmotion(EmotionModifier, Int32, TimeSpan, IEmotionSource, Boolean)

    Adds the given EmotionModifier with the given intensity and time

    Declaration
    public bool AddEmotion(EmotionModifier type, int amount, TimeSpan time, IEmotionSource source, bool increaseExisting = false)
    Parameters
    Type Name Description
    EmotionModifier type

    The type of emotion to add

    System.Int32 amount

    The intensity of the emotion to add

    System.TimeSpan time

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

    IEmotionSource source

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

    System.Boolean increaseExisting

    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
    Type Description
    System.Boolean

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

    AddMemory<T>(MemoryType, ActionInfo, Nullable<TimeSpan>)

    Adds a Memory to the Memories list of this person.

    Declaration
    public T AddMemory<T>(MemoryType type, ActionInfo info, TimeSpan? timeOccured = null)
        where T : Memory
    Parameters
    Type Name Description
    MemoryType type

    The type of memory to add.

    ActionInfo info

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

    System.Nullable<System.TimeSpan> timeOccured

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

    Returns
    Type Description
    T

    The added memory.

    Type Parameters
    Name Description
    T

    CancelAction(Action, Action, Boolean)

    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.

    Declaration
    public bool CancelAction(Action action, Action cancelSource = null, bool force = false)
    Parameters
    Type Name Description
    Action action

    The action to cancel

    Action cancelSource

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

    System.Boolean force

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

    Returns
    Type Description
    System.Boolean

    Whether the action could be canceled successfully

    ChangeFriendship(Person, Single)

    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.

    Declaration
    public void ChangeFriendship(Person person, float amount)
    Parameters
    Type Name Description
    Person person

    The person to change friendship with

    System.Single amount

    The amount to change friendship by, can be negative

    ChangeRomance(Person, Single)

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

    Declaration
    public void ChangeRomance(Person person, float amount)
    Parameters
    Type Name Description
    Person person

    The person to change romance with

    System.Single amount

    The amount to change romance by, can be negative

    Create(Map, Random, AgeGroup)

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

    Declaration
    public static Person Create(Map map, Random random = null, AgeGroup allowedAges = AgeGroup.Child | AgeGroup.Adult | (AgeGroup)-37)
    Parameters
    Type Name Description
    Map map

    The map to create the person for.

    System.Random random

    The random to use for generating the person's data. If this is null, no random generation takes place.

    AgeGroup allowedAges

    A set of ages that are allowed for random generation. If random is null, this has no effect.

    Returns
    Type Description
    Person

    The generated person.

    DepleteNeed(NeedType, Single, Single)

    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.

    Declaration
    public void DepleteNeed(NeedType type, float amount, float speedMultiplier)
    Parameters
    Type Name Description
    NeedType type

    The type of need to deplete

    System.Single amount

    The amount to deplete the need by

    System.Single speedMultiplier

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

    Die(Person.DeathReason, Boolean)

    Causes this person to die, removing it from the world and optionally spawning a Gravestone. Note thta this method's content is executed at the end of the current Update(GameTime, TimeSpan, Single) frame, and not right away.

    Declaration
    public void Die(Person.DeathReason reason, bool createGravestone = true)
    Parameters
    Type Name Description
    Person.DeathReason reason

    The reason for this person's death

    System.Boolean createGravestone

    Whether or not to create a gravestone

    DisplayEmote(EmoteCategory, Single, Single)

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

    Declaration
    public void DisplayEmote(EmoteCategory possibleCategories, float minimumSeconds = 1F, float maximumSeconds = 3F)
    Parameters
    Type Name Description
    EmoteCategory possibleCategories

    A combined flag that represents the categories to pick emotes from

    System.Single minimumSeconds

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

    System.Single maximumSeconds

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

    DisplayEmoteAndSpeak(EmoteCategory, SpeakStyle, Single, Single)

    This is a combined helper method that invokes DisplayEmote(EmoteCategory, Single, Single) and Speak(SpeakStyle, Single, Single) 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.

    Declaration
    public void DisplayEmoteAndSpeak(EmoteCategory emoteCategories, SpeakStyle speakStyles, float minimumSeconds = 1F, float maximumSeconds = 3F)
    Parameters
    Type Name Description
    EmoteCategory emoteCategories

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

    SpeakStyle speakStyles

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

    System.Single minimumSeconds

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

    System.Single maximumSeconds

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

    Draw(GameTime, Object, Vector2, Nullable<Color>, List<StaticSpriteBatch.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, Nullable<Color>, Boolean, List<StaticSpriteBatch.Item>).

    Declaration
    public override void Draw(GameTime time, object batch, Vector2 _, Color? overrideColor, List<StaticSpriteBatch.Item> items)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.GameTime time

    The current time

    System.Object batch

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

    Microsoft.Xna.Framework.Vector2 _
    System.Nullable<Microsoft.Xna.Framework.Color> overrideColor

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

    System.Collections.Generic.List<MLEM.Graphics.StaticSpriteBatch.Item> items

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

    Overrides
    MapObject.Draw(GameTime, Object, Vector2, Nullable<Color>, List<StaticSpriteBatch.Item>)

    DrawUi(SpriteBatch, Vector2, Single, Direction2)

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

    Declaration
    public void DrawUi(SpriteBatch batch, Vector2 pos, float scale, Direction2 rotation = Direction2.Right)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Graphics.SpriteBatch batch

    The sprite batch to use for drawing

    Microsoft.Xna.Framework.Vector2 pos

    The position, in screen space, to draw at

    System.Single scale

    The scale to draw with

    MLEM.Misc.Direction2 rotation

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

    EarnMoney(Single, 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.

    Declaration
    public void EarnMoney(float money, object triggerObject)
    Parameters
    Type Name Description
    System.Single money

    The money to earn.

    System.Object triggerObject

    The object that caused the money to be earned, which is passed to Trigger(IGoalTriggerable, Object, GoalTrigger, Object[]).

    EnqueueAction(ActionType, ActionInfo, Boolean, ActionVariety, Boolean, Boolean)

    Enqueues the given action into ActionQueue to be executed later.

    Declaration
    public Action EnqueueAction(ActionType type, ActionInfo info, bool automatic, ActionVariety variety = null, bool priority = false, bool force = false)
    Parameters
    Type Name Description
    ActionType type

    The type of action to enqueue

    ActionInfo info

    The action information

    System.Boolean automatic

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

    ActionVariety variety

    The variety of the action to start, or null if this action has no varieties or a random variety should be chosen

    System.Boolean priority

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

    System.Boolean force

    Whether to start the action even if CanExecute returns false

    Returns
    Type Description
    Action

    The created action, or null if the action cannot be executed

    Finalize()

    Declaration
    protected void Finalize()

    FindPathAsync(Point, ICollection<Point>, AStar<Point>.GetCost)

    Finds a path asynchronously using the A* pathfinding algorithm. Note that the found path is not automatically embarked on. Usually, this method should not be used, but GoHereAction should be used instead.

    Declaration
    public Task<Stack<Point>> FindPathAsync(Point start, ICollection<Point> goals, AStar<Point>.GetCost costFunction = null)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Point start

    The start tile position

    System.Collections.Generic.ICollection<Microsoft.Xna.Framework.Point> goals

    The goal tile positions.

    MLEM.Pathfinding.AStar.GetCost<> costFunction

    The function to use for determining the cost of tiles

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Collections.Generic.Stack<Microsoft.Xna.Framework.Point>>

    A task that, when completed, returns the path found or an empty stack if there is none

    FocusCameraOnEvent()

    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.

    Declaration
    public void FocusCameraOnEvent()

    GainSkill(SkillType, Single, ActionInfo, Single)

    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.

    Declaration
    public void GainSkill(SkillType type, float amount, ActionInfo info, float speedMultiplier)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to gain

    System.Single amount

    The amount of skill points to gain

    ActionInfo info

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

    System.Single speedMultiplier

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

    GetCategories(Person)

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

    Declaration
    public override ObjectCategory GetCategories(Person person)
    Parameters
    Type Name Description
    Person person

    The person to query categories for

    Returns
    Type Description
    ObjectCategory

    A set of categories that this object has

    Overrides
    MapObject.GetCategories(Person)

    GetCurrentGoals()

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

    Declaration
    public List<IGoalTriggerable> GetCurrentGoals()
    Returns
    Type Description
    System.Collections.Generic.List<IGoalTriggerable>

    This person's current goals

    GetDaysBeforeAging()

    Returns the amount of days that this person's current Age should last for in total, excluding the CurrentAgeDays.

    Declaration
    public int GetDaysBeforeAging()
    Returns
    Type Description
    System.Int32

    The amount of days until this person should age up.

    GetEfficiencyModifier(Single, ActionInfo, SkillType, Single)

    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.

    Declaration
    public float GetEfficiencyModifier(float speedMultiplier = 1F, ActionInfo info = null, SkillType skill = null, float levelModifier = 0.1F)
    Parameters
    Type Name Description
    System.Single speedMultiplier

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

    ActionInfo info

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

    SkillType skill

    A skill that optionally influences the efficiency

    System.Single levelModifier

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

    Returns
    Type Description
    System.Single

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

    GetFreeActionSpotInfo(Person, ObjectCategory)

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

    Declaration
    public override ActionInfo GetFreeActionSpotInfo(Person person, ObjectCategory context = null)
    Parameters
    Type Name Description
    Person person

    The person to query free action spots for

    ObjectCategory context

    The object category that this action spot needs to have

    Returns
    Type Description
    ActionInfo

    The first free action spot as an ActionInfo

    Overrides
    MapObject.GetFreeActionSpotInfo(Person, ObjectCategory)

    GetFreeTalkingSpots(Person)

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

    Declaration
    public IEnumerable<Vector2> GetFreeTalkingSpots(Person person)
    Parameters
    Type Name Description
    Person person
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<Microsoft.Xna.Framework.Vector2>

    A set of free talking spots

    GetHeldActionInfo()

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

    Declaration
    public ActionInfo GetHeldActionInfo()
    Returns
    Type Description
    ActionInfo

    The held action info.

    GetHeldObject<T>(Boolean)

    Returns the Furniture that this person is currently holding in their hands. Note that, if the held object is not of the required type T, null is returned.

    Declaration
    public T GetHeldObject<T>(bool alsoReturnFake = true)
        where T : Furniture
    Parameters
    Type Name Description
    System.Boolean alsoReturnFake
    Returns
    Type Description
    T

    The held furniture

    Type Parameters
    Name Description
    T

    The type that the held furniture is expected to have

    GetHomeLocation()

    Shorthand method for GetHomeLocation(Person) that returns the home location of this person's Household's lot

    Declaration
    public Vector2 GetHomeLocation()
    Returns
    Type Description
    Microsoft.Xna.Framework.Vector2

    This person's home location

    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.

    Declaration
    public override void GetHoverInfo(Tooltip tooltip)
    Parameters
    Type Name Description
    MLEM.Ui.Elements.Tooltip tooltip

    The tooltip that will be displayed.

    Overrides
    MapObject.GetHoverInfo(Tooltip)

    GetMemories<T>(MemoryType)

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

    Declaration
    public IEnumerable<T> GetMemories<T>(MemoryType type)
        where T : Memory
    Parameters
    Type Name Description
    MemoryType type

    The memory type to match.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<T>

    The memories of the given type.

    Type Parameters
    Name Description
    T

    GetNeed(NeedType)

    Returns the Need Value of the given type for this person

    Declaration
    public float GetNeed(NeedType type)
    Parameters
    Type Name Description
    NeedType type

    The type of need that should be returned

    Returns
    Type Description
    System.Single

    This person's need value

    GetNeedPercentage(NeedType)

    Returns the Need Percentage of the given type for this person

    Declaration
    public float GetNeedPercentage(NeedType type)
    Parameters
    Type Name Description
    NeedType type

    The type of need that should be returned

    Returns
    Type Description
    System.Single

    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.

    Declaration
    public float GetPassiveActionPriority(ActionType type)
    Parameters
    Type Name Description
    ActionType type

    The type of action to get the passive priority for

    Returns
    Type Description
    System.Single

    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(Single, ActionInfo, SkillType, Single).

    Declaration
    public float GetPersonalitySkillBoost(SkillType skill)
    Parameters
    Type Name Description
    SkillType skill

    The skill category whose personality skill boost to return

    Returns
    Type Description
    System.Single

    A modifier that skills should be boosted by

    GetProject(String, String)

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

    Declaration
    public Project GetProject(string type, string name)
    Parameters
    Type Name Description
    System.String type

    The Type of the project to return

    System.String name

    The Name of the project to return

    Returns
    Type Description
    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.

    Declaration
    public IEnumerable<Project> GetProjects(string type)
    Parameters
    Type Name Description
    System.String type

    The Type of project to return

    Returns
    Type Description
    System.Collections.Generic.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.

    Declaration
    public int GetRandomOutfit(ClothesIntention intention)
    Parameters
    Type Name Description
    ClothesIntention intention

    The intention to match the best outfit to.

    Returns
    Type Description
    System.Int32

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

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

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

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

    The VoiceStyle to use.

    SpeakStyle style

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

    System.Collections.Generic.List<Microsoft.Xna.Framework.Audio.SoundEffect> avoid

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

    System.Nullable<System.TimeSpan> maxLength

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

    Returns
    Type Description
    Microsoft.Xna.Framework.Audio.SoundEffect

    A random sound effect that matches the given properties

    GetRelationship(Person, Boolean)

    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.

    Declaration
    public Relationship GetRelationship(Person person, bool initialize)
    Parameters
    Type Name Description
    Person person

    The person to get relationship values for

    System.Boolean initialize

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

    Returns
    Type Description
    Relationship

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

    GetSkill(SkillType, Boolean)

    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, null is returned.

    Declaration
    public Skill GetSkill(SkillType type, bool initialize)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to query.

    System.Boolean initialize

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

    Returns
    Type Description
    Skill

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

    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.

    Declaration
    public int GetSkillLevel(SkillType type)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to query

    Returns
    Type Description
    System.Int32

    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.

    Declaration
    public float GetSkillPointPercentage(SkillType type)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to query

    Returns
    Type Description
    System.Single

    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.

    Declaration
    public float GetSkillTotalPercentage(SkillType type)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to query

    Returns
    Type Description
    System.Single

    The person's total skill level percentage

    GetTimeSinceMemory(MemoryType)

    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.

    Declaration
    public TimeSpan? GetTimeSinceMemory(MemoryType type)
    Parameters
    Type Name Description
    MemoryType type

    The memory type to query.

    Returns
    Type Description
    System.Nullable<System.TimeSpan>

    The time since the given memory type.

    GetTimeSinceMemory(MemoryType[])

    Declaration
    public TimeSpan? GetTimeSinceMemory(params MemoryType[] types)
    Parameters
    Type Name Description
    MemoryType[] types
    Returns
    Type Description
    System.Nullable<System.TimeSpan>

    GetWalkSpeed()

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

    Declaration
    public float GetWalkSpeed()
    Returns
    Type Description
    System.Single

    The walk speed

    GoToExitRoad()

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

    Declaration
    public void GoToExitRoad()

    HasEmotionModifier(EmotionModifier)

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

    Declaration
    public bool HasEmotionModifier(EmotionModifier type)
    Parameters
    Type Name Description
    EmotionModifier type

    The type of emotion modifier to query

    Returns
    Type Description
    System.Boolean

    Whether the emotion modifier is active

    HasHouseholdMember(Guid)

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

    Declaration
    public bool HasHouseholdMember(Guid person)
    Parameters
    Type Name Description
    System.Guid person

    The unique id of the person to query

    Returns
    Type Description
    System.Boolean

    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

    Declaration
    public bool HasHouseholdMember(Person person)
    Parameters
    Type Name Description
    Person person
    Returns
    Type Description
    System.Boolean

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

    HasPersonality(PersonalityType)

    Returns whether this person has the given PersonalityType

    Declaration
    public bool HasPersonality(PersonalityType type)
    Parameters
    Type Name Description
    PersonalityType type

    The personality type to query

    Returns
    Type Description
    System.Boolean

    true if this person has this personality type, false otherwise

    HasSkillLevel(SkillType, Int32)

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

    Declaration
    public bool HasSkillLevel(SkillType type, int level)
    Parameters
    Type Name Description
    SkillType type

    The type of skill to query

    System.Int32 level

    The level that the skill has to be

    Returns
    Type Description
    System.Boolean

    true if the person has this skill level, false otherwise

    Intersects(RectangleF)

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

    Declaration
    public override bool Intersects(RectangleF rectangle)
    Parameters
    Type Name Description
    MLEM.Misc.RectangleF rectangle

    The area that should be checked for

    Returns
    Type Description
    System.Boolean

    true if this object intersects with the given rectangle

    Overrides
    MapObject.Intersects(RectangleF)

    IsCloseForTalking(Vector2)

    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.

    Declaration
    public bool IsCloseForTalking(Vector2 pos)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Vector2 pos

    The position of the person to query closeness for

    Returns
    Type Description
    System.Boolean

    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 System.Guid passed. To compare whether two people are an ID match, use IsIdMatch(Person).

    Declaration
    public bool IsIdMatch(Guid id)
    Parameters
    Type Name Description
    System.Guid id

    The id to compare this person's ids to

    Returns
    Type Description
    System.Boolean

    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.

    Declaration
    public bool IsIdMatch(Person other)
    Parameters
    Type Name Description
    Person other

    The person to compare this person to

    Returns
    Type Description
    System.Boolean

    Whether this person and the passed person have matching ids

    LowerEmotion(EmotionType, Single, Single)

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

    Declaration
    public bool LowerEmotion(EmotionType type, float percentage, float speedMultiplier = 1F)
    Parameters
    Type Name Description
    EmotionType type

    The type of emotion to lower

    System.Single percentage

    The percentage to lower the emotion by

    System.Single speedMultiplier

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

    Returns
    Type Description
    System.Boolean

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

    LowerEmotionModifier(EmotionModifier, Single, Single)

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

    Declaration
    public bool LowerEmotionModifier(EmotionModifier modifier, float percentage, float speedMultiplier = 1F)
    Parameters
    Type Name Description
    EmotionModifier modifier

    The emotion modifier to lower

    System.Single percentage

    The percentage to lower the emotion by

    System.Single speedMultiplier

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

    Returns
    Type Description
    System.Boolean

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

    OccupyActionSpot(Furniture, ActionSpot, Boolean, Nullable<Direction2>)

    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, Single) call.

    Declaration
    public void OccupyActionSpot(Furniture furniture, ActionSpot spot, bool enterSpot, Direction2? rotation = null)
    Parameters
    Type Name Description
    Furniture furniture

    The furniture to occupy

    ActionSpot spot

    The action spot to occupy on the furniture

    System.Boolean enterSpot

    Whether or not the visual position should be updated to enter the spot

    System.Nullable<MLEM.Misc.Direction2> rotation

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

    OccupyFreeActionSpot(ActionInfo, ObjectCategory, Boolean, Nullable<Direction2>)

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

    Declaration
    public bool OccupyFreeActionSpot(ActionInfo info, ObjectCategory context = null, bool enter = false, Direction2? rotation = null)
    Parameters
    Type Name Description
    ActionInfo info

    The action info whose action object to occupy.

    ObjectCategory context

    The category that the action spot should have

    System.Boolean enter

    Whether or not the action spot should be entered

    System.Nullable<MLEM.Misc.Direction2> rotation

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

    Returns
    Type Description
    System.Boolean

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

    OccupyFreeActionSpot(Furniture, ObjectCategory, Boolean, Nullable<Direction2>)

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

    Declaration
    public bool OccupyFreeActionSpot(Furniture furniture, ObjectCategory context = null, bool enter = false, Direction2? rotation = null)
    Parameters
    Type Name Description
    Furniture furniture

    The furniture whose object spot to occupy

    ObjectCategory context

    The category that the action spot should have

    System.Boolean enter

    Whether or not the action spot should be entered

    System.Nullable<MLEM.Misc.Direction2> rotation

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

    Returns
    Type Description
    System.Boolean

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

    OnCameraRotationChanged(Direction2, Direction2)

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

    Declaration
    public override void OnCameraRotationChanged(Direction2 oldRotation, Direction2 newRotation)
    Parameters
    Type Name Description
    MLEM.Misc.Direction2 oldRotation

    The old camera rotation

    MLEM.Misc.Direction2 newRotation

    The new camera rotation

    Overrides
    MapObject.OnCameraRotationChanged(Direction2, Direction2)

    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.

    Declaration
    public void PrepareForPermanentRemoval()

    RemoveEmotion(EmotionModifier)

    Removes the given EmotionModifier from this person's EmotionModifiers

    Declaration
    public bool RemoveEmotion(EmotionModifier type)
    Parameters
    Type Name Description
    EmotionModifier type

    The type of emotion to remove

    Returns
    Type Description
    System.Boolean

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

    RemoveMemory<T>(MemoryType)

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

    Declaration
    public int RemoveMemory<T>(MemoryType type)
    Parameters
    Type Name Description
    MemoryType type

    The memory type to match.

    Returns
    Type Description
    System.Int32

    How many memories were removed.

    Type Parameters
    Name Description
    T

    ResetToStatic(Boolean)

    Declaration
    public override bool ResetToStatic(bool thorough)
    Parameters
    Type Name Description
    System.Boolean thorough
    Returns
    Type Description
    System.Boolean
    Overrides
    MapObject.ResetToStatic(Boolean)

    RestoreNeed(NeedType, Single, ActionInfo, Single)

    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.

    Declaration
    public void RestoreNeed(NeedType type, float amount, ActionInfo info, float speedMultiplier)
    Parameters
    Type Name Description
    NeedType type

    The type of need to restore

    System.Single amount

    The amount to restore this need by

    ActionInfo info

    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.

    System.Single speedMultiplier

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

    RestoreNeed(NeedType, Single, ActionInfo, SkillType, Single)

    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.

    Declaration
    public void RestoreNeed(NeedType type, float maxAmount, ActionInfo info, SkillType requiredSkill, float speedMultiplier)
    Parameters
    Type Name Description
    NeedType type

    The type of need to restore.

    System.Single maxAmount

    The maximum amount to restore this need by.

    ActionInfo info

    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.

    SkillType requiredSkill

    The skill required to restore the given need.

    System.Single speedMultiplier

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

    SetCurrentOutfit(Int32)

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

    Declaration
    public void SetCurrentOutfit(int index)
    Parameters
    Type Name Description
    System.Int32 index

    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.

    Declaration
    public bool SetCurrentOutfit(ClothesIntention intention)
    Parameters
    Type Name Description
    ClothesIntention intention

    The intention to match the best outfit to.

    Returns
    Type Description
    System.Boolean

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

    SetHeldObject(Furniture, Boolean)

    Sets this person's held object to the given instance. Note that this resets the Furniture's position to -1, -1.

    Declaration
    public void SetHeldObject(Furniture furniture, bool fake = false)
    Parameters
    Type Name Description
    Furniture furniture

    The furniture to hold

    System.Boolean fake

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

    SetHeldObject<T>(FurnitureType, Int32[], Nullable<Guid>, Boolean)

    Sets the person's held object to the given furniture type, with the given data, and returns the created instance.

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

    The type of furniture to construct

    System.Int32[] colors

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

    System.Nullable<System.Guid> id

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

    System.Boolean fake

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

    Returns
    Type Description
    T

    The created furniture instance

    Type Parameters
    Name Description
    T

    The type that the created furniture is expected to have

    SetJob(JobType, Int32)

    Sets this person's current Job. If null is passed, the person's job gets removed.

    Declaration
    public void SetJob(JobType type, int level = 0)
    Parameters
    Type Name Description
    JobType type

    The job to start

    System.Int32 level

    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.

    Declaration
    public void SetNewId(Map map, IEnumerable<Person> possibleAdditionalRelationships = null, IEnumerable<Furniture> possibleAdditionalFurniture = null)
    Parameters
    Type Name Description
    Map map

    The map that the person will be added to

    System.Collections.Generic.IEnumerable<Person> possibleAdditionalRelationships

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

    System.Collections.Generic.IEnumerable<Furniture> possibleAdditionalFurniture

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

    Speak(SpeakStyle, Single, Single)

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

    Declaration
    public void Speak(SpeakStyle possibleStyles, float minimumSeconds = 1F, float maximumSeconds = 3F)
    Parameters
    Type Name Description
    SpeakStyle possibleStyles

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

    System.Single minimumSeconds

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

    System.Single maximumSeconds

    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

    Declaration
    public Project StartProject(Project project)
    Parameters
    Type Name Description
    Project project

    The project to start

    Returns
    Type Description
    Project

    The project that was passed, for chaining

    StopEmoting()

    Causes this person to stop displaying the current emote immediately

    Declaration
    public void StopEmoting()

    StopSpeaking()

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

    Declaration
    public void StopSpeaking()

    ToCreatedByString()

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

    Declaration
    public string ToCreatedByString()
    Returns
    Type Description
    System.String

    A "created by" string

    Update(GameTime, TimeSpan, Single)

    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, Single).

    Declaration
    public void Update(GameTime time, TimeSpan passedInGame, float speedMultiplier)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.GameTime time

    The game's time

    System.TimeSpan passedInGame

    The amount of time that has passed since the last call

    System.Single speedMultiplier

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

    UpdatePortraitIfDirty()

    Updates this person's Portrait if it needs to be updated. Note that, since this method draws the portrait using a Microsoft.Xna.Framework.Graphics.SpriteBatch, it needs to be called on the main thread.

    Declaration
    public void UpdatePortraitIfDirty()

    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.

    Declaration
    public override bool Validate()
    Returns
    Type Description
    System.Boolean

    false if the object is not valid, true otherwise

    Overrides
    MapObject.Validate()

    VisitLot(Lot)

    Marks the given lot as visited, setting LotVisitCooldown to 4 hours if the lot is the person's home lot, and 2 otherwise The passed lot is additionally marked as visible using MarkLotVisible(Lot),

    Declaration
    public void VisitLot(Lot lot)
    Parameters
    Type Name Description
    Lot lot

    The lot to mark as visited

    Events

    OnActionInitialized

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

    Declaration
    public event Action<Action, EventPhase> OnActionInitialized
    Event Type
    Type Description
    System.Action<Action, EventPhase>

    OnActionsChanged

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

    Declaration
    public event Action<Person> OnActionsChanged
    Event Type
    Type Description
    System.Action<Person>

    OnActionsCompleted

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

    Declaration
    public event Action<Action, CompletionType, EventPhase> OnActionsCompleted
    Event Type
    Type Description
    System.Action<Action, CompletionType, EventPhase>

    OnActionUpdated

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

    Declaration
    public event Person.ActionUpdateDelegate OnActionUpdated
    Event Type
    Type Description
    Person.ActionUpdateDelegate

    OnEmotionChanged

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

    Declaration
    public event Action<Person> OnEmotionChanged
    Event Type
    Type Description
    System.Action<Person>

    OnEmotionModifiersChanged

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

    Declaration
    public event Person.EmotionModifiersChangedDelegate OnEmotionModifiersChanged
    Event Type
    Type Description
    Person.EmotionModifiersChangedDelegate

    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.

    Declaration
    public event Action<List<IGoalTriggerable>> OnGetCurrentGoals
    Event Type
    Type Description
    System.Action<System.Collections.Generic.List<IGoalTriggerable>>

    OnGetEfficiencyModifier

    An event that is invoked at the end of GetEfficiencyModifier(Single, ActionInfo, SkillType, Single), 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.

    Declaration
    public event Person.EfficiencyModifierDelegate OnGetEfficiencyModifier
    Event Type
    Type Description
    Person.EfficiencyModifierDelegate

    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.

    Declaration
    public event Person.PassiveActionPriorityDelegate OnGetPassiveActionPriority
    Event Type
    Type Description
    Person.PassiveActionPriorityDelegate

    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.

    Declaration
    public event Person.WalkSpeedDelegate OnGetWalkSpeed
    Event Type
    Type Description
    Person.WalkSpeedDelegate

    OnJobChanged

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

    Declaration
    public event Action<Person> OnJobChanged
    Event Type
    Type Description
    System.Action<Person>

    OnLifeGoalChanged

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

    Declaration
    public event Action<LifeGoal.Instance> OnLifeGoalChanged
    Event Type
    Type Description
    System.Action<LifeGoal.Instance>

    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.

    Declaration
    public event Action<Person> OnNewSkillLearned
    Event Type
    Type Description
    System.Action<Person>

    OnOutfitChanged

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

    Declaration
    public event Action OnOutfitChanged
    Event Type
    Type Description
    System.Action

    OnRestoreNeed

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

    Declaration
    public event Person.RestoreNeedDelegate OnRestoreNeed
    Event Type
    Type Description
    Person.RestoreNeedDelegate

    Implements

    MLEM.Misc.IGenericDataHolder
    IUpdatingObject

    Extension Methods

    Extensions.JsonCopy<T>(T)
    ☀
    ☾
    In This Article
    Back to top
    © 2021-2023 Ellpeck Games, Top Hat Studios – Impressum – Privacy – Status
    ☀
    ☾