Skip to content

Game.Buildings.TelecomConsumer

Assembly:
Assembly-CSharp (typical for Cities: Skylines 2 game code / mods)

Namespace: Game.Buildings

Type: struct (value type)

Base: Implements: - Unity.Entities.IComponentData - Unity.Entities.IQueryTypeParameter - Colossal.Serialization.Entities.IEmptySerializable

Summary: TelecomConsumer is an empty/tag component used by the game's ECS to mark entities (typically building entities) that act as consumers of telecommunication services. The struct is deliberately empty and annotated with a fixed size via StructLayout to ensure it has a consistent (non-zero) size for serialization and interoperability with the game's serialization system.

The implemented interfaces indicate: - IComponentData: this is a DOTS ECS component. - IQueryTypeParameter: enables use in entity query type parameters (e.g., WithAll()). - IEmptySerializable: used by Colossal's serialization helpers to handle empty components efficiently.

The StructLayout attribute (LayoutKind.Sequential, Size = 1) ensures the struct occupies one byte, avoiding potential issues with zero-sized empty structs in serialization and native interop.


Fields

  • This struct contains no instance fields; it is an empty/tag component by design. This is intentional: the presence/absence of the component itself encodes the "telecom consumer" trait for an entity.

Properties

  • None. Being an empty tag component, there are no properties.

Constructors

  • public TelecomConsumer() Default parameterless value-type constructor is provided by the runtime. No custom constructors are defined.

Methods

  • None. No instance or static methods are defined on this type.

Usage Example

// Add the tag to an existing entity (EntityManager usage)
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponent<TelecomConsumer>(buildingEntity);

// Or set up a query in a SystemBase to operate on telecom consumers:
public partial class TelecomConsumerSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Example: iterate over all entities that have TelecomConsumer
        Entities
            .WithAll<TelecomConsumer>()
            .ForEach((Entity e, in BuildingTagData buildingData) =>
            {
                // perform logic for telecom-consuming buildings
            }).ScheduleParallel();
    }
}

Notes: - Use this component as a lightweight tag in queries and to drive behavior specific to telecom-consuming buildings. - Because the type implements IEmptySerializable, it will be handled by the game's serialization pipeline as an empty component; no extra serialization code is needed.