Skip to content

Game.Vehicles.AmbulanceFlags

Assembly: Assembly-CSharp
Namespace: Game.Vehicles

Type: enum (with [Flags] attribute)

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

Summary:
AmbulanceFlags is a bitmask enum used to represent the current state(s) of an ambulance in the game. Each named value corresponds to a single bit (or flag) so multiple states can be combined using bitwise operations. Typical uses include checking whether an ambulance is dispatched, transporting a patient, searching for a hospital, or marked critical.


Fields

  • Returning = 1u
    Flag value 0x00000001 — indicates the ambulance is returning (likely to base or depot).

  • Dispatched = 2u
    Flag value 0x00000002 — the ambulance has been dispatched to respond to an incident.

  • Transporting = 4u
    Flag value 0x00000004 — the ambulance is currently transporting a patient.

  • AnyHospital = 8u
    Flag value 0x00000008 — the ambulance may use any hospital (flag controlling hospital-choice behavior).

  • FindHospital = 0x10u
    Flag value 0x00000010 (16) — the ambulance is actively searching for a hospital.

  • AtTarget = 0x20u
    Flag value 0x00000020 (32) — the ambulance has reached its target location.

  • Disembarking = 0x40u
    Flag value 0x00000040 (64) — the ambulance is disembarking the patient.

  • Disabled = 0x80u
    Flag value 0x00000080 (128) — the ambulance is disabled/out of service.

  • Critical = 0x100u
    Flag value 0x00000100 (256) — the ambulance (or transported patient) is in a critical state; usually used to prioritize handling.

Properties

  • This enum type does not declare any properties.
    Use of the Flags attribute affects enum string formatting and how multiple values are represented (e.g., "Dispatched, FindHospital").

Constructors

  • Enums don't have typical constructors exposed; values are created/assigned by casting or using enum literals.
    There is no explicit constructor defined for AmbulanceFlags. The implicit default value is 0 (no flags set), which is not one of the named fields above.

Methods

  • No instance methods are defined on this enum. Standard static/instance methods from System.Enum apply (e.g., Enum.HasFlag, Enum.ToString, Enum.IsDefined).
    Performance note: Enum.HasFlag boxes the enum and can be slower — prefer bitwise checks ((flags & AmbulanceFlags.SomeFlag) != 0) in performance-sensitive code (such as game loops).

Usage Example

// Set flags
AmbulanceFlags flags = AmbulanceFlags.Dispatched | AmbulanceFlags.FindHospital;

// Check if a single flag is set (fast, no boxing)
if ((flags & AmbulanceFlags.Transporting) != 0)
{
    // transporting logic
}

// Check for a specific flag
if ((flags & AmbulanceFlags.Dispatched) == AmbulanceFlags.Dispatched)
{
    // dispatched logic
}

// Add a flag
flags |= AmbulanceFlags.AtTarget;

// Remove a flag
flags &= ~AmbulanceFlags.FindHospital;

// Toggle a flag
flags ^= AmbulanceFlags.Returning;

// Using HasFlag (slower due to boxing)
if (flags.HasFlag(AmbulanceFlags.Critical))
{
    // critical handling
}

// Raw underlying value
uint raw = (uint)flags;
flags = (AmbulanceFlags)(raw | 0x200u); // combine with a raw bit if needed

{{ Additional notes: - Because this enum uses an explicit unsigned 32-bit underlying type (uint), casting to/from uint is safe and sometimes useful when storing or transmitting the raw flag value. - When adding new flags, keep them as distinct powers of two to preserve bitmask behavior. - Avoid relying on any implicit ordering; treat each flag as an independent boolean state that may be combined with others. - Not every combination may be meaningful; ensure game logic validates states (for example, Transporting and Returning might be mutually exclusive in some logic flows). }}