Skip to content

Game.Buildings.TransportDepotFlags

Assembly: Assembly-CSharp
Namespace: Game.Buildings

Type: public enum TransportDepotFlags : byte

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

Summary: Flags enum describing per-depot state bits for transport depots (e.g., whether the depot currently has vehicles available or whether it contains a dispatch center). Marked with [Flags] so values can be combined with bitwise operations.


Fields

  • HasAvailableVehicles = 1 Indicates the depot currently has one or more vehicles available to dispatch. Use this flag to check if the depot can immediately serve transport requests.

  • HasDispatchCenter = 2 Indicates the depot includes a dispatch center (e.g., an upgraded facility or additional infrastructure). This can be used to enable dispatch-related features or logic.

Properties

  • None This enum does not declare any properties. Use bitwise operations or Enum helper methods to query values.

Constructors

  • Implicit enum constructor Enums do not expose public constructors. Values are created by assignment or casting, for example: TransportDepotFlags flags = TransportDepotFlags.HasAvailableVehicles;

Methods

The enum inherits the usual System.Enum methods (e.g., ToString, HasFlag via System.Enum/Enum methods and static Parse/TryParse). Common patterns for working with this flags enum:

  • Checking a flag (recommended for performance-critical code — avoids boxing): (flags & TransportDepotFlags.HasAvailableVehicles) != 0

  • Using Enum.HasFlag (convenient but may box the enum): flags.HasFlag(TransportDepotFlags.HasDispatchCenter)

  • Combining flags: flags = TransportDepotFlags.HasAvailableVehicles | TransportDepotFlags.HasDispatchCenter;

  • Clearing a flag: flags &= (byte)~(byte)TransportDepotFlags.HasDispatchCenter; or flags &= ~TransportDepotFlags.HasDispatchCenter;

Note: Because the underlying type is byte, casting may be required in some low-level code or when interacting with serialized/packed data structures.

Usage Example

// Example usage of TransportDepotFlags in mod code

// Setting flags
TransportDepotFlags flags = TransportDepotFlags.HasAvailableVehicles;

// Add another flag (combine)
flags |= TransportDepotFlags.HasDispatchCenter;

// Check flags (bitwise, preferred in hot paths)
bool hasVehicles = (flags & TransportDepotFlags.HasAvailableVehicles) != 0;
bool hasDispatchCenter = (flags & TransportDepotFlags.HasDispatchCenter) != 0;

// Clear a flag
flags &= ~TransportDepotFlags.HasAvailableVehicles;

// Using Enum.HasFlag (convenient, may box)
if (flags.HasFlag(TransportDepotFlags.HasDispatchCenter))
{
    // do dispatch-center specific logic
}

// Working with underlying byte (e.g., storing in compact struct)
byte packed = (byte)flags;
TransportDepotFlags restored = (TransportDepotFlags)packed;