Table of Contents

Class Household

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A household is a set of Person instances that live together on the same Lot

[DataContract]
public class Household : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
Household
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

Household(Map, Lot, bool)

Creates a new household on the given map and lot

public Household(Map lotMap, Lot lot, bool addedThroughPopulating = false)

Parameters

lotMap Map

The map the lot is on.

lot Lot

The lot that this household should own (can be null)

addedThroughPopulating bool

Whether this household was generated automatically, and added through the PopulateLots option in PopulateLots().

Fields

AddedThroughPopulating

Whether this household was generated automatically, and added through the PopulateLots option in PopulateLots().

[DataMember]
public readonly bool AddedThroughPopulating

Field Value

bool

ClothesStorage

This household's clothing storage, which is a set of WornClothes that are not currently being worn by any members, but that are owned by this household. To add new objects to the clothes storage, simply add them to this set.

[DataMember]
public readonly HashSet<WornClothes> ClothesStorage

Field Value

HashSet<WornClothes>

DefaultMoney

The amount of money that a household has by default. If the househould is exported throughly (Export(bool, bool, bool)), this value will be exported as well.

public const float DefaultMoney = 30000

Field Value

float

Description

The household's description

[DataMember]
public string Description

Field Value

string

DisallowFriendsVisiting

Whether visits from friends are currently disallowed.

[DataMember]
public bool DisallowFriendsVisiting

Field Value

bool

DisallowNewspapers

Whether newspaper deliveries are disallowed in this household. This field is set by the ToggleNewspapers action.

[DataMember]
public bool DisallowNewspapers

Field Value

bool

DisallowStrangersVisiting

Whether visits from strangers are currently disallowed.

[DataMember]
public bool DisallowStrangersVisiting

Field Value

bool

FurnitureStorage

This household's furniture storage, which is a set of Furniture items that are not placed, but owned by this household. To add new objects to the furniture storage, simply add them to this set.

[DataMember]
public readonly HashSet<Furniture> FurnitureStorage

Field Value

HashSet<Furniture>

HasBeenPlayed

Whether this household has previously been played by the player.

[DataMember]
public bool HasBeenPlayed

Field Value

bool

RandomConstellations

A set of random constellations that will be used when new households are randomly generated in Generate(Map, Random, List<AgeGroup>, Dictionary<(int Person, int Other), Relation>). Add additional items to this list to create additional constellation options.

public static readonly List<Household.RandomConstellation> RandomConstellations

Field Value

List<Household.RandomConstellation>

UnopenedMail

A list of Mail instances that is yet to be opened. When a mail carrier delivers mail, it is automatically added to this list.

[DataMember]
public readonly List<Mail> UnopenedMail

Field Value

List<Mail>

Properties

IsCurrent

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

public bool IsCurrent { get; }

Property Value

bool

Lot

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

public Lot Lot { get; }

Property Value

Lot

Members

The Person instances that are members of this household

public IEnumerable<Person> Members { get; }

Property Value

IEnumerable<Person>

Money

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

[DataMember]
public float Money { get; set; }

Property Value

float

Name

The name of this household. The name of a household is the LastName that most people in this household have.

public string Name { get; }

Property Value

string

TotalMemberAmount

The total amount of members of this household, which includes the amount of Members, as well as unborn babies of Members.

public int TotalMemberAmount { get; }

Property Value

int

Methods

Add(Person)

Adds the given person to this household

public void Add(Person person)

Parameters

person Person

The person to add

AreUtilitiesDisabled(TimeSpan?)

Returns whether power and water should currently be considered disabled for the Lot that this household is on. This method returns true when UnopenedMail has contained a BillsMail for three or more in-game days.

public bool AreUtilitiesDisabled(TimeSpan? time = null)

Parameters

time TimeSpan?

The current time, or null to default to Time

Returns

bool

Whether utilites are disabled

Export(bool, bool, bool)

Exports this household's data into an ExportedHousehold, which can be saved to disk independently of the Map that this household is on.

public ExportedHousehold Export(bool thorough, bool custom, bool ignoreStorage = false)

Parameters

thorough bool

Whether people should be reset thoroughly in ResetToStatic(bool, bool), and whether the money should be reset to DefaultMoney

custom bool

Whether the export is custom, in which case people in it will keep their unlocalized names, pronouns and descriptions.

ignoreStorage bool

Whether the household storage should be ignored (and not exported along with this household).

Returns

ExportedHousehold

An exported household

Generate(Map, Random, List<AgeGroup>, Dictionary<(int Person, int Other), Relation>)

Generates a new random household using the given settings, and using the RandomConstellations list. Data for invoking this method can be generated using Generate(Random).

public static IEnumerable<Person> Generate(Map map, Random random, List<AgeGroup> ages, Dictionary<(int Person, int Other), Household.Relation> relations)

Parameters

map Map

The map to generate a household for.

random Random

The random instance to use for generation.

ages List<AgeGroup>

The ages of the people that should be included in the household. The length of the list also determines the amount of people in the household.

relations Dictionary<(int Person, int Other), Household.Relation>

A set of familiar relations that should be applied to the generated people. The indices in the dictionary refer to the ages of the household members.

Returns

IEnumerable<Person>

The generated household's members.

GetAgeGroups(IEnumerable<Person>)

Returns a combined flag of the age groups that the members of the given list belong to.

public static AgeGroup GetAgeGroups(IEnumerable<Person> members)

Parameters

members IEnumerable<Person>

The household members.

Returns

AgeGroup

The combined flag of age groups.

GetAverageFriendshipTo(Person)

Returns the average friendship level that the given Person has with members of this lot. This method returns an averaged value of the FriendLevel that this person has towards each member of this lot.

public float GetAverageFriendshipTo(Person person)

Parameters

person Person

The person to query

Returns

float

The average friendship level, out of Max

GetMatchingConstellations(AgeGroup)

Returns a set of constellations that match the given combined flag of AgeGroup values.

public static IEnumerable<(Household.RandomConstellation Constellation, float MatchPercentage)> GetMatchingConstellations(AgeGroup ages)

Parameters

ages AgeGroup

The ages.

Returns

IEnumerable<(Household.RandomConstellation Constellation, float MatchPercentage)>

Matching constellations, as well as a percentage that determines how well they match.

HasMember(Guid)

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

public bool HasMember(Guid person)

Parameters

person Guid

The unique id of the person to query

Returns

bool

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

Import(ExportedHousehold, bool, bool)

Imports the given ExportedHousehold into this household. Note that existing Members are not removed or replaced beforehand.

public void Import(ExportedHousehold household, bool useExistingVisitors = false, bool updateExternalPeople = true)

Parameters

household ExportedHousehold

The household to import

useExistingVisitors bool

Whether existing visitors should be used, if they exist, instead of the exported household's members

updateExternalPeople bool

Whether to call UpdateExternalPeople(ICollection<Map>, Action<string>, Action<float>) when the import is finished.

Remove(Person, bool)

Removes the given person from this household, if they're part of it

public void Remove(Person person, bool removeHouseholdIfEmpty = true)

Parameters

person Person

The person to remove

removeHouseholdIfEmpty bool

Whether the household should be removed from the underlying map if the removed member was the last

Update(GameTime, TimeSpan, float)

Updates this household and its data.

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

Parameters

time GameTime

The game's time

passedInGame TimeSpan

The amount of time passed in game

speedMultiplier float

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

Validate(Map)

This method is called when this object is loaded from disk.

public bool Validate(Map map)

Parameters

map Map

Returns

bool

false if the object is not valid, true otherwise