Table of Contents

Class Roof

Namespace
LlamaLogic.Architecture
Assembly
LlamaLogic.Architecture.dll

Represents one roof of a RoofsSection

public sealed class Roof
Inheritance
Roof
Inherited Members

Remarks

From version 10 of the section on, a roof holds an InnerVersion, the bounding box of its footprint, the four corners of its footprint, Direction, Pitch, Curvature, four more floats (inner version 3 and later), BaseElevation, four per-side bytes (one byte copied to all four before inner version 2) and Flags. Before version 10, a roof holds only the bounding box (as two three-byte points), Direction, one per-side byte copied to all four, Curvature, Pitch and, in version 9, BaseElevation; the game derives the corners and computes the base elevation of older roofs while loading.

The game replaces each key whose catalog resource is missing or invalid with the default of its type while loading.

Constructors

Roof()

Initializes a new instance of the Roof class

public Roof()

Properties

BaseElevation

Gets/sets the elevation of the roof's base

public float BaseElevation { get; set; }

Property Value

float

Remarks

Present in version 9 and from version 10 on. When it is outside the valid range, the game recomputes it while loading as the elevation of the roof's level plus the lot's LevelElevationOffset (levels 0 and up) or NegativeLevelElevationOffset (levels below 0). Raising the walls below a roof from 3 m to 5 m changed it from 3 to 5 (in-game test).

BoundsMaximum

Gets/sets the maximum corner of the bounding box of the roof's footprint

public RoofPoint BoundsMaximum { get; set; }

Property Value

RoofPoint

Remarks

It is at or above BoundsMinimum on both axes in every lot examined.

BoundsMinimum

Gets/sets the minimum corner of the bounding box of the roof's footprint

public RoofPoint BoundsMinimum { get; set; }

Property Value

RoofPoint

Corner1

Gets/sets the first corner of the roof's footprint

public RoofPoint Corner1 { get; set; }

Property Value

RoofPoint

Remarks

Present from version 10 on. The game derives the four corners from the bounding box; with bit 0 of Flags set, they are inset by half the extent, giving a footprint turned 45°.

Corner2

Gets/sets the second corner of the roof's footprint

public RoofPoint Corner2 { get; set; }

Property Value

RoofPoint

Remarks

Present from version 10 on.

Corner3

Gets/sets the third corner of the roof's footprint

public RoofPoint Corner3 { get; set; }

Property Value

RoofPoint

Remarks

Present from version 10 on.

Corner4

Gets/sets the fourth corner of the roof's footprint

public RoofPoint Corner4 { get; set; }

Property Value

RoofPoint

Remarks

Present from version 10 on.

Curvature

Gets/sets the curvature of the roof

public float Curvature { get; set; }

Property Value

float

Remarks

In-game tests show that curving a roof changes only this value (from 0 to 0.5604 in one test). It is signed, −1 through 1, and defaults to 0.

Direction

Gets/sets the direction of the roof, a value of the game's eight-way direction enumeration

public byte Direction { get; set; }

Property Value

byte

Remarks

The game rotates it in steps of the eight-way enumeration (modulo 8); it is 0, 2, 4 or 6 in every lot examined. Turning a gable roof 90° in game changed it from 0 to 6, two steps of the enumeration (in-game test). That it is the direction of the roof's ridge is a hypothesis.

FirstTrimKey

Gets/sets the key of the first trim, a CTProductRoofTrim (0xB0311D0F) or the null key

public ResourceKey FirstTrimKey { get; set; }

Property Value

ResourceKey

Remarks

Changing the roof trim in game left it the null key and changed only SecondTrimKey (in-game test).

Flags

Gets/sets the flags of the roof

public uint Flags { get; set; }

Property Value

uint

Remarks

Present from version 10 on. Bit 0 insets the footprint's corners into a diamond turned 45°; the other bits are unknown. Placing the catalog's diagonal gable roof set bit 0 and inset the corners, as the game's code describes (in-game test). It is 0, 1 or 2 in every lot examined.

Id

Gets/sets the id of the roof

public uint Id { get; set; }

Property Value

uint

InnerVersion

Gets/sets the version of the roof's own layout

public uint InnerVersion { get; set; }

Property Value

uint

Remarks

Present from version 10 of the section on; for older sections it keeps its default, 3, and encoding throws if it is changed. The game writes 3 and its reader reads any value, laying out the roof as for 3 when the value is 3 or more; this library supports 0 through 3. In the lots examined the roofs of version 11 sections hold 2 and those of version 13 sections 3; no version 10 or 12 section examined holds roofs. Inner version 3 holds Unknown1 through Unknown4, which encoding a lower inner version requires to keep their defaults; before inner version 2, a single per-side byte is stored and copied to Unknown5 through Unknown8.

Exceptions

ArgumentOutOfRangeException

The inner version is not 0 through 3

PatternKey

Gets/sets the key of the pattern, a CTProductRoofPattern (0xF1EDBD86)

public ResourceKey PatternKey { get; set; }

Property Value

ResourceKey

Remarks

Present from version 6 on. Changing the shingles in game changed only this key (in-game test).

Pitch

Gets/sets the pitch of the roof

public float Pitch { get; set; }

Property Value

float

Remarks

The game compares it with the MaxRoofPitch build-buy tuning (reporting MaxRoofSlopeExceeded); one pitch step in the game adds 0.05. It defaults to 0.5 and is 0.05 through 1.75 in the lots examined.

RoofKey

Gets/sets the key of the roof, a CTProductRoof (0x91EDBD3E), which decides its shape

public ResourceKey RoofKey { get; set; }

Property Value

ResourceKey

Remarks

In-game tests show that the shape is this product alone: replacing one shape with another changed only this key and the per-side bytes Unknown5 through Unknown8. The instances seen are 0x144D (gable), 0x1B03 (half gable), 0x144F (hip), 0x29DC (half hip), 0x282AD (octagonal), 0x282B8 (cone) and 0x7DD4 (the catalog's diagonal gable).

SecondTrimKey

Gets/sets the key of the second trim, a CTProductRoofTrim (0xB0311D0F)

public ResourceKey SecondTrimKey { get; set; }

Property Value

ResourceKey

Remarks

Changing the roof trim in game changed only this key (in-game test).

Unknown1

Gets/sets the first unknown float

public float Unknown1 { get; set; }

Property Value

float

Remarks

Present from inner version 3 on; the game's default is 0.66. The four unknown floats look like the parameters of a curve profile (hypothesis). All four kept their defaults (0.66, 0.33, −1 and 1) through every in-game test.

Unknown2

Gets/sets the second unknown float

public float Unknown2 { get; set; }

Property Value

float

Remarks

Present from inner version 3 on; the game's default is 0.33.

Unknown3

Gets/sets the third unknown float

public float Unknown3 { get; set; }

Property Value

float

Remarks

Present from inner version 3 on; the game's default is −1.

Unknown4

Gets/sets the fourth unknown float

public float Unknown4 { get; set; }

Property Value

float

Remarks

Present from inner version 3 on; the game's default is 1.

Unknown5

Gets/sets the first per-side byte

public byte Unknown5 { get; set; }

Property Value

byte

Remarks

The four per-side bytes are 0 through 12 in the lots examined, and 0 through 3 in roofs of sections before version 13. In in-game tests they were 1, 1, 1, 1 for the gable, half gable and diagonal gable roofs and 0, 0, 0, 0 for the hip, half hip, octagonal and cone roofs, and replacing one shape with another changed only these bytes and RoofKey; that they choose gable or eave per side is a hypothesis, and their meaning is not proven. Before version 10 and before inner version 2, a single byte is stored, so the four must be equal to be written.

Unknown6

Gets/sets the second per-side byte

public byte Unknown6 { get; set; }

Property Value

byte

Unknown7

Gets/sets the third per-side byte

public byte Unknown7 { get; set; }

Property Value

byte

Unknown8

Gets/sets the fourth per-side byte

public byte Unknown8 { get; set; }

Property Value

byte

WallKey

Gets/sets the wall key, a CTProductWallPattern (0xD5F0F921) or the null key

public ResourceKey WallKey { get; set; }

Property Value

ResourceKey

Remarks

Present from version 11 on.