Game.Creatures.CreatureVehicleFlags
Assembly: Assembly-CSharp
Namespace: Game.Creatures
Type: enum
Base: System.Enum (underlying type: System.UInt32)
Summary: CreatureVehicleFlags is a bitflags enumeration used to describe state/roles of a creature's vehicle or a creature when interacting with vehicle-related logic (e.g., whether the creature is ready, is a leader, is driving, or is entering/exiting a vehicle). The enum is marked with [Flags], so values are intended to be combined with bitwise operations. The underlying type is an unsigned 32-bit integer (uint).
Fields
-
Ready = 1u
Indicates the creature/vehicle is ready (primary/initial state). This is the least-significant bit (0x1). -
Leader = 2u
Marks the creature as a leader in a group or convoy (0x2). -
Driver = 4u
Indicates the creature is acting as a driver (0x4). -
Entering = 8u
The creature is in the process of entering a vehicle (0x8). -
Exiting = 0x10u
The creature is in the process of exiting a vehicle (0x10 / 16).
Properties
- This enum type defines no instance properties. It is a simple flags enum with an underlying type of System.UInt32. Use bitwise operators or Enum.HasFlag to query or modify values.
Constructors
- Enums do not have explicit constructors. Variables of this enum type can be assigned any defined constant or any uint-cast combination of values. The default value when uninitialized is 0 (no flags set).
Methods
- As an enum, CreatureVehicleFlags inherits standard System.Enum methods such as:
- ToString() — returns the textual name(s) of set flags.
- HasFlag(Enum flag) — checks if a particular flag is set (convenient but slightly slower).
- Parse / TryParse — convert from string names to enum values.
- Typical usage relies on bitwise operators (&, |, ^, ~) and casts to/from uint for high-performance checks and serialization.
Usage Example
// Combine flags
CreatureVehicleFlags flags = CreatureVehicleFlags.Ready | CreatureVehicleFlags.Driver;
// Check if Driver is set (fast bitwise check)
bool isDriver = (flags & CreatureVehicleFlags.Driver) != 0;
// Alternatively using Enum.HasFlag (slightly slower)
bool isDriverViaHasFlag = flags.HasFlag(CreatureVehicleFlags.Driver);
// Set a flag (e.g., mark as entering)
flags |= CreatureVehicleFlags.Entering;
// Clear a flag (e.g., no longer entering)
flags &= ~CreatureVehicleFlags.Entering;
// Toggle a flag (e.g., toggle Leader)
flags ^= CreatureVehicleFlags.Leader;
// Cast to uint for serialization/storage
uint serialized = (uint)flags;
// Restore from serialized value
CreatureVehicleFlags restored = (CreatureVehicleFlags)serialized;