Skip to content

headquarter_util_serialized

Source: base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl

Notes

Types of the company headquarter construction (/landmarks/hq/hq/headquarter.script.tl): a modular construction on an 8 m grid whose modules add further slots around themselves.

HeadquarterUtilSerialized

record global base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:3

global record HeadquarterUtilSerialized

Notes

Types of the company headquarter construction.

HeadquarterUtilSerialized.SlotData

record base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:4

record SlotData

Notes

Size and id of one headquarter slot type.

Used in the base game: 1 time in 1 file

base/content/landmarks/hq/hq/headquarter.script.tl:61

local SlotType2Id : {string : HeadquarterUtilSerialized.SlotData} = {

Fields

Name Type Description
id integer Number of the slot type, encoded into slot ids.
height number Slot height for collision.
size Vec2Serialized.Vec2 Slot size in metres.

HeadquarterUtilSerialized.SlotSetup

record base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:10

record SlotSetup

Notes

A slot that a placed module adds (entry of the module's metadata.slots).

Used in the base game: 1 time in 1 file

base/content/landmarks/hq/hq/headquarter.script.tl:226

result.makeSlots = function(slots : {HeadquarterUtilSerialized.SlotSetup}, cellSize : {Vec2Serialized.Vec2}, coord : Vec2Serialized.Vec2, orientation : integer)

Fields

Name Type Description
slotType string Type of the added slot, e.g. "hq_medium_building".
offset Vec2Serialized.Vec2 Position in grid cells relative to the module, rotated with the module.
orientation integer Rotation in quarter turns, added to the module's orientation.
skipOrientation boolean
heightOffset number Height of the slot above the module in metres (roof flags use 15).
perimeter boolean Adds a row of slots around the module's cell area instead of one slot at offset.
cellSize {Vec2Serialized.Vec2} Cell area of the slot type for perimeter slots, {xRange, yRange}.
shift Vec2Serialized.Vec2 Offset in metres within the cell.
variant integer Variant encoded into the slot id.

HeadquarterUtilSerialized.HeadquarterConnector

record base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:22

record HeadquarterConnector

Notes

Extra models a module adds when a neighbouring cell holds a matching slot type.

Used in the base game: 1 time in 1 file

base/content/landmarks/hq/hq/headquarter_addon.script.tl:66

local addConnector = function(connectorGroup : {HeadquarterUtilSerialized.HeadquarterConnector})

Fields

Name Type Description
slotTypes {string} Slot types of the neighbour that trigger the connector; "*any" matches any occupied cell and "*empty" an empty one. The first matching connector of a group wins.
group string Name of the generated data group to add.
offset Vec2iSerialized.Vec2i Neighbour cell relative to the module, rotated with the module.

HeadquarterUtilSerialized.HeadquarterModuleMetadata

record base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:28

record HeadquarterModuleMetadata

Notes

Metadata of a headquarter module.

Used in the base game: 1 time in 1 file

base/content/landmarks/hq/hq/headquarter_addon.script.tl:12

local metadata = params.modules[slotId].metadata as HeadquarterUtilSerialized.HeadquarterModuleMetadata

Fields

Name Type Description
cellSize {Vec2Serialized.Vec2} Cells the module occupies, {{x = minX, y = maxX}, {x = minY, y = maxY}} relative to its own cell.
fenceCellSize {Vec2Serialized.Vec2} Cells enclosed by the module's fence, in the same form; defaults to cellSize grown by one cell.
fenceEntrance boolean Leaves the front side of the fence open.
slots {SlotSetup} Slots the module adds around itself.
size Vec2iSerialized.Vec2i Size of the module's own slot in metres.
connectors {string : {HeadquarterConnector}} Connector groups (e.g. left, right, top, bottom); each group adds at most one connector.
canRotate boolean Rotates the module's models by its variant in quarter turns.

HeadquarterUtilSerialized.HeadquarterConstructionResult

record base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:38

record HeadquarterConstructionResult is ConstructionUtilSerialized.IConstructionResult

Notes

Construction result of the headquarter with the grid helpers its module scripts call.

Used in the base game: 3 times in 3 files

base/content/landmarks/hq/hq/headquarter.script.tl:135

local result : HeadquarterUtilSerialized.HeadquarterConstructionResult = {}
base/content/landmarks/hq/hq/headquarter_addon.script.tl:7
function data.updateFn(captureParams : table, result : HeadquarterUtilSerialized.HeadquarterConstructionResult, _transform : Mat4Serialized.Mat4, tag : string, 
base/content/stations/air/air/heliport/modules.script.tl:7
function data.updateFn(captureParams : table, result : HeadquarterUtilSerialized.HeadquarterConstructionResult, transform : Mat4Serialized.Mat4, tag : string, s

Fields

Name Type Description
slotIds {integer : integer} Index into slots by slot id.
cells {number : {number : integer}} Occupied grid cells, cells[x][y] = slot id, or -1 for fence cells.
runLaterFns {function()} Functions registered with runLater.

Functions

encodeSlotId(coord : Vec2Serialized.Vec2, slotType : string, orientation : integer) : integer base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:43

Notes

Packs grid coordinate, slot type, orientation and variant into one slot id.

Returns integer

decodeSlotId(slotId : integer) : Vec2Serialized.Vec2, string, integer, integer base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:44

Notes

Unpacks a slot id.

Returns Vec2Serialized.Vec2, string, integer, integer: Grid coordinate, slot type, orientation (0-3) and variant.

isOccupied(coord : Vec2Serialized.Vec2) : integer base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:45

Notes

Slot id occupying the grid cell, -1 for fence cells, or nil if the cell is free.

Returns integer

markOccupied(coord : Vec2Serialized.Vec2, slotId : integer) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:46

Notes

Marks a grid cell as occupied by the slot id.

addSlot(coord : Vec2Serialized.Vec2, type : string, sizex : integer, sizey : integer, slotHeight : number, orientation : integer, heightOffset? : Vec3Serialized.Vec3, variant? : integer) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:47

Notes

Adds a slot at a grid cell (8 m grid), unless a slot with the same id exists or the cell is more than 20 cells from the origin.

occupySlot(cellSize : {Vec2Serialized.Vec2}, fenceCellSize : {Vec2Serialized.Vec2}, coord : Vec2Serialized.Vec2, orientation : integer, slotId : integer) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:49

Notes

Marks the cells of a module and its fence as occupied.

makeSlots(cellSize : {SlotSetup}, cellSize : {Vec2Serialized.Vec2}, coord : Vec2Serialized.Vec2, orientation : integer, variant? : integer) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:50

Notes

Adds the slots of a module's metadata.slots around the module.

addAlignmentColliderAndGroundTexture(cellSize : {Vec2Serialized.Vec2}, fenceCellSize : {Vec2Serialized.Vec2}, transf2 : Mat4Serialized.Mat4) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:52

Notes

Adds a flat terrain alignment and a box collider (30 m high) over the module's fence area.

addFence(cellSize : {Vec2Serialized.Vec2}, fenceCellSize : {Vec2Serialized.Vec2}, coord : Vec2Serialized.Vec2, tag : string, transf2 : Mat4Serialized.Mat4, orientation : integer, skipFront : boolean) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:53

Notes

Adds fence and fence post models around the module's fence area.

rotate(coord : Vec2Serialized.Vec2, orientation : integer) : Vec2Serialized.Vec2 base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:55

Notes

Rotates a grid offset by orientation quarter turns counter-clockwise.

Returns Vec2Serialized.Vec2

runLater(function()) base/tealdef/landmarks/hq/headquarter_util_serialized.d.tl:57

Notes

Registers a function that runs after all module scripts, when the construction script calls terminateConstructionHook.

Details

Module scripts use it to add models only once every module has added its slots and occupied its cells.