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
sizeXintThe number of tiles along the lot's local X axis
sizeZintThe number of tiles along the lot's local Z axis
Exceptions
- ArgumentOutOfRangeException
sizeXorsizeZis 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
sizeXintThe number of tiles along the lot's local X axis
sizeZintThe number of tiles along the lot's local Z axis
vertexGridCountintThe number of vertex grids: the lot's level count if the lot's Version is less than 10, otherwise 2
hasWaterLevelsboolWhether there are water levels, which there are if the lot's Version is 12 or more
Exceptions
- ArgumentOutOfRangeException
sizeX,sizeZorvertexGridCountis 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
SizeX
Gets the number of tiles along the lot's local X axis
public int SizeX { get; }
Property Value
SizeZ
Gets the number of tiles along the lot's local Z axis
public int SizeZ { get; }
Property Value
VertexGridCount
Gets the number of vertex grids
public int VertexGridCount { get; }
Property Value
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
gridIndexintThe vertex grid: 0 for the terrain height when the lot's Version is 10 or more, otherwise the level − LowestLevel
xintThe corner's index along the lot's local X axis, 0 through SizeX
zintThe corner's index along the lot's local Z axis, 0 through SizeZ
Returns
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
xintThe tile's index along the lot's local X axis
zintThe tile's index along the lot's local Z axis
quarterFloorQuarterThe quarter of the tile
Returns
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
- ArgumentOutOfRangeException
A coordinate is outside the grid, or
quarteris 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
gridIndexintThe vertex grid (see GetVertexValue(int, int, int))
xintThe corner's index along the lot's local X axis, 0 through SizeX
zintThe corner's index along the lot's local Z axis, 0 through SizeZ
valuefloatThe 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
xintThe tile's index along the lot's local X axis
zintThe tile's index along the lot's local Z axis
quarterFloorQuarterThe quarter of the tile
valueintThe water level, or −400 for no water (see GetWaterLevel(int, int, FloorQuarter))
Exceptions
- InvalidOperationException
- ArgumentOutOfRangeException
A coordinate is outside the grid, or
quarteris not a FloorQuarter