Skip to content

Game.Net.Layer

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

Type: enum (with Flags)

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

Summary: Bitmask enum that represents different network "layers" in the game's networking/transport/map systems (roads, power lines, pipes, tracks, pathways, markers, etc.). Marked with [Flags], so multiple layers can be combined using bitwise operations to represent sets of active/affected layers. Typically used when filtering, querying, or toggling visibility/interaction for network elements in mods and game systems.


Fields

  • Road = 1u Represents standard road layer.

  • PowerlineLow = 2u Low-voltage power line layer.

  • PowerlineHigh = 4u High-voltage power line layer.

  • WaterPipe = 8u Water supply pipe layer.

  • SewagePipe = 0x10u Sewage pipe layer.

  • StormwaterPipe = 0x20u Stormwater (drainage) pipe layer.

  • TrainTrack = 0x40u Train track layer.

  • Pathway = 0x80u Pedestrian/bike pathway layer.

  • Waterway = 0x100u Waterway layer (boats, canals).

  • Taxiway = 0x200u Airport taxiway layer.

  • TramTrack = 0x400u Tram track layer.

  • SubwayTrack = 0x800u Subway/metro track layer.

  • Fence = 0x1000u Fence layer.

  • MarkerPathway = 0x2000u Marker for pathway (likely editor/visualization markers).

  • MarkerTaxiway = 0x4000u Marker for taxiway (editor/visualization markers).

  • PublicTransportRoad = 0x8000u Roads designated for public transport.

  • LaneEditor = 0x10000u Lane-editor-related layer (used by lane editing tools).

  • ResourceLine = 0x20000u Resource line layer (e.g., for resource transport lines).

  • None = 0u No layers selected/none.

  • All = uint.MaxValue All bits set — represents all possible layers.

Properties

  • This enum type does not declare properties. Use standard enum/bitwise operations or Enum helper methods (e.g., Enum.HasFlag) when working with values.

Constructors

  • Enums do not declare explicit constructors in C#; the runtime provides default behavior. You can cast numeric values to Layer when needed, e.g. (Layer)0x4u.

Methods

  • The Layer enum does not declare instance methods. Use built-in enum and bitwise operations:
  • layer.HasFlag(Layer.Road) — checks if a flag is set (note: HasFlag is slower than bitwise check).
  • (layer & Layer.Road) != 0 — preferred fast check for a flag.
  • layer |= Layer.PowerlineLow — add/set a flag.
  • layer &= ~Layer.TrainTrack — remove/clear a flag.
  • layer = Layer.None — clear all flags.
  • You can also cast to/from uint for low-level operations.

Usage Example

// Combine layers
Layer combined = Layer.Road | Layer.Pathway | Layer.LaneEditor;

// Check whether a layer is present (fast bitwise check)
bool hasRoad = (combined & Layer.Road) != 0;

// Alternatively (slower) using HasFlag
bool hasPathway = combined.HasFlag(Layer.Pathway);

// Add a layer
combined |= Layer.PowerlineLow;

// Remove a layer
combined &= ~Layer.LaneEditor;

// Clear all
combined = Layer.None;

// Check for any layer (non-empty)
bool any = combined != Layer.None;

// Cast to/from numeric type if needed
uint raw = (uint)combined;
Layer fromRaw = (Layer)raw;

{{ Notes for modders: - Because Layer uses [Flags] and an underlying uint, prefer bitwise checks ((value & flag) != 0) in performance-sensitive code (e.g., per-frame or bulk operations) rather than Enum.HasFlag. - Use Layer.None to represent an empty set and Layer.All to represent every layer. - When serializing/storing values, store the underlying uint to avoid potential enum versioning issues. - Be careful when combining external values — validate/cast unknown numeric values to Layer if they might contain bits outside documented flags. }}