Class Household
[DataContract]
public class Household : JsonTypeSafeGenericDataHolder, IGenericDataHolder
- Inheritance
-
JsonTypeSafeGenericDataHolderHousehold
- 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
MapThe map the lot is on.
lot
LotThe lot that this household should own (can be null)
addedThroughPopulating
boolWhether 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
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, 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
DisallowFriendsVisiting
Whether visits from friends are currently disallowed.
[DataMember]
public bool DisallowFriendsVisiting
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
DisallowStrangersVisiting
Whether visits from strangers are currently disallowed.
[DataMember]
public bool DisallowStrangersVisiting
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
HasBeenPlayed
Whether this household has previously been played by the player.
[DataMember]
public bool HasBeenPlayed
Field Value
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
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, 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
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.
ignoreStorage
boolWhether 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
MapThe map to generate a household for.
random
RandomThe 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
PersonThe person to query
Returns
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
AgeGroupThe 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
GuidThe 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
ExportedHouseholdThe household to import
useExistingVisitors
boolWhether existing visitors should be used, if they exist, instead of the exported household's members
updateExternalPeople
boolWhether 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
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