Table of Contents

Class TerrainRGBLookup

Namespace
Map.Rendering.Terrain
Assembly
MapAssembly.dll

ENGINE: Loads terrain.json5 and provides fast RGB → Terrain Type Index lookups. Uses terrain.json5 as single source of truth (same as TerrainLoader and TerrainColorMapper). Terrain type indices are determined by ORDER in terrain.json5 categories section.

public class TerrainRGBLookup
Inheritance
object
TerrainRGBLookup

Properties

IsInitialized

Check if lookup is initialized

public bool IsInitialized { get; }

Property Value

bool

Methods

GetRGBToTerrainDictionary()

Get the RGB→Terrain dictionary (for bulk operations)

public Dictionary<(byte r, byte g, byte b), uint> GetRGBToTerrainDictionary()

Returns

Dictionary<(byte r, byte g, byte b), uint>

GetTerrainCount()

Get total number of terrain types defined

public uint GetTerrainCount()

Returns

uint

GetTerrainTypeIndex(byte, byte, byte)

Get terrain type index for given RGB color Returns 0 (default terrain) if color not found

public uint GetTerrainTypeIndex(byte r, byte g, byte b)

Parameters

r byte
g byte
b byte

Returns

uint

GetTerrainTypeName(uint)

Get terrain type name for given index (for debugging)

public string GetTerrainTypeName(uint index)

Parameters

index uint

Returns

string

Initialize(string, bool)

Load terrain.json5 and build lookup tables. Uses same file and parsing as TerrainLoader to guarantee identical index assignment.

public bool Initialize(string dataDirectory = null, bool logProgress = true)

Parameters

dataDirectory string
logProgress bool

Returns

bool

IsTerrainOwnable(ushort)

Check if terrain type is ownable by ushort terrain ID

public bool IsTerrainOwnable(ushort terrainIndex)

Parameters

terrainIndex ushort

Returns

bool

IsTerrainOwnable(uint)

Check if terrain type is ownable (can be colonized/owned) Returns true by default if terrain index not found

public bool IsTerrainOwnable(uint terrainIndex)

Parameters

terrainIndex uint

Returns

bool