Game.Net.TrackLaneFlags
Assembly: Game
Namespace: Game.Net
Type: enum
Base: System.Enum
Summary:
TrackLaneFlags is a bitmask enum (marked with [Flags]) used to describe per-lane properties/behaviors for track lanes (rail/track related lanes) in Cities: Skylines 2. Each named value represents a single bit or combination of bits that can be combined to express multiple lane characteristics (e.g., direction, switches, crossings, station presence, turning permissions).
Fields
-
Invert = 1
Invert the lane direction/orientation. -
Twoway = 2
Lane supports two-way traffic. -
Switch = 4
Lane is part of a switch (track switch). -
DiamondCrossing = 8
Lane is part of a diamond crossing. -
Exclusive = 0x10
Lane is exclusive (e.g., dedicated to a particular service). -
LevelCrossing = 0x20
Lane is part of a level crossing. -
AllowMiddle = 0x40
Middle lane allowed (used for center/median-related behavior). -
CrossingTraffic = 0x80
Lane involves crossing traffic behavior. -
MergingTraffic = 0x100
Lane participates in merging traffic behavior. -
StartingLane = 0x200
Lane is designated as a starting lane. -
EndingLane = 0x400
Lane is designated as an ending lane. -
Station = 0x800
Lane belongs to or serves a station. -
TurnLeft = 0x1000
Lane allows left turn. -
TurnRight = 0x2000
Lane allows right turn. -
DoubleSwitch = 0x4000
Lane is part of a double switch configuration.
Notes: - Values are powers of two (bit flags), so they can be combined with bitwise operations. - Underlying type is the default for enums (int), so the numeric values fit into a 32-bit integer.
Properties
- None (enum type; no instance properties).
Constructors
- None (enums do not expose constructors — value initialization is implicit).
Methods
- None (enum type; no methods declared here).
Use standard .NET enum helper methods where needed (e.g., Enum.HasFlag, Enum.ToString, casting).
Usage Example
// Combine flags
TrackLaneFlags flags = TrackLaneFlags.Twoway | TrackLaneFlags.AllowMiddle | TrackLaneFlags.Station;
// Check flags (recommended: bitwise check for performance)
bool isTwoWay = (flags & TrackLaneFlags.Twoway) != 0;
bool isStation = (flags & TrackLaneFlags.Station) != 0;
// Add a flag
flags |= TrackLaneFlags.StartingLane;
// Remove a flag
flags &= ~TrackLaneFlags.Twoway;
// Toggle a flag
flags ^= TrackLaneFlags.Invert;
// Alternative (slower) check using HasFlag
bool hasTurnRight = flags.HasFlag(TrackLaneFlags.TurnRight);
Additional tips for modders: - Prefer explicit bitwise checks ((flags & X) != 0) over Enum.HasFlag for performance-sensitive code (e.g., inside simulation/job loops). - When serializing or storing flags, cast to int or uint as needed: int raw = (int)flags; - Be careful when combining flags and passing values across native boundaries or jobs — ensure the expected underlying type and value ranges are respected.