Class Relationship
A relationship is a connection between two Person objects. It should be noted that a relationship is not always the same between a person and the linked OtherPerson. What this means is that A can have a good relationship to B, but B can have a less good relationship to A.
Inheritance
Implements
Inherited Members
Namespace: TinyLife
Assembly: Tiny Life.dll
Syntax
[DataContract]
public class Relationship : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Fields
Dating
This value is set to true if this relationship is a romantic relationship
Declaration
[DataMember]
public bool Dating
Field Value
Type | Description |
---|---|
System.Boolean |
HadFirstKiss
This value is set to true if this relationship's partners have invoked the Kiss action at least once.
Declaration
[DataMember]
public bool HadFirstKiss
Field Value
Type | Description |
---|---|
System.Boolean |
KnownPersonalityTypes
A set of PersonalityType objects that are known about this relationship's OtherPerson. This collection is populated by AskAboutPersonality.
Declaration
[DataMember]
public readonly HashSet<PersonalityType> KnownPersonalityTypes
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<PersonalityType> |
Max
The maximum value that a relationship level can have
Declaration
public const float Max = 100000F
Field Value
Type | Description |
---|---|
System.Single |
MaxRecentSocialsAmount
The maximum amount of social actions that are "remembered" in this relationship. This is equivalent to RecentActions, but related to this relationship only.
Declaration
public const int MaxRecentSocialsAmount = 10
Field Value
Type | Description |
---|---|
System.Int32 |
PassiveFriendReduction
The amount of points (out of Max) that are removed from each relationship's FriendLevel each update frame
Declaration
public const float PassiveFriendReduction = 0.01F
Field Value
Type | Description |
---|---|
System.Single |
PassiveRomanceReduction
The amount of points (out of Max) that are removed from each relationship's RomanceLevel each update frame
Declaration
public const float PassiveRomanceReduction = 0.015F
Field Value
Type | Description |
---|---|
System.Single |
Properties
DisplayString
An (unlocalized) string that represents a written version of this relationship's status. If Dating is true, the string "Dating" will be returned. Otherwise, Type is returned as a string.
Declaration
public string DisplayString { get; }
Property Value
Type | Description |
---|---|
System.String |
FriendLevel
The current amount of friendship points (out of Max) that this relationship has. This value is automatically clamped between -Max and Max.
Declaration
public float FriendLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
FriendPercentage
The FriendLevel of this relationship, divided by Max, yielding a percentage between -1 and 1 of how good this friendship is
Declaration
public float FriendPercentage { get; }
Property Value
Type | Description |
---|---|
System.Single |
Genealogy
The GenealogyType of this relationship. Note that the genealogy's value works in the following direction: "I am the [Genealogy] of [OtherPerson]". Note that OtherPerson will always have the GenealogyType's GetOpposite(GenealogyType).
Declaration
[DataMember]
public GenealogyType Genealogy { get; }
Property Value
Type | Description |
---|---|
GenealogyType |
OtherPerson
The System.Guid of the person that this relationship is linked to. To easily retrieve the matching Person instance, see Partner.
Declaration
[DataMember]
public Guid OtherPerson { get; }
Property Value
Type | Description |
---|---|
System.Guid |
Partner
The actual other person involved in the relationship. This is a computed property that returns the Person on the map with the OtherPerson id.
Declaration
public Person Partner { get; }
Property Value
Type | Description |
---|---|
Person |
RomanceLevel
The current amount of romance points (out of Max) that this relationship has. This value is automatically clamped between 0 and Max. Note that, for aromantic people, getting and setting this value always gets and sets FriendLevel instead.
Declaration
public float RomanceLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
RomancePercentage
The RomanceLevel of this relationship, divided by Max, yielding a percentage between 0 and 1 of how good this relationship's romance level is
Declaration
public float RomancePercentage { get; }
Property Value
Type | Description |
---|---|
System.Single |
Type
The RelationshipType that this relationship has, based on the current FriendLevel.
Declaration
public RelationshipType Type { get; }
Property Value
Type | Description |
---|---|
RelationshipType |
Methods
AddRecentSocial(ActionType)
Adds the given action to the list of recent social actions for this relationship. If the list's length exceeds MaxRecentSocialsAmount, the least recent socials will be removed. Note that this method is automatically invoked in EvaluateFully(SocialAction).
Declaration
public void AddRecentSocial(ActionType action)
Parameters
Type | Name | Description |
---|---|---|
ActionType | action | The action to add to the recent socials list |
CreatePanel(Person, Person, Relationship, Vector2)
Creates a MLEM.Ui.Elements.Group with a MLEM.Ui.Elements.Panel in it that contains information about the given relationship
.
This method also calls OnRelationshipPanel.
Declaration
public static Group CreatePanel(Person person, Person otherPerson, Relationship relationship, Vector2 size)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person who has the |
Person | otherPerson | The partner of the |
Relationship | relationship | The relationship. |
Microsoft.Xna.Framework.Vector2 | size | The MLEM.Ui.Elements.Element.Size that the MLEM.Ui.Elements.Panel should have. |
Returns
Type | Description |
---|---|
MLEM.Ui.Elements.Group | A MLEM.Ui.Elements.Group that contains the MLEM.Ui.Elements.Panel created. |
GetRecentSocialAmount(ActionType)
Returns the amount of times that the given ActionType has been used out of the last MaxRecentSocialsAmount social actions in this relationship
Declaration
public int GetRecentSocialAmount(ActionType action)
Parameters
Type | Name | Description |
---|---|---|
ActionType | action |
Returns
Type | Description |
---|---|
System.Int32 |
GetSocialEffectiveness(ActionType)
Returns the effectiveness percentage that the given ActionType has right now, based on the amount of times that it has been used previously. In TalkAction, this effectiveness is used to reduce the friendship and romance gain based on the "boringness" of an action.
Declaration
public float GetSocialEffectiveness(ActionType action)
Parameters
Type | Name | Description |
---|---|---|
ActionType | action | The action whose effectiveness to query |
Returns
Type | Description |
---|---|
System.Single | The social effectiveness, which is a percentage between 0 and 1 |
PopulateTooltip(Person, Person, Relationship, Tooltip)
Populates the given tooltip
with information about the given relationship
.
This method also takes the OnRelationshipTooltip event into account.
Declaration
public static void PopulateTooltip(Person person, Person otherPerson, Relationship relationship, Tooltip tooltip)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person who has the |
Person | otherPerson | The partner of the |
Relationship | relationship | The relationship. |
MLEM.Ui.Elements.Tooltip | tooltip | The tooltip to populate. |
ResetToStatic(Boolean, Boolean)
Resets this relationship to a more basic, static version. This method is used when a map or household is exported, and by the ExportHousehold cheat.
Declaration
public void ResetToStatic(bool thorough, bool sameHousehold)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | thorough | Whether the relationship should be reset thoroughly, causing the friendship level and romance level to be averaged out |
System.Boolean | sameHousehold | Whether the two people that are part of this relationship are in the same household |
SetGenealogy(GenealogyType, Boolean)
Sets this relationship's Genealogy, additionally updating all transitive relationships' genealogies using GetTransitive(GenealogyType, GenealogyType).
Declaration
public void SetGenealogy(GenealogyType genealogy, bool overwriteExistingTransitive)
Parameters
Type | Name | Description |
---|---|---|
GenealogyType | genealogy | The genealogy to use for this relationship. |
System.Boolean | overwriteExistingTransitive | Whether the genealogies of existing transitive relationships should be updated, even if they are already set to a non-Unrelated relationship. |
Validate(Person)
Validates this relationship, setting its internal person reference to the given Person. This method is automatically called for all of their relationships in Validate().
Declaration
public void Validate(Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person that this relationship belongs to |
Events
OnRelationshipPanel
An event that is raised when a relationship panel is created in CreatePanel(Person, Person, Relationship, Vector2). Use this event to add custom information to a relationship panel.
Declaration
public static event Action<(Person Person, Person Other, Relationship Relationship, Group Group)> OnRelationshipPanel
Event Type
Type | Description |
---|---|
System.Action<System.ValueTuple<Person, Person, Relationship, MLEM.Ui.Elements.Group>> |
OnRelationshipTooltip
An event that is raised when a relationship tooltip is populated in PopulateTooltip(Person, Person, Relationship, Tooltip). Use this event to add custom information to a relationship tooltip.
Declaration
public static event Action<(Person Person, Person Other, Relationship Relationship, Tooltip Tooltip)> OnRelationshipTooltip
Event Type
Type | Description |
---|---|
System.Action<System.ValueTuple<Person, Person, Relationship, MLEM.Ui.Elements.Tooltip>> |