Skip to content

Game.Prefabs.SignalGroupMask

Assembly:
Namespace: Game.Prefabs

Type: Enum (with [Flags])

Base: System.Enum (underlying type: System.UInt16)

Summary:
SignalGroupMask is a bitmask enum used to represent one or more signal groups (up to 11 groups) for prefabs/signalling logic. The [Flags] attribute allows combining groups using bitwise operations. The enum uses a 16-bit underlying type (ushort), suitable for compact storage or interop where a 16-bit mask is required.


Fields

  • SignalGroup1 = 0x1 (1)
    Represents signal group 1 (bit 0).

  • SignalGroup2 = 0x2 (2)
    Represents signal group 2 (bit 1).

  • SignalGroup3 = 0x4 (4)
    Represents signal group 3 (bit 2).

  • SignalGroup4 = 0x8 (8)
    Represents signal group 4 (bit 3).

  • SignalGroup5 = 0x10 (16)
    Represents signal group 5 (bit 4).

  • SignalGroup6 = 0x20 (32)
    Represents signal group 6 (bit 5).

  • SignalGroup7 = 0x40 (64)
    Represents signal group 7 (bit 6).

  • SignalGroup8 = 0x80 (128)
    Represents signal group 8 (bit 7).

  • SignalGroup9 = 0x100 (256)
    Represents signal group 9 (bit 8).

  • SignalGroup10 = 0x200 (512)
    Represents signal group 10 (bit 9).

  • SignalGroup11 = 0x400 (1024)
    Represents signal group 11 (bit 10).

Notes: Bits 0–10 are used by these named groups. Bits 11–15 are unused in this enum and may be reserved for future expansion; treat them as available only if explicitly required and compatible with the game/modding expectations.

Properties

  • None (enum type has no custom properties).

Constructors

  • None (standard enum semantics; values are the defined named constants).

Methods

  • None (only standard Enum methods are available).

Usage Example

// Combine groups
SignalGroupMask mask = SignalGroupMask.SignalGroup1 | SignalGroupMask.SignalGroup3;

// Check membership (preferred bitwise check for performance)
bool hasGroup3 = (mask & SignalGroupMask.SignalGroup3) != 0;

// Alternative using Enum.HasFlag (convenient but slightly slower)
bool hasG3_alt = mask.HasFlag(SignalGroupMask.SignalGroup3);

// Add a group
mask |= SignalGroupMask.SignalGroup2;

// Remove a group
mask &= ~SignalGroupMask.SignalGroup1;

// Convert to ushort for storage or native interop
ushort rawMask = (ushort)mask;

// Iterate active groups (0..10 correspond to SignalGroup1..SignalGroup11)
for (int i = 0; i < 11; i++)
{
    SignalGroupMask g = (SignalGroupMask)(1 << i);
    if ((mask & g) != 0)
    {
        // handle active group i+1
    }
}

{{ This enum is intended for representing sets of signal groups in prefab/signalling systems within Cities: Skylines 2 mods. Use bitwise operations for efficient checks and storage. When interacting with native code or network formats, cast to ushort to preserve the 16-bit mask. }}