Skip to content

Game.Areas.AreaType

Assembly: Assembly-CSharp
Namespace: Game.Areas

Type: enum

Base: System.Enum

Summary:
AreaType is an enumeration used to classify different kinds of "areas" the game logic may operate on (lots, districts, map tiles, etc.). Mods and game systems use these values to route area-specific logic (rendering, editing, pathfinding, zoning, serialization). The enum includes sentinel values for "None" and "Count" to represent an invalid/absent value and the number of defined area kinds respectively.


Fields

  • None = -1
    Used to indicate no area / an invalid or uninitialized value. Treat this as an explicit "no selection" sentinel. Many APIs check for None before acting.

  • Lot = 0
    Represents a single lot (individual parcel/plot). Used for lot-level operations such as lot editing, property queries and localized rendering around a parcel.

  • District = 1
    Represents a district-level area (custom or built-in district regions). Used where logic applies to grouped areas defined by the player (taxation, policies, district overlays).

  • MapTile = 2
    Represents a map tile (a chunk of the overall world grid). Systems that operate on tile-sized blocks (loading/unloading, tile-level simulation) will use this.

  • Space = 3
    Represents volumetric or non-surface areas (for example, 3D spaces or layers above/below the surface). Used for logic that is not confined to surface-only areas.

  • Surface = 4
    Represents the ground/surface layer (the game world ground plane). Used for surface-oriented systems like terrain editing, ground-level rendering and surface-based queries.

  • Count = 5
    Count of enumerated area types. Useful for bounds-checking, iteration limits or creating arrays indexed by AreaType (avoid relying on Count as a valid area itself).

Properties

  • This enum does not declare any properties.
    (As an enum, AreaType provides no instance properties beyond standard System.Enum members and conversion helpers.)

Constructors

  • Enums have no user-defined constructors.
    (AreaType values are created by assignment or casting from integers; the underlying value type is an integer. The compiler provides the necessary value-type behavior.)

Methods

  • This enum does not declare any methods.
    (Use System.Enum utilities like Enum.IsDefined, Enum.GetValues, or standard C# casts and comparisons when working with AreaType.)

Usage Example

// Example usage patterns for AreaType in a mod:
using Game.Areas;
using System;

public void HandleArea(AreaType areaType)
{
    if (areaType == AreaType.None)
    {
        // Nothing to do
        return;
    }

    switch (areaType)
    {
        case AreaType.Lot:
            // Handle lot-specific logic
            break;
        case AreaType.District:
            // Handle district policies, overlays
            break;
        case AreaType.MapTile:
            // Load/unload tile resources or update tile simulation
            break;
        case AreaType.Space:
            // Handle non-surface/volume-specific behavior
            break;
        case AreaType.Surface:
            // Surface-level processing (terrain, ground render)
            break;
        default:
            // Protect against unexpected values (for future compatibility)
            if (!Enum.IsDefined(typeof(AreaType), areaType))
            {
                // Log or handle unknown/extended enum value
            }
            break;
    }
}

// Iterating over defined area types (excluding None and Count)
for (int i = 0; i < (int)AreaType.Count; i++)
{
    var type = (AreaType)i;
    // Skip None if present at -1 (it won't be hit by this loop)
    // Use type for array indexing, initialization, etc.
}

Additional notes (for modders): - Prefer checking AreaType.None before performing operations.
- Avoid hard-coding integer values — cast or compare to enum members instead.
- Use AreaType.Count as a bound when creating arrays indexed by AreaType, but do not treat Count as a valid area value.
- Use Enum.IsDefined when validating external data (saved values, networked integers) before casting to AreaType.