Skip to content

Game.Prefabs.EmergencyShelterData

Assembly:
Game (Assembly-CSharp / game assembly where prefab components live)

Namespace:
Game.Prefabs

Type:
struct

Base:
IComponentData, IQueryTypeParameter, ICombineData, ISerializable

Summary:
EmergencyShelterData is an ECS component/serializable data container used by the game's prefab system to describe emergency shelter capacities for a prefab (numbers of people the shelter can hold and how many vehicles it supports). It supports combining (summing) values from multiple sources (ICombineData) and reading/writing via the Colossal.Serialization reader/writer interfaces for save/load and prefab serialization.


Fields

  • public int m_ShelterCapacity
    Holds the capacity for people that the shelter can accommodate. This value is summed when Combine(...) is called. Typical use: set by prefab authoring or loaded from serialized prefab data.

  • public int m_VehicleCapacity
    Holds the capacity for vehicles associated with the shelter (e.g., parking / vehicles that can use the shelter). This value is summed when Combine(...) is called.

Properties

  • (No explicit properties declared)
    This struct exposes its data via public fields. There are no C# properties defined.

Constructors

  • public EmergencyShelterData()
    Implicit default struct constructor. Fields default to 0 if not set explicitly. There is no explicit custom constructor in the source.

Methods

  • public void Combine(EmergencyShelterData otherData)
    Implements ICombineData. Adds another EmergencyShelterData's capacities into this instance by summing m_ShelterCapacity and m_VehicleCapacity. Useful when aggregating values from multiple prefab variants or merged sources.

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Implements ISerializable. Writes m_ShelterCapacity followed by m_VehicleCapacity to the provided writer. The writer is expected to be a Colossal.Serialization writer used by the game's save/prefab system.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Implements ISerializable. Reads m_ShelterCapacity and m_VehicleCapacity from the provided reader into the struct's fields. Uses ref locals to read directly into the fields.

Usage Example

// Create and populate
var shelter = new EmergencyShelterData
{
    m_ShelterCapacity = 200,
    m_VehicleCapacity = 10
};

// Combine with another data block (e.g., aggregated from another prefab layer)
var other = new EmergencyShelterData
{
    m_ShelterCapacity = 50,
    m_VehicleCapacity = 2
};
shelter.Combine(other); // shelter now has 250 people capacity, 12 vehicle capacity

// Serialization example (pseudo-code, depends on game's writer/reader APIs)
using (var writer = /* obtain an IWriter from game's serialization context */)
{
    shelter.Serialize(writer);
}

using (var reader = /* obtain an IReader from game's serialization context */)
{
    var loaded = new EmergencyShelterData();
    loaded.Deserialize(reader);
    // loaded now has the same values written earlier
}

Notes and tips: - Because fields are public, mod code can set values directly when authoring prefabs or creating entity archetypes. - Combine is designed for additive merging; ensure this semantics is correct for your mod when aggregating multiple sources. - Serialization uses the game's Colossal.Serialization interfaces — use the game's provided writer/reader instances when implementing save/load or prefab import/export.