Skip to content

Game.Prefabs.LocalConnectFlags

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: public enum

Base: System.Enum (underlying type: uint)

Summary:
A bitmask enum used by prefab connection logic to control how local connections are created/selected when connecting props or segment ends. The [Flags] attribute means values can be combined with bitwise OR to express multiple behaviors (for example: ExplicitNodes | ChooseBest). Each flag represents a single option that affects selection, openness, dead-end requirements, and side preference when establishing local connections.


Fields

  • ExplicitNodes = 1u
    Specifies that explicit node connections should be used. When set, the connection logic favors using explicit node positions rather than deriving implicit connection points.

  • KeepOpen = 2u
    Indicates the connection should remain open (not automatically closed). Useful when connections must remain available for other operations or future adjustments.

  • RequireDeadend = 4u
    Requires that the connection be made to a dead-end (an end with no further connections). Use this to restrict connections to true termini.

  • ChooseBest = 8u
    Instructs the algorithm to choose the best candidate among possible connection targets (based on internal scoring/rules) instead of using the first match.

  • ChooseSides = 0x10u
    Tells the connection logic to prefer matching sides (e.g., left/right alignment) when selecting connection points. Useful for directional alignment of prefabs or roads.

Properties

  • None specific to this enum.
    (As an enum, it exposes the standard System.Enum behavior but declares no custom properties.)

Constructors

  • None declared.
    (Enums do not declare explicit constructors; underlying values are stored as unsigned integers (uint) in this case.)

Methods

  • No custom methods are defined on this enum.
    (Inherited methods from System.Enum/System.ValueType/System.Object are available, such as ToString(), HasFlag(Enum), CompareTo, etc. For flags checks it's common to use bitwise operations ((flags & LocalConnectFlags.ChooseBest) != 0) or Enum.HasFlag.)

Usage Example

// Combine flags
LocalConnectFlags flags = LocalConnectFlags.ExplicitNodes | LocalConnectFlags.ChooseBest;

// Check for a specific flag using bitwise operation
bool usesChooseBest = (flags & LocalConnectFlags.ChooseBest) != 0;

// Alternatively, use HasFlag (boxes the enum)
bool usesExplicit = flags.HasFlag(LocalConnectFlags.ExplicitNodes);

// Example: require both ChooseBest and ChooseSides
bool prefersSidesAndBest = (flags & (LocalConnectFlags.ChooseBest | LocalConnectFlags.ChooseSides)) 
                           == (LocalConnectFlags.ChooseBest | LocalConnectFlags.ChooseSides);