Skip to content

Game.Prefabs.CompositionState

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: enum (flags)

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

Summary:
A bitmask enum used by prefab/segment composition code to describe structural and behavioral features of a prefab or road segment in Cities: Skylines 2. Each value represents a feature or state (lanes, tracks, terrain adjustments, visibility, etc.). Multiple flags can be combined to represent a composition with several characteristics simultaneously. This enum is intended for use in rendering, collision and gameplay logic where fast checks of presence/absence of features are required.


Fields

  • BlockUTurn = 1
    Bit 0 — Indicates U-turns are blocked on this composition/segment.

  • ExclusiveGround = 2
    Bit 1 — Marks the composition as having exclusive ground-level usage (e.g., dedicated ground lanes).

  • HasSurface = 4
    Bit 2 — The composition has a surface (pavement/road surface present).

  • HasForwardRoadLanes = 8
    Bit 3 — There are forward-facing road lanes (directional lanes in the forward direction).

  • SeparatedCarriageways = 0x10
    Bit 4 — Carriageways are separated (physically divided directions).

  • HasPedestrianLanes = 0x20
    Bit 5 — Pedestrian lanes/paths are present.

  • HasBackwardRoadLanes = 0x40
    Bit 6 — There are backward-facing road lanes (opposite-direction lanes).

  • HasForwardTrackLanes = 0x80
    Bit 7 — Forward-facing track lanes (e.g., tram/train track in forward direction).

  • HasBackwardTrackLanes = 0x100
    Bit 8 — Backward-facing track lanes.

  • Asymmetric = 0x200
    Bit 9 — Indicates the composition is asymmetric (left/right sides differ).

  • Marker = 0x400
    Bit 10 — A generic marker flag, often used for editor or temporary tagging.

  • BlockZone = 0x800
    Bit 11 — Blocks zoning actions (prevents zoning over this composition).

  • Multilane = 0x1000
    Bit 12 — Composition includes multiple lanes (multilane road).

  • LowerToTerrain = 0x2000
    Bit 13 — The composition should be lowered to terrain in placement or rendering.

  • RaiseToTerrain = 0x4000
    Bit 14 — The composition should be raised to terrain in placement or rendering.

  • NoSubCollisions = 0x8000
    Bit 15 — Disable sub-collision handling for this composition (optimization or special behavior).

  • Airspace = 0x10000
    Bit 16 — Composition occupies airspace (e.g., elevated or flying structures).

  • HalfLength = 0x20000
    Bit 17 — Composition represents a half-length segment (shortened piece).

  • Hidden = 0x40000
    Bit 18 — Composition is hidden (not rendered or not visible in editor/game).

Properties

  • None.
    This is a pure flags enum and does not define properties.

Constructors

  • None.
    Enums do not define constructors in this context. Values are combined/compared using bitwise operators.

Methods

  • None (on the enum).
    Use standard enum helpers / bitwise operators for operations. Example checks available in Usage Example.

Usage Example

// Combine multiple flags
CompositionState state = CompositionState.HasSurface 
                       | CompositionState.HasForwardRoadLanes 
                       | CompositionState.HasPedestrianLanes;

// Test for a flag (bitwise)
bool hasPedestrians = (state & CompositionState.HasPedestrianLanes) != 0;

// Remove a flag
state &= ~CompositionState.Hidden;

// Toggle a flag
state ^= CompositionState.Multilane;

// Using Enum.HasFlag (slower, boxed in some runtimes)
if (state.HasFlag(CompositionState.HasSurface))
{
    // do surface-specific logic
}

Notes: - Prefer bitwise operations ((state & flag) != 0) for performance-critical code over Enum.HasFlag. - Because this is a Flags enum, values are intended to be combined. Keep checks explicit and avoid accidental comparisons like state == CompositionState.HasSurface when multiple flags may be present.