Skip to content

Game.Prefabs.NetInvertMode

Assembly: Assembly-CSharp (inferred)
Namespace: Game.Prefabs

Type: public enum

Base: System.Enum

Summary:
NetInvertMode is an enumeration used by the game's prefab/network code to indicate when a network (road/rail/bridge) should be inverted relative to its default orientation. This is typically used to handle differences in left-hand vs. right-hand traffic rules or to force/no-op inversion behavior when constructing or mirroring network segments. The enum provides simple named modes to control that behavior.


Fields

  • Never
    Indicates inversion should never be applied. Use this when a network prefab must always keep its default orientation regardless of traffic rules or mirroring logic.

  • LefthandTraffic
    Indicates inversion should be applied when the game (or map/locale) uses left-hand traffic. Useful for prefabs that need to flip lanes/orientation only on left-hand-traffic cities or build modes.

  • RighthandTraffic
    Indicates inversion should be applied when the game (or map/locale) uses right-hand traffic. Useful for prefabs that need to flip lanes/orientation only on right-hand-traffic cities or build modes.

  • Always
    Indicates inversion should always be applied. Use this to force a prefab/network to be inverted regardless of traffic side.

Properties

  • This enum does not define any properties.
    Use the enum values directly in fields, method parameters, or switch statements.

Constructors

  • Enums do not declare explicit constructors in user code.
    Underlying integer values are assigned automatically (in this order): Never = 0, LefthandTraffic = 1, RighthandTraffic = 2, Always = 3. You can cast from/to the underlying integer if needed.

Methods

  • The enum type inherits the standard System.Enum methods, for example:
  • ToString() — returns the name of the enum value.
  • HasFlag(Enum flag) — checks bit flags (not typically applicable unless the enum is treated as a flags enum).
  • static Parse / TryParse — convert strings to enum values.
  • Typical usage patterns involve comparing the enum value or switching on it to decide inversion logic in network/prefab code.

Usage Example

// Example: deciding whether to invert a network segment based on current traffic side
public bool ShouldInvert(NetInvertMode mode, bool isLeftHandTraffic)
{
    switch (mode)
    {
        case NetInvertMode.Never:
            return false;
        case NetInvertMode.LefthandTraffic:
            return isLeftHandTraffic;
        case NetInvertMode.RighthandTraffic:
            return !isLeftHandTraffic;
        case NetInvertMode.Always:
            return true;
        default:
            return false;
    }
}

// Example usage:
NetInvertMode mode = NetInvertMode.LefthandTraffic;
bool isLeft = true; // determined from game settings / locale
bool invert = ShouldInvert(mode, isLeft);