Game.Prefabs.ZonePreferenceData
Assembly: Game
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, IComponentData, IQueryTypeParameter
Summary:
ZonePreferenceData is a plain data container (IComponentData) used to store weightings and neutral values that represent how different zone types (Residential, Commercial, Industrial, Office) value various factors when evaluating land/zone desirability. Each field is a float value representing either the significance (weight) of a factor for a zone type or a neutral baseline land-value metric. Mods/systems that evaluate zone suitability can read these values from entities to influence zoning placement, demand scoring, or AI decisions.
Fields
-
public float m_ResidentialSignificanceServices
Significance (weight) that residential zones give to proximity/availability of services. Higher values increase the importance of services in residential desirability calculations. -
public float m_ResidentialSignificanceWorkplaces
Significance for the presence of nearby workplaces when computing residential desirability (commuting/access to jobs). -
public float m_ResidentialSignificanceLandValue
Weight that residential zones assign to land value in their desirability score. -
public float m_ResidentialSignificancePollution
Weight representing how strongly pollution reduces residential desirability. Typically higher means pollution penalizes residential zones more. -
public float m_ResidentialNeutralLandValue
A neutral/baseline land-value reference used for residential evaluation (e.g., a baseline to compare actual land value against). -
public float m_CommercialSignificanceConsumers
Significance that commercial zones assign to the presence/number of consumers (demand). -
public float m_CommercialSignificanceCompetitors
Weight representing how much nearby competing commercial areas affect commercial desirability. -
public float m_CommercialSignificanceWorkplaces
Significance of nearby workplaces for commercial zones (employees or synergy with workplaces). -
public float m_CommercialSignificanceLandValue
Weight that commercial zones give to land value when scoring site suitability. -
public float m_CommercialNeutralLandValue
Neutral/baseline land-value reference for commercial zone evaluations. -
public float m_IndustrialSignificanceInput
Significance representing importance of access to inputs (raw materials, logistics) for industrial zones. -
public float m_IndustrialSignificanceOutside
Significance reflecting the effect of outside connections or external factors (e.g., exports, transport links) for industrial zones. -
public float m_IndustrialSignificanceLandValue
Weight industrial zones give to land value during desirability calculation. -
public float m_IndustrialNeutralLandValue
Neutral/baseline land-value reference for industrial evaluations. -
public float m_OfficeSignificanceEmployees
Significance for availability of employees or workforce when evaluating office zone desirability. -
public float m_OfficeSignificanceServices
Weight offices assign to nearby services (e.g., retail, amenities) in their desirability scoring.
Properties
This type declares no properties.
Constructors
public ZonePreferenceData()
Structs have an implicit default constructor. Create a new instance and set fields directly (see Usage Example). There are no explicit constructors defined in the source.
Methods
This type declares no methods.
Usage Example
// Create and initialize a ZonePreferenceData instance
var prefs = new ZonePreferenceData {
m_ResidentialSignificanceServices = 0.6f,
m_ResidentialSignificanceWorkplaces = 0.4f,
m_ResidentialSignificanceLandValue = 0.5f,
m_ResidentialSignificancePollution = 0.8f,
m_ResidentialNeutralLandValue = 1.0f,
m_CommercialSignificanceConsumers = 0.7f,
m_CommercialSignificanceCompetitors = 0.3f,
m_CommercialSignificanceWorkplaces = 0.4f,
m_CommercialSignificanceLandValue = 0.5f,
m_CommercialNeutralLandValue = 1.0f,
m_IndustrialSignificanceInput = 0.8f,
m_IndustrialSignificanceOutside = 0.6f,
m_IndustrialSignificanceLandValue = 0.3f,
m_IndustrialNeutralLandValue = 0.8f,
m_OfficeSignificanceEmployees = 0.7f,
m_OfficeSignificanceServices = 0.5f
};
// Example: add to an entity using EntityManager (Unity.Entities)
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity someEntity = em.CreateEntity();
em.AddComponentData(someEntity, prefs);
Notes and recommendations: - Values are floats (commonly used as weights). The codebase does not enforce a range; however, weights are typically normalized or used relatively. A conventional approach is to use values in the 0.0–1.0 range, or other ranges consistent across your mod/system. - "Significance" fields act as multipliers in scoring formulas; "NeutralLandValue" fields represent baseline land-value references to compare actual land value against. - Since this type implements IComponentData, consider using it on archetypes or prefabs that represent zoning templates, evaluators, or region-level settings for modded zoning logic.