Skip to content

Game.Net.OverlapFlags

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

Type: enum (flags)

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

Summary:
Represents bit flags used by the game's networking/system code to describe overlap and merge states for network segments, lanes or nodes (for example when two road assets overlap or when segments are merged). Each flag denotes a particular condition or category (merge direction, overlap side, type of connection such as road/track, or special states like Unsafe/Slow/Water). The enum is decorated with [Flags], so multiple values can be combined with bitwise operations.


Fields

  • MergeStart = 1
    Indicates the start of a merge area (bit 0). Typically used to mark the beginning edge of a merging segment or region.

  • MergeEnd = 2
    Indicates the end of a merge area (bit 1). Marks the ending edge of a merging segment or region.

  • OverlapLeft = 4
    Signifies an overlap on the left side (bit 2). Used when another segment/asset overlaps on the left.

  • OverlapRight = 8
    Signifies an overlap on the right side (bit 3). Used when another segment/asset overlaps on the right.

  • MergeMiddleStart = 0x10
    Marks the start of a middle/center merge region (bit 4). Useful for more complex merge patterns (e.g., multi-lane merges).

  • MergeMiddleEnd = 0x20
    Marks the end of a middle/center merge region (bit 5).

  • Unsafe = 0x40
    Denotes that the overlapped/merged area is considered unsafe (bit 6). Could affect AI routing, vehicle behavior, or validation logic.

  • Road = 0x80
    Flags the overlap as involving a road-type network (bit 7).

  • Track = 0x100
    Flags the overlap as involving a track-type network (rail/tram) (bit 8).

  • MergeFlip = 0x200
    Indicates a flipped merge direction or a merge that requires flipping orientation (bit 9). Implementation-specific semantics in merge handling.

  • Slow = 0x400
    Marks the area as slow — may be used to apply reduced speed logic or penalties (bit 10).

  • Water = 0x800
    Marks the overlap as water-related (bit 11). Used when overlap/merge interacts with water features.

Properties

  • None (this is a plain enum with flags).

Constructors

  • None (enum types do not define constructors; default value is 0).

Methods

  • None (enum does not define methods here). Use standard enum operations (bitwise &, |, ~, etc.) or Enum.HasFlag.

Usage Example

// Combine flags
OverlapFlags flags = OverlapFlags.MergeStart | OverlapFlags.Road;

// Test for a specific flag (preferred bitwise check to avoid boxing in tight loops)
bool isRoad = (flags & OverlapFlags.Road) != 0;
bool isMergeStart = (flags & OverlapFlags.MergeStart) != 0;

// Add/remove flags
flags |= OverlapFlags.Unsafe;          // set Unsafe
flags &= ~OverlapFlags.MergeStart;     // clear MergeStart

// Using HasFlag (convenient but causes boxing on System.Enum; avoid in hot paths)
bool hasUnsafe = flags.HasFlag(OverlapFlags.Unsafe);

Additional notes: - Because the enum underlying type is ushort, values fit into 16 bits; avoid assigning values outside that range. - Prefer bitwise operators (flags & flag) over Enum.HasFlag in performance-sensitive code to avoid boxing overhead.