Skip to content

Game.Events.DangerFlags

Assembly:
Unknown (likely the game's core assembly containing Game.Events)
Namespace: Game.Events

Type: public enum (flags)

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

Summary:
DangerFlags is a bitmask-style enumeration used to describe recommended or required citizen actions/behaviors during in-game danger or emergency events (e.g., disasters, alerts). The enum is marked with [Flags], so individual values can be combined to represent multiple simultaneous instructions (for example, Evacuate | UseTransport). The underlying storage is a 32-bit unsigned integer (uint), and each member represents a distinct bit.


Fields

  • StayIndoors = 1u
    Indicates that citizens should remain inside buildings (shelter-in-place).

  • Evacuate = 2u
    Indicates that citizens should evacuate the affected area.

  • UseTransport = 4u
    Indicates that citizens should use available transportation (buses, trains, etc.) as part of the response.

  • WaitingCitizens = 8u
    Indicates that citizens are waiting (e.g., waiting for rescue or instructions).

Properties

  • None (enum type — no properties)
    Enums do not expose properties. Use bitwise operations or Enum methods as needed to inspect values.

Constructors

  • None (enum values are compile-time constants)
    Enums do not have instance constructors. Each named value is a constant mapped to the specified uint value.

Methods

  • None (no custom methods defined)
    Use standard Enum utilities and bitwise operators to work with flags. Note: Enum.HasFlag(object) exists but causes boxing; prefer bitwise checks for performance-sensitive code.

Usage Example

// Combine flags
DangerFlags flags = DangerFlags.Evacuate | DangerFlags.UseTransport;

// Check flags (recommended: bitwise check to avoid boxing)
bool shouldEvacuate = (flags & DangerFlags.Evacuate) == DangerFlags.Evacuate;
bool shouldUseTransport = (flags & DangerFlags.UseTransport) == DangerFlags.UseTransport;

// Add a flag
flags |= DangerFlags.WaitingCitizens;

// Remove a flag
flags &= ~DangerFlags.UseTransport;

// Serialize/store as uint if needed
uint rawFlags = (uint)flags;

// Recreate enum from raw value
DangerFlags fromRaw = (DangerFlags)rawFlags;

Additional notes: - Because the enum is declared with [Flags], combine members using bitwise OR (|) and test using bitwise AND (&). - Avoid Enum.HasFlag in tight loops due to boxing; prefer (value & Flag) == Flag. - Values 1u, 2u, 4u, 8u correspond to bit positions 0..3; additional flags can be added using higher bit values (e.g., 16u, 32u) if needed.