TinyLifeExampleMod/Api/TinyLife/Objects/Person.md

26 KiB

Person

Namespace: TinyLife > Objects

Assembly: Tiny Life.dll

Implements IGenericDataHolder, IUpdatingObject

Summary

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

Constructors

Name Summary
Person ( Map, Vector2 ) Creates a new person with the given settings

Fields

Type Name Summary
List<ValueTuple<Action, Boolean>> 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 was started automatically (true) or manually (false). Use TinyLife.Objects.Person.EnqueueAction(TinyLife.Actions.ActionType,TinyLife.Actions.ActionInfo,System.Boolean,System.Nullable{TinyLife.Actions.ActionVariety},System.Boolean,System.Boolean) and TinyLife.Objects.Person.CancelAction(TinyLife.Actions.Action,TinyLife.Actions.Action,System.Boolean) to modify this list.
Boolean AnimateHeldObject Whether or not the TinyLife.Objects.Person.GetHeldObject``1 should be animated with this person's movement animation. Note that this value is not saved to disk, and is reset to true every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame.
List<Action> CurrentActions The actions that are currently being executed by this person. Use TinyLife.Objects.Person.EnqueueAction(TinyLife.Actions.ActionType,TinyLife.Actions.ActionInfo,System.Boolean,System.Nullable{TinyLife.Actions.ActionVariety},System.Boolean,System.Boolean) and TinyLife.Objects.Person.CancelAction(TinyLife.Actions.Action,TinyLife.Actions.Action,System.Boolean) to modify this list.
Pose CurrentPose This person's current TinyLife.Objects.Person.Pose. Note that this value is not saved to disk, and is reset to TinyLife.Objects.Person.Pose.Standing every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame.
List<Instance> EmotionModifiers The TinyLife.Emotions.EmotionModifier.Instance objects that are currently applied to this person. To access this collection efficiently, use TinyLife.Objects.Person.AddEmotion(TinyLife.Emotions.EmotionModifier,System.Int32,System.TimeSpan), TinyLife.Objects.Person.RemoveEmotion(TinyLife.Emotions.EmotionModifier) and TinyLife.Objects.Person.LowerEmotion(TinyLife.Emotions.EmotionType,System.Single,TinyLife.GameSpeed).
String FirstName This person's first name
Guid LastBedSleptIn The id of the last bed TinyLife.Objects.Furniture that this person has slept in, or System.Guid.Empty if no such bed exists
String LastName This person's last name
Dictionary<String, Need> Needs This person's TinyLife.Need data. When this person is instantiated, all of their needs are gathered from TinyLife.NeedType.Types automatically. To access this collection efficiently, use TinyLife.Objects.Person.GetNeed(TinyLife.NeedType) and TinyLife.Objects.Person.GetNeedPercentage(TinyLife.NeedType).
HashSet<String> PersonalityTypes The names of the TinyLife.PersonalityType values that this person has. To access this collection efficiently, use TinyLife.Objects.Person.HasPersonality(TinyLife.PersonalityType).
RenderTarget2D 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.
List<Relationship> Relationships This person's TinyLife.Relationship data. To access this collection efficiently, use TinyLife.Objects.Person.GetRelationship(TinyLife.Objects.Person,System.Boolean) and TinyLife.Objects.Person.ChangeFriendship(TinyLife.Objects.Person,System.Single).
Direction2 Rotation The MLEM.Misc.Direction2 that this person is currently facing in
Dictionary<String, Skill> Skills This person's TinyLife.Skills.Skill data. To access this collection efficiently, use TinyLife.Objects.Person.GetSkill(TinyLife.Skills.SkillType), TinyLife.Objects.Person.GetSkillLevel(TinyLife.Skills.SkillType) and TinyLife.Objects.Person.GainSkill(TinyLife.Skills.SkillType,System.Single,TinyLife.GameSpeed).
Dictionary<ClothesLayer, WornClothes> WornClothes The TinyLife.Objects.Person.WornClothes that this person is currently wearing on each of their TinyLife.Objects.ClothesLayers. If a person is not wearing any clothes on any given layer, this dictionary will not contain it.
ClothesLayer WornLayers The TinyLife.Objects.ClothesLayer flags that represent what layers this person is currently wearing. Note that this value is not saved to disk, and is reset to ~0 (every layer) every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame.

Properties

Type Name Summary
IEnumerable<Action> AllActions A concatenation of TinyLife.Objects.Person.CurrentActions and TinyLife.Objects.Person.ActionQueue that represents all actions that the current person has knowledge about
Emote CurrentEmote The TinyLife.Actions.Emote that this person is currently displaying. Use TinyLife.Objects.Person.DisplayEmote(TinyLife.Actions.EmoteCategory) to modify this property.
Room CurrentRoom The TinyLife.World.Room that this person is currently in
Int32 CurrentRoomDecorativeRating The decorative rating of the TinyLife.Objects.Person.CurrentRoom, resulting from the TinyLife.Objects.FurnitureType.TypeSettings.DecorativeRating of the contained furniture
Point DrawSize The size, in draw space pixels, that this person's texture takes up. This is gathered from the TinyLife.Objects.ClothesLayer.Body layer of its texture data.
TimeSpan EmoteTime The amount of time left for displaying TinyLife.Objects.Person.CurrentEmote. Use TinyLife.Objects.Person.DisplayEmote(TinyLife.Actions.EmoteCategory) to modify this property.
EmotionType Emotion The TinyLife.Emotions.EmotionType that this person currently has, resulting from their current TinyLife.Objects.Person.EmotionModifiers
String FullName This person's full name, which is a concatenation of their TinyLife.Objects.Person.FirstName and TinyLife.Objects.Person.LastName.
Household Household The TinyLife.Objects.Person.Household that this person is a part of
Boolean IsMoving This property stores whether this person is currently moving. A person is considered moving when their TinyLife.Objects.MapObject.Position has changed since the last update frame.
Job Job The TinyLife.Objects.Person.Job that this person currently has. To edit this value, use TinyLife.Objects.Person.SetJob(TinyLife.Goals.JobType).
Lot LastVisitedLot The TinyLife.World.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 TinyLife.Objects.Person.VisitLot(TinyLife.World.Lot).
TimeSpan LotVisitCooldown The amount of time that has to pass before this person can visit another lot. If TinyLife.Objects.Person.LastVisitedLot is set using TinyLife.Objects.Person.VisitLot(TinyLife.World.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.
ActionSpot OccupiedActionSpot The TinyLife.Objects.ActionSpot of the TinyLife.Objects.Person.OccupiedFurniture that this person is currently occupying. Note that this value is not saved to disk, and is reset to null every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame. To edit this value, use TinyLife.Objects.Person.OccupyActionSpot(TinyLife.Objects.Furniture,TinyLife.Objects.ActionSpot,System.Boolean,System.Nullable{MLEM.Misc.Direction2}).
Furniture OccupiedFurniture The TinyLife.Objects.Furniture that this person is currently occupying. Note that this value is not saved to disk, and is reset to null every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame. To edit this value, use TinyLife.Objects.Person.OccupyActionSpot(TinyLife.Objects.Furniture,TinyLife.Objects.ActionSpot,System.Boolean,System.Nullable{MLEM.Misc.Direction2}).
Vector2 VisualPosition The visual position of this person, which is influenced by their TinyLife.Objects.MapObject.Position and a visual override that can be set using TinyLife.Objects.Person.OccupyActionSpot(TinyLife.Objects.Furniture,TinyLife.Objects.ActionSpot,System.Boolean,System.Nullable{MLEM.Misc.Direction2}). Note that, if changed using TinyLife.Objects.Person.OccupyActionSpot(TinyLife.Objects.Furniture,TinyLife.Objects.ActionSpot,System.Boolean,System.Nullable{MLEM.Misc.Direction2}), this value is not saved to disk, and is reset to TinyLife.Objects.MapObject.Position every TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) frame. Also note that the visual position does not affect collision detection or most interactions.

Methods

Return Name Summary
Boolean AddEmotion ( EmotionModifier, Int32, TimeSpan ) Adds the given TinyLife.Emotions.EmotionModifier with the given intensity and time
Boolean CancelAction ( Action, Action, Boolean ) Tries to cancel the given action, removing it from TinyLife.Objects.Person.CurrentActions or TinyLife.Objects.Person.ActionQueue in the process. If the action in question cannot be canceled, this method returns false.
void ChangeFriendship ( Person, Single ) Changes the TinyLife.Relationship.FriendLevel``TinyLife.Relationship wit the given person by the given amount. Additionally, a friendship TinyLife.Objects.Particle is displayed and a TinyLife.Uis.Notifications is displayed if the friendship type changes.
void ChangeRomance ( Person, Single ) Changes the TinyLife.Relationship.RomanceLevel``TinyLife.Relationship wit the given person by the given amount. Additionally, a romance TinyLife.Objects.Particle is displayed.
void CleanUpForDeletion ( ) Cleans this person's data up to ready this person for deletion. This removes the person from its TinyLife.Objects.Person.Household and removes all TinyLife.Objects.Person.Relationships from other people that are associated with this person.
void DepleteNeed ( NeedType, Single, GameSpeed ) Depletes this person's TinyLife.Need with the given TinyLife.NeedType by the given amount Note that, when the "NoNeed" cheat is active, this method does nothing.
void Die ( DeathReason, Boolean )
void DisplayEmote ( EmoteCategory ) Causes this person to display a TinyLife.Actions.Emote over its head for 1 to 3 seconds
void Draw ( GameTime, SpriteBatch, Vector2, Nullable<Color> )
void DrawUi ( SpriteBatch, Vector2, Single, Direction2 ) Renders this person on a ui level rather than a world level
Action EnqueueAction ( ActionType, ActionInfo, Boolean, Nullable<ActionVariety>, Boolean, Boolean ) Enqueues the given action into TinyLife.Objects.Person.ActionQueue to be executed later.
Task<Stack<Point>> FindPathAsync ( Point, Point, GetCost<Point>, Nullable<Boolean> )
void 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 TinyLife.Objects.Person.Household is current or if the TinyLife.Objects.MapObject.CurrentLot is visible to the TinyLife.GameImpl.CurrentHousehold.
void GainSkill ( SkillType, Single, GameSpeed ) Causes this person to gain the skill with the given TinyLife.Skills.SkillType and raises it by the given amount. Note that TinyLife.Objects.Person.PersonalityTypes influence the skinn gain automatically.
ObjectCategory GetCategories ( Person )
Single GetEfficiencyModifier ( 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 level of the passed `` as well as this person's TinyLife.Objects.Person.Emotion and TinyLife.Objects.Person.PersonalityTypes.
ActionInfo GetFreeTalkingSpot ( Person ) Returns an TinyLife.Actions.ActionInfo for a location that this person can be talked to from. This method returns the best possible location from TinyLife.Objects.Person.GetFreeTalkingSpots as an TinyLife.Actions.ActionInfo.
IEnumerable<Vector2> GetFreeTalkingSpots ( ) Returns a set of locations, in world space, that this person can be talked to from while standing in its current location
ActionInfo GetHeldActionInfo ( ) Returns a TinyLife.Actions.ActionInfo for the TinyLife.Objects.Person.GetHeldObject``1, or null if there is none.
T GetHeldObject ( ) Returns the TinyLife.Objects.Furniture that this person is currently holding in their hands. Note that, if the held object is not of the required type type, null is returned.
Vector2 GetHomeLocation ( ) Shorthand method for TinyLife.World.Lot.GetHomeLocation(TinyLife.Objects.Person) that returns the home location of this person's TinyLife.Objects.Person.Household's lot
Tooltip GetHoverInfo ( )
Single GetNeed ( NeedType ) Returns the TinyLife.Need``TinyLife.Need.Value of the given type for this person
Single GetNeedPercentage ( NeedType ) Returns the TinyLife.Need``TinyLife.Need.Percentage of the given type for this person
Relationship GetRelationship ( Person, Boolean ) Returns the current relationship level for the given TinyLife.Objects.Person. Note that this returns this person's TinyLife.Objects.Person.Relationships entry, which might have different values from the passed TinyLife.Objects.Person's.
RelationshipType GetRelationshipType ( Person ) Returns the TinyLife.RelationshipType that this person has to the given TinyLife.Objects.Person. This is a helper method that returns the relationship type of TinyLife.Objects.Person.GetRelationship(TinyLife.Objects.Person,System.Boolean), or TinyLife.RelationshipType.Acquaintances if there is no relationship.
Int32 GetSkillLevel ( SkillType ) Returns the level of the TinyLife.Skills.Skill of the given type that this person has. If this person does not have the given skill, 0 is returned.
Single GetWalkSpeed ( ) Returns this person's current walk speed, per update frame. The walk speed is influenced by their TinyLife.Objects.Person.PersonalityTypes and TinyLife.Objects.Person.Emotion.
Boolean HasEmotionModifier ( EmotionModifier ) Returns whether this person has the given TinyLife.Emotions.EmotionModifier in their TinyLife.Objects.Person.EmotionModifiers list
Boolean HasPersonality ( PersonalityType ) Returns whether this person has the given TinyLife.PersonalityType
Boolean HasSkillLevel ( SkillType, Int32 ) Returns whether this person has a TinyLife.Skills.Skill of the given type and whether its value is high enough.
Boolean Intersects ( RectangleF )
Boolean IsCloseForTalking ( Vector2 ) Returns true if `` 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.
Boolean LowerEmotion ( EmotionType, Single, GameSpeed ) Lowers any TinyLife.Objects.Person.EmotionModifiers of the given TinyLife.Emotions.EmotionType by the given percentage. Each modifier's TinyLife.Emotions.EmotionModifier.Instance.Time will be lowered by the percentage of their TinyLife.Emotions.EmotionModifier.Instance.TotalTime.
void OccupyActionSpot ( Furniture, ActionSpot, Boolean, Nullable<Direction2> ) Causes the given action spot of the given furniture to be marked as occupied. Optionally, the TinyLife.Objects.Person.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 TinyLife.Objects.Person.Update(Microsoft.Xna.Framework.GameTime,System.TimeSpan,TinyLife.GameSpeed) call.
Boolean RemoveEmotion ( EmotionModifier ) Removes the given TinyLife.Emotions.EmotionModifier from this person's TinyLife.Objects.Person.EmotionModifiers
void ResetToStatic ( Boolean ) Resets this person to a static version of itself. This action clears TinyLife.Objects.Person.AllActions, clears the TinyLife.Objects.Person.LastVisitedLot, resets all TinyLife.Objects.Person.Relationships and restores all TinyLife.Objects.Person.Needs to their default value. This method is used by map and household ex- and imports.
void RestoreNeed ( NeedType, Single, GameSpeed ) Restores this person's TinyLife.Need of the given type by the given amount
T SetHeldObject ( FurnitureType, Int32[], Nullable<Guid> ) Sets the person's held object to the given furniture type, with the given data, and returns the created instance.
void SetHeldObject ( Furniture ) Sets this person's held object to the given instance. Note that this resets the TinyLife.Objects.Furniture's position to -1, -1.
void SetJob ( JobType ) Sets this person's current TinyLife.Objects.Person.Job. If null is passed, the person's job gets removed.
void StopEmoting ( ) Causes this person to stop displaying the current emote immediately
String ToCreatedByString ( ) Returns a string representation of this person using the localized "Created by:" prefix
void Update ( GameTime, TimeSpan, GameSpeed )
Boolean Validate ( )
void VisitLot ( Lot ) Marks the given lot as visited, setting TinyLife.Objects.Person.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 TinyLife.World.Household.MarkLotVisible(TinyLife.World.Lot),

Events

Type Name Summary
Action<Person> OnActionsChanged An event that is invoked when the TinyLife.Objects.Person.CurrentActions or TinyLife.Objects.Person.ActionQueue of this person changed
Action<Person> OnEmotionModifiersChanged An event that is invoked when the TinyLife.Objects.Person.EmotionModifiers change
Action<Person> OnJobChanged An event that is invoked when the TinyLife.Objects.Person.Job changes
Action<Person> OnNewSkillLearned An event that is invoked when the TinyLife.Objects.Person.Skills list gains a new entry, meaning the person learned a new skill

Static Methods

Return Name Summary
Boolean CanWalkHere ( Map, Point, Point ) Returns whether a TinyLife.Objects.Person can walk between the and the. Note that, since method does not do any pathfinding, the two positions passed have to be adjacent or directly diagonal to each other.