Skip to content

Game.Prefabs.SecondaryLaneInfo

Assembly: Assembly-CSharp (game runtime assembly)
Namespace: Game.Prefabs

Type: class

Base: System.Object

Summary:
Serializable container used by road/net prefabs to describe an alternative ("secondary") lane option and a set of boolean requirements that control when that lane is considered a valid match. The GetFlags method converts the individual boolean requirement fields into a combined SecondaryNetLaneFlags bitmask for easier testing by prefab matching code. The class holds a reference to a NetLanePrefab and multiple requirement flags that correspond to entries in the SecondaryNetLaneFlags enum.


Fields

  • public NetLanePrefab m_Lane
    Holds the reference to the secondary lane prefab this entry represents. Used by the prefab system to identify which lane variant to apply when a match succeeds.

  • public bool m_RequireSafe
    When true, indicates that the RequireSafe flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireUnsafe
    When true, indicates that the RequireUnsafe flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireSingle
    When true, indicates that the RequireSingle flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireMultiple
    When true, indicates that the RequireMultiple flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireAllowPassing
    When true, indicates that the RequireAllowPassing flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireForbidPassing
    When true, indicates that the RequireForbidPassing flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireMerge
    When true, indicates that the RequireMerge flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireContinue
    When true, indicates that the RequireContinue flag should be set in the resulting SecondaryNetLaneFlags bitmask.

  • public bool m_RequireSafeMaster
    When true, indicates that the RequireSafeMaster flag should be set in the resulting SecondaryNetLaneFlags bitmask.

Properties

  • This class exposes no properties; it uses public fields for data. Consider wrapping fields with properties in your own code if you need validation or encapsulation.

Constructors

  • public SecondaryLaneInfo()
    The default (parameterless) constructor is implicit. Instances are typically created and then populated by the prefab deserialization or by mod code setting the public fields.

Methods

  • public SecondaryNetLaneFlags GetFlags()
    Builds and returns a SecondaryNetLaneFlags value by OR-ing the corresponding enum flags for each boolean requirement field that is true. This is a convenience method used by prefab matching code so consumers can test a single bitmask instead of checking each boolean individually.

Behavior summary: - Starts with a zero-valued SecondaryNetLaneFlags. - For each boolean field that is true (m_RequireSafe, m_RequireUnsafe, m_RequireSingle, etc.), the method ORs the corresponding SecondaryNetLaneFlags.RequireX flag into the result. - Returns the combined bitmask.

Note: This method assumes the existence of the SecondaryNetLaneFlags enum with members such as RequireSafe, RequireUnsafe, RequireSingle, RequireMultiple, RequireAllowPassing, RequireForbidPassing, RequireMerge, RequireContinue, and RequireSafeMaster.

Usage Example

// Create and configure a SecondaryLaneInfo
var secondary = new SecondaryLaneInfo {
    m_Lane = myNetLanePrefab,    // NetLanePrefab reference
    m_RequireSafe = true,
    m_RequireMerge = true,
    m_RequireAllowPassing = false,
    m_RequireContinue = true
};

// Convert booleans into the flags bitmask
SecondaryNetLaneFlags flags = secondary.GetFlags();

// Example usage in matching logic (pseudo-code):
// if ((flags & SecondaryNetLaneFlags.RequireMerge) != 0) { ... }

{{ Additional notes: - This class is marked [Serializable], so it is intended for Unity serialization and likely populated from prefab data. - Because fields are public, be careful when modifying instances at runtime if other systems expect immutability. - Ensure the SecondaryNetLaneFlags enum and NetLanePrefab type are available in your modding context (they are part of the game's networking/prefab systems). }}