Skip to content

Game.Pathfind.RuleFlags

Assembly:
Assembly-CSharp

Namespace:
Game.Pathfind

Type:
public enum (flags) — underlying type: byte

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

Summary:
Bit flags used by the pathfinding / routing system to indicate route restrictions or state for a path segment/node. The enum is decorated with [Flags], so values can be combined with bitwise operations. Typical uses include marking a path as blocked or forbidding certain classes of traffic (combustion engines, transit, heavy, private, slow vehicles).


Fields

  • HasBlockage = 1
    Indicates the path has a blockage (e.g., obstacle, temporary closure) and should not be used.

  • ForbidCombustionEngines = 2
    Forbids combustion-engine vehicles on the path (e.g., electric-only restriction).

  • ForbidTransitTraffic = 4
    Forbids transit vehicles (buses, trams) from using the path.

  • ForbidHeavyTraffic = 8
    Forbids heavy vehicles (trucks, heavy-duty vehicles) from the path.

  • ForbidPrivateTraffic = 0x10 (16)
    Forbids private vehicles (cars) from using the path.

  • ForbidSlowTraffic = 0x20 (32)
    Forbids slow-moving vehicles (e.g., bicycles, slow service vehicles) from the path.

Properties

  • This enum type does not define instance properties. Use bitwise operations on RuleFlags values to query or modify flags.

Constructors

  • No explicit constructors — standard enum semantics apply. The underlying storage is a single byte.

Methods

  • No instance methods are defined on this enum type. Standard System.Enum methods (ToString, HasFlag, etc.) are available.

Usage Example

// Combine flags
RuleFlags restrictions = RuleFlags.ForbidHeavyTraffic | RuleFlags.ForbidSlowTraffic;

// Test for a specific flag
bool forbidsHeavy = (restrictions & RuleFlags.ForbidHeavyTraffic) != 0;
// or using Enum.HasFlag (boxing involved)
bool forbidsSlow = restrictions.HasFlag(RuleFlags.ForbidSlowTraffic);

// Add a flag
restrictions |= RuleFlags.ForbidTransitTraffic;

// Remove a flag
restrictions &= ~RuleFlags.ForbidSlowTraffic;

// Storing as byte (explicit cast)
byte raw = (byte)restrictions;

// Interpreting raw byte
RuleFlags fromRaw = (RuleFlags)raw;