Class Household
[DataContract]
public class Household : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderHousehold
- Implements
-
IGenericDataHolder
- Inherited Members
-
JsonTypeSafeGenericDataHolder.GetDataKeys()
- Extension Methods
Constructors
Household(Map, Lot)
Creates a new household on the given map and lot
public Household(Map lotMap, Lot lot)
Parameters
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.
[DataMember]
public readonly HashSet<WornClothes> ClothesStorage
Field Value
DefaultMoney
The amount of money that a household has by default. If the househould is exported throughly (Export(bool, bool)), this value will be exported as well.
public const float DefaultMoney = 30000
Field Value
Description
The household's description
[DataMember]
public string Description
Field Value
DisallowNewspapers
Whether newspaper deliveries are disallowed in this household. This field is set by the ToggleNewspapers action.
[DataMember]
public bool DisallowNewspapers
Field Value
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
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
Properties
IsCurrent
A property that indicates whether or not this household is the same as CurrentHousehold
public bool IsCurrent { get; }
Property Value
Lot
The Lot that this household lives on. For exported households, this might be null.
public Lot Lot { get; }
Property Value
Members
The Person instances that are members of this household
public IEnumerable<Person> Members { get; }
Property Value
Money
The money that this household has, rounded by two digits after the decimal point
[DataMember]
public float Money { get; set; }
Property Value
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
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
Methods
Add(Person)
Adds the given person to this household
public void Add(Person person)
Parameters
person
PersonThe 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
Returns
- bool
Whether utilites are disabled
Export(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)
Parameters
thorough
boolWhether people should be reset thoroughly in ResetToStatic(bool, bool), and whether the money should be reset to DefaultMoney
custom
boolWhether the export is custom, in which case people in it will keep their unlocalized names, pronouns and descriptions.
Returns
- 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.
public float GetAverageFriendshipTo(Person person)
Parameters
person
PersonThe person to query
Returns
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.
public static bool HasAdult(IEnumerable<Person> members)
Parameters
members
IEnumerable<Person>The members that constitute the household.
Returns
- bool
Whether the household is complete.
HasMember(Guid)
Returns whether the given person Id is a part of this household
public bool HasMember(Guid person)
Parameters
person
GuidThe unique id of the person to query
Returns
- bool
true if the person is part of this household, false otherwise
Import(ExportedHousehold, 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)
Parameters
household
ExportedHouseholdThe household to import
useExistingVisitors
boolWhether existing visitors should be used, if they exist, instead of the exported household's members
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
PersonThe person to remove
removeHouseholdIfEmpty
boolWhether 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
GameTimeThe game's time
passedInGame
TimeSpanThe amount of time passed in game
speedMultiplier
floatThe 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