Skip to content

Game.Pathfind.PathMethod

Assembly: Assembly-CSharp.dll
Namespace: Game.Pathfind

Type: Enum (with [Flags] attribute)

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

Summary:
PathMethod is a flags enumeration used by the pathfinding systems to describe which transport/path types or routing modes are applicable for a given path request in Cities: Skylines 2. Each enum value is a distinct bit (ushort) so multiple methods can be combined using bitwise operations. This enum informs the pathfinding logic which networks, vehicle types, or special routing behaviors to consider or allow.


Fields

  • Pedestrian = 1
    Represents pedestrian paths/walkways (foot traffic).

  • Road = 2
    Represents normal road vehicle routing.

  • Parking = 4
    Indicates parking-related routing (driving into/out of parking spaces).

  • PublicTransportDay = 8
    Public transport routing for day schedules (buses/trams/metros when considered daytime routes).

  • Track = 0x10 (16)
    Track-based routing (trains, trams on dedicated track networks).

  • Taxi = 0x20 (32)
    Routing for taxi vehicles.

  • CargoTransport = 0x40 (64)
    Cargo transport routing (freight vehicles on the road network).

  • CargoLoading = 0x80 (128)
    Routing related to cargo loading operations (yards, docks).

  • Flying = 0x100 (256)
    Flying vehicle routing (aircraft/helicopters).

  • PublicTransportNight = 0x200 (512)
    Public transport routing for night schedules.

  • Boarding = 0x400 (1024)
    Routing related to boarding/unboarding at stops (used for scheduling stops and transfer logic).

  • Offroad = 0x800 (2048)
    Off-road routing (vehicles that can traverse non-road areas).

  • SpecialParking = 0x1000 (4096)
    Special parking behavior (e.g., reserved/special-purpose parking logic).

  • MediumRoad = 0x2000 (8192)
    Medium-capacity road routing (distinct from Road for lane/priority differentiation).

Properties

  • None (enum)

Constructors

  • None (enum types do not define constructors)

Methods

  • None (enum)

Usage Example

// Combine multiple methods
PathMethod allowed = PathMethod.Road | PathMethod.Parking | PathMethod.Taxi;

// Check for a specific flag using bitwise operation
bool allowsParking = (allowed & PathMethod.Parking) != 0;

// Or using Enum.HasFlag (note: slightly slower)
bool allowsTaxi = allowed.HasFlag(PathMethod.Taxi);

// Add a flag
allowed |= PathMethod.Offroad;

// Remove a flag
allowed &= ~PathMethod.Parking;

// Example function that interprets PathMethod
void HandlePathRequest(PathMethod method)
{
    if ((method & PathMethod.Pedestrian) != 0)
    {
        // handle pedestrian path logic
    }
    if ((method & PathMethod.Track) != 0)
    {
        // handle track-based routing
    }
}

Notes: - Because the enum has the [Flags] attribute and an underlying type of ushort, values should be combined and tested with bitwise operations. - When reading game code or implementing mods that interact with pathfinding, ensure you pass the appropriate combination of PathMethod flags to match the intended transport types and behaviors.