Game.Creatures.DomesticatedFlags
Assembly: Assembly-CSharp.dll
Namespace: Game.Creatures
Type: Enum
Base: System.Enum (underlying type: System.UInt32)
Summary: A bit-flag enum used to represent simple state flags for domesticated creatures. Marked with the [Flags] attribute so multiple states can be combined using bitwise operations. The underlying storage is a 32-bit unsigned integer (uint).
Fields
-
None = 0u
Represents no flags set. Use this as the default / cleared state. -
Idling = 1u
Flag indicating the creature is idling. Value is 1 (0x1). -
Wandering = 2u
Flag indicating the creature is wandering. Value is 2 (0x2). Can be combined with other flags (e.g., Idling | Wandering == 3).
Properties
This enum defines no properties.
Enums do not expose instance properties beyond the standard System.Enum members. Use bitwise operations or Enum.HasFlag to inspect flags.
Constructors
No explicit constructors
Enums do not define custom constructors. Values are created/assigned by literal enum values, casts, or by combining flags with bitwise operators.
Methods
No custom methods
This enum does not declare any methods. You can use System.Enum methods (e.g., ToString) and the instance method Enum.HasFlag(object) or bitwise operations (&, |, ~) to query and modify flag values. Note: Enum.HasFlag boxes the enum and can be slower than using bitwise checks.
Recommended patterns: - Test a flag: (state & DomesticatedFlags.Idling) != 0 - Set a flag: state |= DomesticatedFlags.Wandering - Clear a flag: state &= ~DomesticatedFlags.Idling - Toggle a flag: state ^= DomesticatedFlags.Wandering
Usage Example
using Game.Creatures;
public void Example()
{
// Start with no flags set
DomesticatedFlags state = DomesticatedFlags.None;
// Set flags
state |= DomesticatedFlags.Idling;
state |= DomesticatedFlags.Wandering;
// Combine is equivalent to 1 | 2 == 3
// Check a flag (bitwise is preferred for performance)
bool isIdling = (state & DomesticatedFlags.Idling) != 0;
// Clear a flag
state &= ~DomesticatedFlags.Idling;
// Alternative check using Enum.HasFlag (works but may be slower due to boxing)
bool isWandering = state.HasFlag(DomesticatedFlags.Wandering);
}
Additional notes: - Because the enum uses the [Flags] attribute, values are intended to be combined. Typically, flags should be powers of two; this enum follows that pattern for its defined values. - If you extend this enum in the future, choose unique bit values (e.g., 4u, 8u, 16u, ...) to allow independent combination.