Household - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife.World

Household Class

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

public class Household : MLEM.Misc.GenericDataHolder

Inheritance System.Object 🡒 MLEM.Misc.GenericDataHolder 🡒 Household

Constructors

Household.Household(Map, Lot) Constructor

Creates a new household on the given map and lot

public Household(TinyLife.World.Map map, TinyLife.World.Lot lot);

Parameters

map Map
The map that this household is on

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

Fields

Household.ClothesStorage Field

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

public readonly HashSet<WornClothes> ClothesStorage;

Field Value

System.Collections.Generic.HashSet<WornClothes>

Household.FurnitureStorage Field

This household's furniture storage, which is a set of Furniture items that are not placed, but owned by this household

public readonly HashSet<Furniture> FurnitureStorage;

Field Value

System.Collections.Generic.HashSet<Furniture>

Household.UnopenedMail Field

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

public readonly List<Mail> UnopenedMail;

Field Value

System.Collections.Generic.List<Mail>

Properties

Household.IsCurrent Property

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

public bool IsCurrent { get; }

Property Value

System.Boolean

Household.Lot Property

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

public TinyLife.World.Lot Lot { get; }

Property Value

Lot

Household.Members Property

The Person instances that are members of this household

public System.Collections.Generic.IEnumerable<TinyLife.Objects.Person> Members { get; }

Property Value

System.Collections.Generic.IEnumerable<Person>

Household.Money Property

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

public float Money { get; set; }

Property Value

System.Single

Household.Name Property

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

System.String

Methods

Household.Add(Person) Method

Adds the given person to this household

public void Add(TinyLife.Objects.Person person);

Parameters

person Person
The person to add

Household.AreUtilitiesDisabled(Nullable<TimeSpan>) Method

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(System.Nullable<System.TimeSpan> time=null);

Parameters

time System.Nullable<System.TimeSpan>
The current time, or null to default to CurrentTime

Returns

System.Boolean
Whether utilites are disabled

Household.Export() Method

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

public TinyLife.World.ExportedHousehold Export();

Returns

ExportedHousehold
An exported household

Household.GetAverageFriendshipTo(Person) Method

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(TinyLife.Objects.Person person);

Parameters

person Person
The person to query

Returns

System.Single
The average friendship level, out of Max

Household.HasMember(Guid) Method

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

public bool HasMember(System.Guid person);

Parameters

person System.Guid
The unique id of the person to query

Returns

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

Household.Import(ExportedHousehold) Method

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

public void Import(TinyLife.World.ExportedHousehold household);

Parameters

household ExportedHousehold
The household to import

Household.IsLotVisible(Lot) Method

Returns whether the given lot is considered visible to this household
Note that passing this household's Lot will always cause this method to return true.

public bool IsLotVisible(TinyLife.World.Lot lot);

Parameters

lot Lot
The lot to query

Returns

System.Boolean
Whether the lot is visible

Household.MarkLotNonVisible(Lot) Method

Marks a lot non-visible if it's currently visible.

public void MarkLotNonVisible(TinyLife.World.Lot lot);

Parameters

lot Lot
The lot to remove visibility for

Household.MarkLotVisible(Lot) Method

Marks the given lot as visible for members of this household.
VisitLot(Lot) should be used in favor of this method in most cases.
By default, visibility lasts for 30 seconds of real time.

public void MarkLotVisible(TinyLife.World.Lot lot);

Parameters

lot Lot
The lot to mark as visible

Household.Remove(Person) Method

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

public void Remove(TinyLife.Objects.Person person);

Parameters

person Person
The person to remove

Household.Update(GameTime, TimeSpan, GameSpeed) Method

Updates this household, ticking down the lot visibility times

public void Update(Microsoft.Xna.Framework.GameTime time, System.TimeSpan passedInGame, TinyLife.GameSpeed speed);

Parameters

time Microsoft.Xna.Framework.GameTime
The game's time

passedInGame System.TimeSpan
The amount of time passed in game

speed GameSpeed
The game's speed

Household.Validate(Map) Method

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

public bool Validate(TinyLife.World.Map map);

Parameters

map Map

Returns

System.Boolean
false if the object is not valid, true otherwise