Skip to content

Game.FireEngineData

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Component data for fire engine prefabs. Holds runtime/configuration values that control how a fire engine extinguishes fires and how wreckage is cleared. Implementing ISerializable allows these values to be written to and read from the game's save/serialization system (Colossal.Serialization.Entities).


Fields

  • public float m_ExtinguishingRate
    Rate at which the fire engine extinguishes fire (units per second). Written/read during serialization in the same order as other fields.

  • public float m_ExtinguishingSpread
    Spread or radius factor describing how extinguishing is applied (e.g., area-of-effect). Interpreted by the fire-extinguishing logic to distribute extinguishing power.

  • public float m_ExtinguishingCapacity
    Total extinguishing capacity (e.g., amount of water or total extinguishing "budget") before the vehicle must refill or is depleted.

  • public float m_DestroyedClearDuration
    Time in seconds used by the game to clear destroyed/ruined objects after an incident when this vehicle is involved (how long before wreckage is cleared).

Properties

  • None

Constructors

  • public FireEngineData(float extinguishingRate, float extinguishingSpread, float extinguishingCapacity, float destroyedClearDuration)
    Constructs a new FireEngineData instance and initializes all four fields. Parameters correspond directly to the public fields: extinguishing rate, spread, capacity, and destroyed-clear duration.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the four float fields to the provided writer in this order: m_ExtinguishingRate, m_ExtinguishingSpread, m_ExtinguishingCapacity, m_DestroyedClearDuration. Used by the game's save/serialization subsystem.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the four float fields from the provided reader into the struct's fields in the same order they were written. The method uses ref locals to directly populate the fields.

Usage Example

// Example: creating an entity with FireEngineData and setting values via EntityManager
using Unity.Entities;
using Game.Prefabs;

public class FireEngineSpawner
{
    public void Spawn(EntityManager entityManager)
    {
        var archetype = entityManager.CreateArchetype(typeof(FireEngineData));
        Entity fireEngine = entityManager.CreateEntity(archetype);

        var data = new FireEngineData(
            extinguishingRate: 10f,
            extinguishingSpread: 2.5f,
            extinguishingCapacity: 100f,
            destroyedClearDuration: 8f
        );

        entityManager.SetComponentData(fireEngine, data);
    }
}

Notes for modders: - Because this struct implements ISerializable, changes to field order or types will affect save compatibility. Keep a consistent order and type when modifying for compatibility with saved games. - Values should be tuned to match game balance. The units and exact interpretation (e.g., how spread is applied) are determined by the fire system code that consumes this component.