Table of Contents

Class TerrainHeightsSection

Namespace
LlamaLogic.Architecture
Assembly
LlamaLogic.Architecture.dll

Represents the TerrainHeights section: the lot's terrain height grid, a second vertex grid of unknown role and a water level per tile quarter (🔓)

public sealed class TerrainHeightsSection : LotArchitectureSection
Inheritance
TerrainHeightsSection
Inherited Members

Remarks

The layout depends on the lot's Version; the section has no version of its own. First come VertexGridCount grids of (SizeX + 1) × (SizeZ + 1) 32-bit floats, one per tile corner, stored as SizeX + 1 rows of SizeZ + 1 values. Then, when HasWaterLevels, four 32-bit integers per tile, one per FloorQuarter, the tiles stored as SizeX rows of SizeZ.

When the lot's Version is less than 10 there is one vertex grid per level, indexed by level − LowestLevel, and the game skips all but the ground level's grid, which holds the terrain height. From version 10 there are two: grid 0 is the terrain height (the game's terrain height getter and setter use it, and in-game tests show that sculpting the terrain changes only this grid) and grid 1 is a second per-corner grid whose role is unknown; in-game tests with the raise, flatten and smooth tools changed only grid 0 and left grid 1 unchanged. The water levels are present from version 12; before it the game fills them with −400, which means no water.

Constructors

TerrainHeightsSection(int, int)

Initializes a new instance of the TerrainHeightsSection class in the layout of a lot whose Version is 12 or more, with two vertex grids and water levels, every vertex value 0 and every water level −400 (no water)

public TerrainHeightsSection(int sizeX, int sizeZ)

Parameters

sizeX int

The number of tiles along the lot's local X axis

sizeZ int

The number of tiles along the lot's local Z axis

Exceptions

ArgumentOutOfRangeException

sizeX or sizeZ is not 0 through 255

TerrainHeightsSection(int, int, int, bool)

Initializes a new instance of the TerrainHeightsSection class with every vertex value 0 and every water level −400 (no water)

public TerrainHeightsSection(int sizeX, int sizeZ, int vertexGridCount, bool hasWaterLevels)

Parameters

sizeX int

The number of tiles along the lot's local X axis

sizeZ int

The number of tiles along the lot's local Z axis

vertexGridCount int

The number of vertex grids: the lot's level count if the lot's Version is less than 10, otherwise 2

hasWaterLevels bool

Whether there are water levels, which there are if the lot's Version is 12 or more

Exceptions

ArgumentOutOfRangeException

sizeX, sizeZ or vertexGridCount is not 0 through 255

Properties

HasWaterLevels

Gets whether the section holds a water level per tile quarter, which it does when the lot's Version is 12 or more

public bool HasWaterLevels { get; }

Property Value

bool

SizeX

Gets the number of tiles along the lot's local X axis

public int SizeX { get; }

Property Value

int

SizeZ

Gets the number of tiles along the lot's local Z axis

public int SizeZ { get; }

Property Value

int

VertexGridCount

Gets the number of vertex grids

public int VertexGridCount { get; }

Property Value

int

Methods

GetVertexValue(int, int, int)

Gets the value of a tile corner in a vertex grid

public float GetVertexValue(int gridIndex, int x, int z)

Parameters

gridIndex int

The vertex grid: 0 for the terrain height when the lot's Version is 10 or more, otherwise the level − LowestLevel

x int

The corner's index along the lot's local X axis, 0 through SizeX

z int

The corner's index along the lot's local Z axis, 0 through SizeZ

Returns

float

Exceptions

ArgumentOutOfRangeException

A coordinate is outside the grid

GetWaterLevel(int, int, FloorQuarter)

Gets the water level of a quarter of a tile, in steps of 0.25 m

public int GetWaterLevel(int x, int z, FloorQuarter quarter)

Parameters

x int

The tile's index along the lot's local X axis

z int

The tile's index along the lot's local Z axis

quarter FloorQuarter

The quarter of the tile

Returns

int

Remarks

−400 (the game's default) means no water, and the value is −400 almost everywhere. The game multiplies it by 0.25 and uses the result minus the floor or terrain height as a water depth. In the lots examined it differs from −400 on every quarter of every pond and then equals the pond's WaterLevel; raising a pond's water level one step in game changed it from −3 to −2 on every quarter of the pond together with WaterLevel (in-game test).

Exceptions

InvalidOperationException

HasWaterLevels is false

ArgumentOutOfRangeException

A coordinate is outside the grid, or quarter is not a FloorQuarter

SetVertexValue(int, int, int, float)

Sets the value of a tile corner in a vertex grid

public void SetVertexValue(int gridIndex, int x, int z, float value)

Parameters

gridIndex int

The vertex grid (see GetVertexValue(int, int, int))

x int

The corner's index along the lot's local X axis, 0 through SizeX

z int

The corner's index along the lot's local Z axis, 0 through SizeZ

value float

The value

Exceptions

ArgumentOutOfRangeException

A coordinate is outside the grid

SetWaterLevel(int, int, FloorQuarter, int)

Sets the water level of a quarter of a tile, in steps of 0.25 m

public void SetWaterLevel(int x, int z, FloorQuarter quarter, int value)

Parameters

x int

The tile's index along the lot's local X axis

z int

The tile's index along the lot's local Z axis

quarter FloorQuarter

The quarter of the tile

value int

The water level, or −400 for no water (see GetWaterLevel(int, int, FloorQuarter))

Exceptions

InvalidOperationException

HasWaterLevels is false

ArgumentOutOfRangeException

A coordinate is outside the grid, or quarter is not a FloorQuarter