Skip to content

Game.ExtractorRequirementFlags

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

Type: enum (with [Flags] attribute)

Base: System.Enum

Summary:
ExtractorRequirementFlags is a bitmask enum used by extractor prefabs to indicate what kinds of connectivity requirements an extractor has. The [Flags] attribute allows multiple requirement values to be combined (bitwise). Typical uses in modding: checking whether an extractor requires a route connection, a network connection, both, or none; storing requirement state on prefab data; and conditionally enabling behaviour in building/AI code based on these flags.


Fields

  • None = 0
    Represents no special extraction connectivity requirements. Use this value when an extractor has no route or network dependency.

  • RouteConnect = 1
    Indicates the extractor requires a route connection (e.g., a transport/route link). This flag occupies the first bit.

  • NetConnect = 2
    Indicates the extractor requires a net/network connection (e.g., road/utility network). This flag occupies the second bit.

Properties

  • This enum type does not define instance properties. Use enum values directly and the System.Enum/bitwise helpers when needed (e.g., Enum.HasFlag, bitwise & / |).

Constructors

  • Enums do not expose custom constructors. Values are created/assigned by using the enum literals or by casting from an integer: (ExtractorRequirementFlags)1.

Methods

  • The enum itself does not declare methods. Work with it using standard enum/bitwise operations:
  • Bitwise OR (|) to combine flags.
  • Bitwise AND (&) or Enum.HasFlag to test for a flag.
  • Casting to/from numeric types to store/serialize.

Example checks you will commonly use in code: - (flags & ExtractorRequirementFlags.RouteConnect) != 0 - flags.HasFlag(ExtractorRequirementFlags.NetConnect)

Usage Example

// Combine requirements: extractor needs both route and network connections
ExtractorRequirementFlags req = ExtractorRequirementFlags.RouteConnect | ExtractorRequirementFlags.NetConnect;

// Check for a specific requirement
if ((req & ExtractorRequirementFlags.RouteConnect) != 0)
{
    // handle route connection requirement
}

// Using HasFlag (less performant than bitwise check, but clearer)
if (req.HasFlag(ExtractorRequirementFlags.NetConnect))
{
    // handle net connection requirement
}

Notes for modders: - Preserve existing numeric values if you extend this enum to avoid breaking serialized prefab data or saved games. - Prefer bitwise checks for performance-critical code. - The [Flags] attribute affects ToString() output (combined flags print as comma-separated names).