Game.Common.TypeMask
Assembly: Game
Namespace: Game.Common
Type: public enum (with [Flags], underlying type: System.UInt32)
Base: System.Enum (System.ValueType) — underlying integral type: uint
Summary: TypeMask is a flagged bitmask enumeration used to represent groups of in-game object types and layers (terrain, static/moving objects, nets, zones, water, etc.). Mods can use these flags to filter, query, or operate on specific categories of world data (for example: rendering layers, selection/filtering, collision queries, updates, or debugging). Because it is decorated with [Flags], values can be combined with bitwise operations and tested with HasFlag or bitwise comparisons.
Fields
-
Terrain = 1u
Represents terrain geometry/tiles. -
StaticObjects = 2u
Represents non-moving buildings/props and other static scene objects. -
MovingObjects = 4u
Represents dynamic or moving objects (vehicles, pedestrians, animated props). -
Net = 8u
Represents network elements such as roads, rails, and their related structures. -
Zones = 0x10u
Represents zoning areas (residential, commercial, industrial, etc.). -
Areas = 0x20u
Represents area definitions used by the game (park areas, district/area overlays, etc.). -
RouteWaypoints = 0x40u
Represents route waypoint data (navigation nodes used by pathing). -
RouteSegments = 0x80u
Represents route segments (connections between waypoints, path segments). -
Labels = 0x100u
Represents on-screen labels and annotations (building names, info panels). -
Water = 0x200u
Represents water bodies and water-related geometry. -
Icons = 0x400u
Represents icon overlays (UI icons rendered in world space). -
WaterSources = 0x800u
Represents water source features (springs, pumps, or water supply markers). -
Lanes = 0x1000u
Represents individual traffic lanes and lane-specific data. -
None = 0u
No types selected. -
All = uint.MaxValue
All types selected (every bit set). Useful shorthand when you need to include every category.
Properties
- None specific to this enum type.
(Note: enum instances expose standard enum behavior; you can use System.Enum methods and bitwise operators. For example: TypeMask mask = TypeMask.Terrain | TypeMask.Water;)
Constructors
- Enum types do not declare explicit constructors in user code.
The default value is 0 (TypeMask.None). Instances are created by assigning one of the enum values or combinations thereof.
Methods
- This enum inherits the standard System.Enum/System.ValueType methods such as:
- ToString() — returns the name(s) of the flag(s) set.
- HasFlag(Enum flag) — checks whether a given flag is set.
- static Enum.Parse / TryParse — parse from string.
For bitwise checks and combinations, use standard C# operators (&, |, ~, ^).
Usage Example
// Combine flags
TypeMask mask = TypeMask.Terrain | TypeMask.Water | TypeMask.Labels;
// Test a flag (preferred for performance in hot code: bitwise check)
bool hasWater = (mask & TypeMask.Water) != 0;
// Or use HasFlag (convenient, slightly slower)
bool hasLabels = mask.HasFlag(TypeMask.Labels);
// Clear a flag
mask &= ~TypeMask.Terrain;
// Set all flags
mask = TypeMask.All;
// Check for none
if (mask == TypeMask.None) { /* nothing selected */ }
// Cast to uint when interfacing with low-level APIs
uint raw = (uint)mask;
{{ TypeMask is used throughout game systems that need to classify or filter entities and rendering layers. When writing mods, prefer bitwise checks in tight loops for performance; use HasFlag for clarity in non-performance-sensitive code. }}