Skip to content

Game.Prefabs.DeathcareFacilityData

Assembly: Assembly-CSharp (game)
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType (struct)

Summary:
Represents the configuration data for a deathcare facility prefab in Cities: Skylines 2. This struct is an ECS component (IComponentData / IQueryTypeParameter) used to store runtime / prefab settings such as hearse capacity, storage capacity, processing rate and whether long-term storage is enabled. It implements ICombineData to allow combining data from multiple sources (for example when composing prefab variants) and ISerializable to support reading/writing via the Colossal.Serialization entities IReader/IWriter interfaces.


Fields

  • public int m_HearseCapacity
    Number of hearse slots / capacity provided by the facility. Used to determine how many hearses the facility can host/dispatch.

  • public int m_StorageCapacity
    Capacity of stored bodies/caskets (long-term or short-term) measured in game units used by the deathcare simulation.

  • public float m_ProcessingRate
    Rate at which the facility processes remains (units per second or per tick depending on simulation). Higher values mean faster processing / turnover.

  • public bool m_LongTermStorage
    Flag indicating whether the facility supports long-term storage. When true, the facility can store remains for extended periods (affects logic in deathcare systems).

Properties

This type does not define any C# properties; it exposes its data as public fields.

Constructors

  • public DeathcareFacilityData()
    Default (implicit) constructor. All fields are initialized to their default values (m_HearseCapacity = 0, m_StorageCapacity = 0, m_ProcessingRate = 0f, m_LongTermStorage = false). You can initialize an instance using an object initializer or by setting fields directly.

Methods

  • public void Combine(DeathcareFacilityData otherData)
    Merges another DeathcareFacilityData instance into this one. Numeric capacities and rates are added together (m_HearseCapacity, m_StorageCapacity, m_ProcessingRate), and m_LongTermStorage is combined with a logical OR (if either has long-term storage enabled, the result will be true). Intended for combining prefab/component data when multiple sources contribute to a final value.

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the struct's fields to a provided writer (Colossal.Serialization.Entities.IWriter). Writes fields in the order: m_HearseCapacity, m_StorageCapacity, m_ProcessingRate, m_LongTermStorage. Used when saving prefab/component data.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the struct's fields from a provided reader (Colossal.Serialization.Entities.IReader). Reads values into m_HearseCapacity, m_StorageCapacity, m_ProcessingRate, m_LongTermStorage in the same order used by Serialize. Used when loading prefab/component data.

Usage Example

// Create and initialize a deathcare data instance
var baseData = new Game.Prefabs.DeathcareFacilityData
{
    m_HearseCapacity = 2,
    m_StorageCapacity = 50,
    m_ProcessingRate = 1.5f,
    m_LongTermStorage = false
};

// Another variant adds additional capacity and enables long-term storage
var addonData = new Game.Prefabs.DeathcareFacilityData
{
    m_HearseCapacity = 1,
    m_StorageCapacity = 25,
    m_ProcessingRate = 0.5f,
    m_LongTermStorage = true
};

// Combine them (e.g., when composing prefab variants)
baseData.Combine(addonData);
// baseData now: m_HearseCapacity = 3, m_StorageCapacity = 75, m_ProcessingRate = 2.0f, m_LongTermStorage = true

// Example serialize/deserialize (pseudo-usage with a writer/reader)
void Save<TWriter>(TWriter writer, Game.Prefabs.DeathcareFacilityData data) where TWriter : Colossal.Serialization.Entities.IWriter
{
    data.Serialize(writer);
}

Game.Prefabs.DeathcareFacilityData Load<TReader>(TReader reader) where TReader : Colossal.Serialization.Entities.IReader
{
    var data = new Game.Prefabs.DeathcareFacilityData();
    data.Deserialize(reader);
    return data;
}

{{ Notes: Use this component when authoring or inspecting prefab data for deathcare facilities. Because the struct implements ICombineData, the Combine method is used by the prefab pipeline to aggregate values from multiple sources (base prefab + add-ons / variants). Serialization methods rely on Colossal's IWriter/IReader implementations used by the game's save/load and prefab systems. }}