Skip to content

Game.Buildings.PrisonFlags

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

Type: public enum (with [Flags])

Base: System.Byte

Summary:
PrisonFlags is a bitmask enumeration (marked with [Flags]) used to represent simple boolean/state flags for prison-type buildings. Each value occupies a single byte (underlying type is byte) so multiple flags can be combined using bitwise operations. Typical uses include tracking whether a prison has available transport (vans) or available prisoner capacity, which AI/building logic can query to decide actions (dispatching vans, accepting prisoners, etc.).


Fields

  • HasAvailablePrisonVans = 1
    Indicates the prison currently has one or more prison vans/transport units available. Game logic can check this flag to decide whether to send/allow prisoner transports.

  • HasPrisonerSpace = 2
    Indicates the prison currently has free capacity to accept additional prisoners.

(As a [Flags] enum, these values can be combined. A value of 0 means none of the flags are set.)

Properties

  • None declared on the enum type itself.
    Note: you can use System.Enum instance methods such as HasFlag, ToString, and the static Parse/TryParse helpers when working with this enum.

Constructors

  • None declared. (Enums have an implicit default value corresponding to 0.)

Methods

  • None declared on this enum.
    Inherited/available operations include bitwise operators and System.Enum methods (e.g., HasFlag, ToString, Parse, TryParse).

Usage Example

// Combine flags
PrisonFlags flags = PrisonFlags.HasAvailablePrisonVans | PrisonFlags.HasPrisonerSpace;

// Check flags using bitwise operator
bool hasSpace = (flags & PrisonFlags.HasPrisonerSpace) == PrisonFlags.HasPrisonerSpace;

// Or use HasFlag (convenience, slightly slower)
bool hasVans = flags.HasFlag(PrisonFlags.HasAvailablePrisonVans);

// Clearing a flag
flags &= ~PrisonFlags.HasAvailablePrisonVans;

// Convert to byte for compact storage or network/state serialization
byte raw = (byte)flags;

// Restore from raw byte
PrisonFlags restored = (PrisonFlags)raw;

Additional notes: - Because the enum uses an underlying byte, it's efficient for storage in building state structures. - Remember to treat combined flag checks as bitwise operations; avoid comparing directly to 0 unless intentionally checking for "no flags set."