Skip to content

Game.Buildings.WaterConsumerFlags

Assembly: Assembly-CSharp
Namespace: Game.Buildings

Type: public enum
Base: System.Enum (underlying type: System.Byte)

Summary: A compact bitmask enum (marked with [Flags]) that represents a building's water-related connections. Each value is a single-bit flag stored in a byte, allowing combination to represent multiple connection states (e.g., both water and sewage connected). This enum is intended for quick checks and compact storage of connection state for water/sewage consumers.


Fields

  • None = 0 Represents no connections. This is the default value (no flags set).

  • WaterConnected = 1 Indicates the building is connected to the potable water network (water supply).

  • SewageConnected = 2 Indicates the building is connected to the sewage network (sewer).

(Combining WaterConnected | SewageConnected yields value 3 — both connections present.)

Properties

  • None This type is a simple enum and does not declare properties. Use bitwise operations or Enum helper methods to inspect or manipulate flag values.

Constructors

  • None (enum types do not declare explicit constructors) The default value is 0 (None). You can cast from a numeric type (byte) to this enum because its underlying type is byte.

Methods

  • None (no custom methods defined) Use standard enum/bitwise operations to work with values: HasFlag (System.Enum.HasFlag), bitwise &, |, ^, and ~. Casting to/from byte is supported for compact storage.

Usage Example

// combine flags
var flags = Game.Buildings.WaterConsumerFlags.WaterConnected | Game.Buildings.WaterConsumerFlags.SewageConnected;

// check flags (fast bitwise test)
if ((flags & Game.Buildings.WaterConsumerFlags.WaterConnected) != 0)
{
    // building has potable water
}

// alternative (slower, uses Enum.HasFlag)
if (flags.HasFlag(Game.Buildings.WaterConsumerFlags.SewageConnected))
{
    // building has sewage connection
}

// set a flag
flags |= Game.Buildings.WaterConsumerFlags.SewageConnected;

// clear a flag
flags &= ~Game.Buildings.WaterConsumerFlags.WaterConnected;

// storing and restoring compactly (underlying type is byte)
byte raw = (byte)flags;
var restored = (Game.Buildings.WaterConsumerFlags)raw;