Skip to content

Game.UtilityLaneFlags

Assembly: Game
Namespace: Game.Net

Type: Enum

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

Summary:
UtilityLaneFlags is a bitmask enum (annotated with [Flags]) used to mark properties of utility-related lanes in the game's networking/utility systems. Each value represents a single bit flag that can be combined to describe multiple characteristics of a lane (anchors, pipeline connections, traffic cuts, vertical connections). This enum is intended for use in code that needs to test, set, or clear lane-related utility properties efficiently in Cities: Skylines 2 modding contexts.


Fields

  • SecondaryStartAnchor = 1
    Used to mark a lane as the start anchor for a secondary utility connection (bit 0). Typically indicates an origin/attachment point for a secondary pipeline or utility branch.

  • SecondaryEndAnchor = 2
    Marks a lane as the end anchor for a secondary utility connection (bit 1). Paired with SecondaryStartAnchor to identify both ends of a secondary connection.

  • PipelineConnection = 4
    Indicates that the lane has a pipeline connection (bit 2). Used to denote lanes that connect to or carry pipeline utilities.

  • CutForTraffic = 8
    Denotes a lane that has been cut or reserved for traffic (bit 3). May be used when a lane's geometry or utility routing must account for traffic-related interruptions.

  • VerticalConnection = 0x10
    Specifies a vertical utility connection (bit 4, value 16). Used when the utility connection runs vertically (e.g., between different elevation layers).

Properties

  • None.
    This is a plain enum type; it does not declare properties. Use bitwise operations or Enum.HasFlag to inspect values.

Constructors

  • None (implicit).
    Enums in C# do not expose custom constructors. Values are assigned by their constant declarations above.

Methods

  • None declared on this enum type.
    Standard System.Enum instance/static methods are available (ToString, GetValues, HasFlag, etc.). For performance-sensitive code in game mods, prefer bitwise checks ((value & flag) == flag) over Enum.HasFlag due to allocations and boxing concerns in some environments.

Usage Example

using Game.Net;

public class UtilityExample
{
    public void Demo()
    {
        // Combine flags
        UtilityLaneFlags flags = UtilityLaneFlags.SecondaryStartAnchor | UtilityLaneFlags.PipelineConnection;

        // Check a flag (recommended for performance)
        bool hasPipeline = (flags & UtilityLaneFlags.PipelineConnection) == UtilityLaneFlags.PipelineConnection;

        // Or using Enum.HasFlag (more readable but may box in some runtimes)
        bool hasPipeline2 = flags.HasFlag(UtilityLaneFlags.PipelineConnection);

        // Add a flag
        flags |= UtilityLaneFlags.VerticalConnection;

        // Remove a flag
        flags &= ~UtilityLaneFlags.CutForTraffic;

        // Toggle a flag
        flags ^= UtilityLaneFlags.SecondaryEndAnchor;

        // Inspect underlying integer value
        int raw = (int)flags; // useful for serialization or low-level APIs
    }
}

{{ This enum is intended for use within the game's networking/utility lane systems. When writing performance-critical code for Cities: Skylines 2 mods, prefer bitwise checks and avoid excessive boxing via Enum.HasFlag in hot paths. }}