Game.Prefabs.FireStationData
Assembly: Game (inferred from file path)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Summary:
Represents configurable capacity and efficiency data for a fire station prefab. This struct is a Unity.Entities IComponentData used by the game's ECS to attach fire station-related parameters to entities. It also implements ICombineData to allow values from multiple sources (e.g., prefab variants or upgrades) to be accumulated, and ISerializable to support the game's custom serialization via Colossal.Serialization.Entities.
Fields
-
public int m_FireEngineCapacity
Number of fire engines the station can hold / dispatch. Combined by addition when multiple data sources are merged. -
public int m_FireHelicopterCapacity
Number of fire helicopters the station can hold / dispatch. Combined by addition when multiple data sources are merged. -
public int m_DisasterResponseCapacity
Capacity reserved for disaster response (separate from regular engines/helicopters). Combined by addition when merging data. -
public float m_VehicleEfficiency
A float representing vehicle efficiency (could be used as a multiplier or efficiency score). Combined by addition when merging data (so values are summed).
Properties
- (None)
This struct exposes only public fields; no C# properties are declared.
Constructors
public FireStationData()
Default value-type constructor (auto-generated). All numeric fields default to 0. Typically you populate fields directly or via systems that instantiate/configure prefab data.
Methods
public void Combine(FireStationData otherData)
Adds the corresponding capacity and efficiency values from otherData into this instance. Useful when multiple sources of prefab/data modifiers are applied and their effects should accumulate:- m_FireEngineCapacity += otherData.m_FireEngineCapacity
- m_FireHelicopterCapacity += otherData.m_FireHelicopterCapacity
- m_DisasterResponseCapacity += otherData.m_DisasterResponseCapacity
-
m_VehicleEfficiency += otherData.m_VehicleEfficiency
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes fields to a generic writer (Colossal.Serialization.Entities pattern). The method writes fields in a fixed order: - m_FireEngineCapacity (int)
- m_FireHelicopterCapacity (int)
- m_DisasterResponseCapacity (int)
- m_VehicleEfficiency (float)
This order must be preserved by Deserialize.
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads fields from a generic reader in the same order as Serialize and assigns them by reference to the struct fields:- m_FireEngineCapacity (int)
- m_FireHelicopterCapacity (int)
- m_DisasterResponseCapacity (int)
- m_VehicleEfficiency (float)
Expect the same writer/reader contract used by the game's save/load and prefab serialization systems.
Usage Example
// Create and populate
FireStationData data = new FireStationData
{
m_FireEngineCapacity = 3,
m_FireHelicopterCapacity = 1,
m_DisasterResponseCapacity = 2,
m_VehicleEfficiency = 0.9f
};
// Combine with another modifier (e.g., upgrade or district effect)
FireStationData modifier = new FireStationData
{
m_FireEngineCapacity = 1,
m_VehicleEfficiency = 0.05f
};
data.Combine(modifier);
// data.m_FireEngineCapacity == 4
// data.m_VehicleEfficiency == 0.95f
// Serialize (example writer interface provided by the game's serialization layer)
void Save<TWriter>(TWriter writer, FireStationData d) where TWriter : IWriter
{
d.Serialize(writer);
}
// Deserialize (example reader)
void Load<TReader>(TReader reader, out FireStationData d) where TReader : IReader
{
d = new FireStationData();
d.Deserialize(reader);
}
Notes: - This struct is intended for ECS use (IComponentData). Systems working with fire stations will typically read these fields from the entity's component data to determine available vehicles and response behavior. - The Combine implementation is a simple additive merge; ensure this behavior matches expected game logic for stacking modifiers (e.g., percent vs. absolute values).