Skip to content

Game.Vehicles.PostVanFlags

Assembly: Assembly-CSharp.dll
Namespace: Game.Vehicles

Type: public enum PostVanFlags : System.UInt32

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

Summary:
A bitmask enum used to represent the runtime state(s) of a postal/delivery van ("post van") in the game. The [Flags] attribute allows multiple states to be combined using bitwise operations. Typical uses include checking whether a van is delivering or returning, marking estimated states, and marking vehicles that are disabled or have been checked for clearing.


Fields

  • Returning = 1u
    Indicates the van is returning to its depot or origin (e.g., after finishing deliveries or because it has no more tasks).

  • Delivering = 2u
    Indicates the van is actively delivering items/mail to destinations.

  • Collecting = 4u
    Indicates the van is collecting items/mail from collection points (opposite of delivering).

  • DeliveryEmpty = 8u
    Indicates the van has no load while on a delivery route (empty during delivery).

  • CollectFull = 0x10u
    Indicates the van is full while collecting (has reached capacity).

  • EstimatedEmpty = 0x20u
    An estimated/predicted state indicating the van is expected to be empty (used by logic that predicts future load).

  • EstimatedFull = 0x40u
    An estimated/predicted state indicating the van is expected to be full.

  • Disabled = 0x80u
    Indicates the van is disabled/inactive (e.g., out of service, broken down, or paused).

  • ClearChecked = 0x100u
    A helper flag used by clearing/cleanup logic to mark that this van's flags have been checked/processed for clearing.

Properties

  • This enum type does not define instance properties. Use bitwise operations or System.Enum helpers (HasFlag, ToString, Parse, etc.) to query or manipulate values.

Constructors

  • Enums do not declare explicit constructors in C#. Instances are created by assigning one of the enum values or a combination of values (bitwise OR). There are no public constructors to document.

Methods

  • No custom methods are defined on this enum. For operations, use:
  • Bitwise operators (&, |, ~) to set, clear, and check flags.
  • Enum methods such as System.Enum.HasFlag, System.Enum.Parse, or Convert/ToString for conversions and checks.

Usage Example

// Combine flags
PostVanFlags flags = PostVanFlags.Delivering | PostVanFlags.EstimatedEmpty;

// Check a flag (recommended: bitwise check for performance in tight loops)
bool isDelivering = (flags & PostVanFlags.Delivering) != 0;

// Using HasFlag (less efficient but readable)
bool estimatedEmpty = flags.HasFlag(PostVanFlags.EstimatedEmpty);

// Set a flag
flags |= PostVanFlags.ClearChecked;

// Clear a flag
flags &= ~PostVanFlags.Delivering;

// Toggle a flag
flags ^= PostVanFlags.Disabled;

// Example in a vehicle update method (pseudo)
void UpdatePostVan(ref VehicleData v)
{
    PostVanFlags f = (PostVanFlags)v.flags;
    if ((f & PostVanFlags.Disabled) != 0)
    {
        // handle disabled state
    }
    if ((f & PostVanFlags.Collecting) != 0 && (f & PostVanFlags.CollectFull) != 0)
    {
        // vehicle is collecting and full — route it back or unload
    }
    // write back changes:
    v.flags = (uint)f;
}