Game.Buildings.BuildingHappinessFactor
Assembly: Assembly-CSharp (typical game assembly; confirm with your build if different)
Namespace: Game.Buildings
Type: enum
Base: System.Enum
Summary: Enumeration of the different factors that can influence a building's happiness (satisfaction) in Cities: Skylines 2. Each enum value represents a distinct source or reason that can increase or decrease the happiness/priority of a building (residential, commercial, industrial, service, etc.). The final member Count is a sentinel value representing the number of factors.
Fields
-
Telecom
Represents happiness adjustments coming from telecommunications/connectivity (e.g., internet/telecom services). -
Crime
Represents the effect of crime level on the building's happiness. -
AirPollution
Represents the impact of air pollution on building happiness. -
Electricity
Represents the availability/quality of electricity service affecting happiness. -
Healthcare
Represents the effect of healthcare service coverage/quality on happiness. -
GroundPollution
Represents the effect of ground/soil pollution on happiness. -
NoisePollution
Represents the impact of noise pollution on building happiness. -
Water
Represents the availability/quality of water service affecting happiness. -
WaterPollution
Represents the impact of water pollution on building happiness (e.g., contaminated water sources). -
Sewage
Represents sewage service effects on building happiness. -
Garbage
Represents influence from garbage collection/service and cleanliness on happiness. -
Entertainment
Represents happiness contributed by entertainment services and leisure availability. -
Education
Represents the effect of education services/levels on building happiness. -
Mail
Represents postal/mail service effects on building happiness. -
Welfare
Represents welfare or social support effects on building happiness. -
Leisure
Represents leisure-related amenities and their effect on happiness (parks, plazas, etc.). -
Tax
Represents the influence of taxes (tax level) on building happiness. -
Materials
Represents the availability of materials (usually relevant for production/industrial buildings) affecting happiness or productivity. -
Customers
Represents the availability of customers (relevant for commercial/commercial-service buildings) affecting satisfaction. -
UneducatedWorkers
Represents effects tied to presence/shortage of uneducated (low-skilled) workers. -
EducatedWorkers
Represents effects tied to presence/shortage of educated (high-skilled) workers. -
Apartment
Represents apartment-specific factors (e.g., apartment quality or apartment-related modifiers). -
MissingWorkers
Represents penalties from missing workers (worker shortages reducing happiness/operation). -
Efficiency
Represents operational efficiency effects on building happiness (e.g., production efficiency). -
InputCosts
Represents negative effects from high input costs for businesses/factories. -
OutputCosts
Represents effects tied to output costs or market conditions for produced goods. -
ElectricityFee
Represents happiness impact from electricity fees (costs charged to the building). -
WaterFee
Represents happiness impact from water fees (costs charged to the building). -
Count
Sentinel value representing the total number of happiness factors. Useful for array sizing and iteration bounds.
Properties
- None. This is a plain enum type; there are no properties.
Constructors
- None. Enums do not define explicit constructors.
Methods
- None defined on the enum itself. Use standard System.Enum utilities (Enum.GetValues, Enum.IsDefined, etc.) where needed.
Usage Example
// Example: applying a modifier based on a happiness factor
using System;
using Game.Buildings;
public void ApplyHappinessModifier(BuildingHappinessFactor factor, ref float happiness)
{
switch (factor)
{
case BuildingHappinessFactor.Crime:
happiness -= 10f; // crime reduces happiness
break;
case BuildingHappinessFactor.Education:
happiness += 5f; // education improves happiness
break;
case BuildingHappinessFactor.ElectricityFee:
happiness -= 2f; // fees slightly reduce happiness
break;
// handle other cases...
default:
break;
}
}
// Iterating over all factors (useful for profiling or initializing arrays)
int factorCount = (int)BuildingHappinessFactor.Count;
for (int i = 0; i < factorCount; i++)
{
var factor = (BuildingHappinessFactor)i;
// initialize arrays, tooltips, or UI elements per factor
}
Notes: - Use BuildingHappinessFactor.Count as a safe upper bound when creating arrays indexed by factor. - Many factors are context-specific (e.g., Materials, Customers, MissingWorkers) and are typically relevant to industry/commercial/service building logic. Adjust handling accordingly in your mod.