Skip to content

Game.FlowDirection

Assembly:
Likely part of the game's core Game or Game.Net assembly (Game.dll). Exact assembly depends on the game's build.

Namespace: Game.Net

Type: Enum (flags)

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

Summary: FlowDirection is a small, attributed flags enum used to represent the direction(s) of a flow (for example network/packet flow, path/traffic flow, or other bidirectional state) using a single byte. The [Flags] attribute allows combining Forward and Backward to represent Both. Use it where you need compact, bitwise-checkable direction flags in mod code or serialization.


Fields

  • None = 0
    Represents no direction set. Useful as a default or cleared state.

  • Forward = 1
    Represents the forward direction. Value is the first bit (0x01).

  • Backward = 2
    Represents the backward direction. Value is the second bit (0x02).

  • Both = 3
    Represents both directions; equivalent to Forward | Backward (0x01 | 0x02). Useful when the flow can proceed in both ways.

Notes: Because the enum is marked with [Flags], flags can be combined and tested using bitwise operations. The underlying storage is a byte, which makes it compact for network packets, arrays, or tight memory structures.

Properties

  • This enum type does not declare instance properties.
    System.Enum provides standard static/instance methods (ToString, HasFlag, etc.), but there are no custom properties on FlowDirection itself.

Constructors

  • There are no public constructors for this enum beyond the implicit enum value construction.
    Enums are value types and are created by assigning one of the defined values or by casting from the underlying type (byte).

Methods

  • The enum does not declare any custom methods.
    Available runtime methods come from System.Enum / System.ValueType / System.Object (e.g., ToString(), HasFlag(Enum), GetHashCode(), Equals(object)).

Performance note: Enum.HasFlag boxes the enum and can allocate; for performance-sensitive code (e.g., hot loops in a game), prefer bitwise checks like (dir & FlowDirection.Forward) != 0.

Usage Example

// Set a direction
FlowDirection dir = FlowDirection.Forward;

// Combine directions
dir = FlowDirection.Forward | FlowDirection.Backward; // or FlowDirection.Both

// Check directions (preferred for performance)
bool hasForward = (dir & FlowDirection.Forward) != 0;
bool hasBackward = (dir & FlowDirection.Backward) != 0;

// Alternatively (less performant due to boxing):
bool hasForwardAlt = dir.HasFlag(FlowDirection.Forward);

// Casting to underlying byte for compact storage/serialization
byte raw = (byte)dir;
FlowDirection fromRaw = (FlowDirection)raw;

{{ This enum is intended for small, efficient representation of directional state. When designing packets, save/load routines, or tight-memory structures for Cities: Skylines 2 mods, prefer the byte-backed flags enum to keep data compact. Be mindful of HasFlag boxing in performance-critical code and use bitwise operations instead. }}