Class Household
Inheritance
Implements
Inherited Members
Namespace: TinyLife.World
Assembly: Tiny Life.dll
Syntax
[DataContract]
public class Household : JsonTypeSafeGenericDataHolder, IGenericDataHolder
Constructors
Household(Map, Lot)
Creates a new household on the given map and lot
Declaration
public Household(Map map, Lot lot)
Parameters
Type | Name | Description |
---|---|---|
Map | map | The map that this household is on |
Lot | lot | The lot that this household should own (can be null) |
Fields
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.
Declaration
[DataMember]
public readonly HashSet<WornClothes> ClothesStorage
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<WornClothes> |
DefaultMoney
The amount of money that a household has by default. If the househould is exported throughly (Export(Boolean)), this value will be exported as well.
Declaration
public const float DefaultMoney = 30000F
Field Value
Type | Description |
---|---|
System.Single |
Description
The household's description
Declaration
[DataMember]
public string Description
Field Value
Type | Description |
---|---|
System.String |
DisallowNewspapers
Whether newspaper deliveries are disallowed in this household. This field is set by the ToggleNewspapers action.
Declaration
[DataMember]
public bool DisallowNewspapers
Field Value
Type | Description |
---|---|
System.Boolean |
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.
Declaration
[DataMember]
public readonly HashSet<Furniture> FurnitureStorage
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<Furniture> |
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.
Declaration
[DataMember]
public readonly List<Mail> UnopenedMail
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<Mail> |
Properties
IsCurrent
A property that indicates whether or not this household is the same as CurrentHousehold
Declaration
public bool IsCurrent { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Lot
The Lot that this household lives on. For exported households, this might be null.
Declaration
public Lot Lot { get; }
Property Value
Type | Description |
---|---|
Lot |
Members
The Person instances that are members of this household
Declaration
public IEnumerable<Person> Members { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Person> |
Money
The money that this household has, rounded by two digits after the decimal point
Declaration
[DataMember]
public float Money { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Name
The name of this household. The name of a household is the LastName that most people in this household have.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Add(Person)
Adds the given person to this household
Declaration
public void Add(Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person to add |
AreUtilitiesDisabled(Nullable<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.
Declaration
public bool AreUtilitiesDisabled(TimeSpan? time = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.TimeSpan> | time | The current time, or null to default to Time |
Returns
Type | Description |
---|---|
System.Boolean | Whether utilites are disabled |
Export(Boolean)
Exports this household's data into an ExportedHousehold, which can be saved to disk independently of the Map that this household is on.
Declaration
public ExportedHousehold Export(bool thorough = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | thorough | Whether people should be reset thoroughly in ResetToStatic(Boolean), and whether the money should be reset to DefaultMoney |
Returns
Type | Description |
---|---|
ExportedHousehold | An exported household |
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.
Declaration
public float GetAverageFriendshipTo(Person person)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person to query |
Returns
Type | Description |
---|---|
System.Single | The average friendship level, out of Max |
HasAdult(IEnumerable<Person>)
Returns whether the current household is sufficiently completed. A household is completed if it contains at least one member who is an Adult.
Declaration
public static bool HasAdult(IEnumerable<Person> members)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Person> | members | The members that constitute the household. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the household is complete. |
HasMember(Guid)
Returns whether the given person Id is a part of this household
Declaration
public bool HasMember(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 |
Import(ExportedHousehold, Boolean)
Imports the given ExportedHousehold into this household. Note that existing Members are not removed or replaced beforehand.
Declaration
public void Import(ExportedHousehold household, bool useExistingVisitors = false)
Parameters
Type | Name | Description |
---|---|---|
ExportedHousehold | household | The household to import |
System.Boolean | useExistingVisitors | Whether existing visitors should be used, if they exist, instead of the exported household's members |
IsLotVisible(Lot)
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.
Declaration
public bool IsLotVisible(Lot lot)
Parameters
Type | Name | Description |
---|---|---|
Lot | lot | The lot to query |
Returns
Type | Description |
---|---|
System.Boolean | Whether the lot is visible |
MarkLotNonVisible(Lot)
Marks a lot non-visible if it's currently visible.
Declaration
public void MarkLotNonVisible(Lot lot)
Parameters
Type | Name | Description |
---|---|---|
Lot | lot | The lot to remove visibility for |
MarkLotVisible(Lot)
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.
Declaration
public void MarkLotVisible(Lot lot)
Parameters
Type | Name | Description |
---|---|---|
Lot | lot | The lot to mark as visible |
Remove(Person, Boolean)
Removes the given person from this household, if they're part of it
Declaration
public int Remove(Person person, bool removeHouseholdIfEmpty = true)
Parameters
Type | Name | Description |
---|---|---|
Person | person | The person to remove |
System.Boolean | removeHouseholdIfEmpty | Whether the household should be removed from the underlying map if the removed member was the last |
Returns
Type | Description |
---|---|
System.Int32 | The amount of remaining members of this household |
Update(GameTime, TimeSpan, Single)
Updates this household, ticking down the lot visibility times
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 passed in game |
System.Single | speedMultiplier | 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.
Declaration
public bool Validate(Map map)
Parameters
Type | Name | Description |
---|---|---|
Map | map |
Returns
Type | Description |
---|---|
System.Boolean | false if the object is not valid, true otherwise |