Skip to content

Game.Citizens.LeaveHouseholdTag

Assembly: Assembly-CSharp
Namespace: Game.Citizens

Type: struct

Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, IEmptySerializable

Summary:
LeaveHouseholdTag is an empty/tag component used by the game's ECS to mark entities (citizens) that should leave their household. It carries no runtime data—presence/absence of the component is the signal. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a non-zero size for serialization and compatibility with the game's custom serialization pipeline (Colossal.Serialization). Implementing IEmptySerializable and IQueryTypeParameter indicates it is treated as an empty-serializable type and can be used in query type parameters inside the game's systems.


Fields

  • None.
    This is an empty/tag struct; it contains no fields or stored data. The StructLayout(Size = 1) attribute only affects the memory/serialization footprint, not any logical fields.

Properties

  • None.

Constructors

  • Implicit default constructor (value-initialized).
    No explicit constructors are defined. Use default initialization (new LeaveHouseholdTag()) when adding the component.

Methods

  • None.
    No instance methods; the type is only used as a marker/tag for ECS queries and component operations.

Usage Example

// Add tag to an entity using EntityManager
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
em.AddComponentData(entity, new LeaveHouseholdTag());

// Or using an EntityCommandBuffer inside a system/job
ecb.AddComponent(entity, new LeaveHouseholdTag());

// Querying entities that have the tag
Entities
    .WithAll<LeaveHouseholdTag>()
    .ForEach((Entity e /*, other components */) =>
    {
        // Handle citizens flagged to leave household
        // e.g., remove home occupancy, trigger relocation logic, etc.
    }).Run();

Notes: - Because this is a tag (empty) component, systems typically add/remove it to signal state transitions. Systems should remove the tag after handling if the signal is one-time. - The Size = 1 layout ensures the component is serializable with the game's save/load and networking subsystems that expect a non-zero size.