Game.Tools.AgeMask
Assembly: Assembly-CSharp (game runtime assembly; typical for Cities: Skylines 2 modding)
Namespace: Game.Tools
Type: public enum (flags)
Base: System.Enum (underlying type: byte)
Summary:
AgeMask is a [Flags] enum used to represent one or more age categories as a bitmask (byte) — suitable for tagging or filtering objects by age group (for example trees/plants, citizens, or other age-related systems). Each named value is a single-bit flag so multiple ages can be combined with bitwise operations.
Fields
-
Sapling = 1
Represents the "sapling" age group. Bit 0 (value 1). -
Young = 2
Represents the "young" age group. Bit 1 (value 2). -
Mature = 4
Represents the "mature" age group. Bit 2 (value 4). -
Elderly = 8
Represents the "elderly" age group. Bit 3 (value 8).
Properties
- This enum defines no properties.
Constructors
- Enums do not declare constructors. The default enum value (0) means "no flags set" but there is no named
None
member in this enum — you can treat(AgeMask)0
as "no age selected" or define your ownNone
if needed.
Methods
- This enum defines no methods. Use standard enum/bitwise operations or System.Enum.HasFlag for checks.
Usage Example
// Combine flags
AgeMask mask = AgeMask.Sapling | AgeMask.Young;
// Check with bitwise operation (preferred for performance)
if ((mask & AgeMask.Mature) != 0)
{
// mask includes Mature
}
// Check with HasFlag (convenient but slightly less performant)
if (mask.HasFlag(AgeMask.Sapling))
{
// mask includes Sapling
}
// Add or remove flags
mask |= AgeMask.Mature; // add Mature
mask &= ~AgeMask.Young; // remove Young
// Test for no flags set
bool none = mask == 0; // or (mask == (AgeMask)0)
Notes: - Because the enum is marked with [Flags], combine values with | and test with & or HasFlag. - The underlying type is byte, so the mask occupies a single byte; expand carefully if you plan to add more categories.