Game.Creatures.ResidentFlags
Assembly:
Assembly-CSharp (typical for game code / mods)
Namespace: Game.Creatures
Type: enum (with [Flags] attribute)
Base: System.Enum (underlying type: System.UInt32)
Summary:
ResidentFlags is a bitmask enum used to represent a resident's runtime state and behavior modifiers in the game's creature/resident system. The enum is marked with [Flags], so multiple values can be combined with bitwise operators to represent composite states (for example, InVehicle | WaitingTransport). Values are stored as unsigned 32-bit integers.
Fields
-
None = 0u
Represents no flags set — the default state. -
Disembarking = 1u
The resident is disembarking from a vehicle (getting off). -
ActivityDone = 2u
The resident has completed their current activity. -
WaitingTransport = 4u
The resident is waiting for a transport (e.g., bus, train). -
Arrived = 8u
The resident has arrived at their destination. -
Hangaround = 0x10u
(16)
The resident is loitering or waiting in place without a specific transport/activity. -
InVehicle = 0x20u
(32)
The resident is currently inside a vehicle. -
PreferredLeader = 0x40u
(64)
Marks the resident as a preferred leader in group movement or behaviour (used when grouping creatures/residents). -
NoLateDeparture = 0x80u
(128)
Prevents late departures for scheduled trips/activities (used to influence departure logic). -
IgnoreTaxi = 0x100u
(256)
Resident should ignore taxi services when choosing transport. -
IgnoreTransport = 0x200u
(512)
Resident should ignore public transport entirely. -
IgnoreBenches = 0x400u
(1024)
Resident should not consider benches (sit/wait behavior) when choosing actions. -
IgnoreAreas = 0x800u
(2048)
Resident ignores area-based rules (area restrictions or preferences). -
CannotIgnore = 0x1000u
(4096)
A modifier that prevents the resident from being affected by certain "ignore" flags — used to force some behaviours. -
DummyTraffic = 0x2000u
(8192)
Used for placeholder/dummy traffic entities; likely used for simulation-only traffic that shouldn't interact like normal residents.
Properties
- This enum does not define instance properties. Use bitwise operations or System.Enum helpers for checks and conversions.
Constructors
- Enums do not expose custom constructors. The default value is 0 (ResidentFlags.None). You can cast from the underlying numeric type (uint) if needed:
- Example:
(ResidentFlags)0u
isResidentFlags.None
Methods
- No methods are declared on the enum itself. Use methods available on System.Enum and standard C# operators:
- To combine flags:
flags = ResidentFlags.InVehicle | ResidentFlags.Arrived;
- To remove a flag:
flags &= ~ResidentFlags.WaitingTransport;
- To toggle a flag:
flags ^= ResidentFlags.Hangaround;
- To test a flag (recommended, performant):
(flags & ResidentFlags.InVehicle) != 0
- Alternatively:
flags.HasFlag(ResidentFlags.InVehicle)
(note: HasFlag can box the enum and be slightly slower) - Useful System.Enum helpers:
Enum.Parse
,Enum.TryParse
,Enum.GetValues
,Enum.GetNames
,ToString()
.
Usage Example
// Mark a resident as disembarking and in a vehicle (bitwise combination)
ResidentFlags flags = ResidentFlags.Disembarking | ResidentFlags.InVehicle;
// Check for a specific flag (preferred bitwise check for performance)
if ((flags & ResidentFlags.InVehicle) != 0)
{
// resident is in a vehicle
}
// Add a flag
flags |= ResidentFlags.ActivityDone;
// Remove a flag
flags &= ~ResidentFlags.Disembarking;
// Toggle a flag
flags ^= ResidentFlags.Hangaround;
// Parse from string (safe with TryParse)
if (Enum.TryParse<ResidentFlags>("InVehicle,Arrived", out var parsed))
{
// parsed contains the combined flags
}
Notes and tips:
- Because this enum is marked with [Flags], treat values as a bitfield and use bitwise operations for tests and modifications.
- Prefer the bitwise check ((flags & X) != 0) over Enum.HasFlag in performance-sensitive code to avoid boxing.
- The underlying type is uint — when interacting with APIs that expect numeric types, cast explicitly: (uint)flags
.