Skip to content

construction_config_metadata

Source: base/tealdef/scripts/construction/construction_config_metadata.d.tl

Notes

Types of /scripts/construction/construction_config_metadata.tl: the constructionConfig metadata of constructions that are built up in levels by delivering cargo (the landmarks), with their requirements, stocks and the effects they grant when finished.

Example

-- from base/content/landmarks/neuschwanstein/neuschwanstein/neuschwanstein.con.lua (shortened)
local constructionConfig = {
    numLevels = 4,
    level = 1,
    underConstructionMessage = _("Supply the construction site with resources."),
    requirements = { { cargoType = "::/cargos/stone/stone.cargo", amount = 1000 } },
    stocks = { { type = "INPUT_STOCK", cargoType = "::/cargos/stone/stone.cargo", capacity = 500 } },
    effects = { { carrier = "ROAD", type = "comfort", value = 1.25 } },
}
local meta = { constructionConfig = constructionConfig }

ConstructionConfigMetadata

record global base/tealdef/scripts/construction/construction_config_metadata.d.tl:3

global record ConstructionConfigMetadata

Load: local construction_config_metadata = ug_require "::/scripts/construction/construction_config_metadata.tl"

Notes

Metadata accessors for the constructionConfig key (see getKey).

Fields

Name Type Description
constructionDesc MetadataAccessor<ConstructionDescMetadata, ConstructionConfigMetadata.ConstructionConfig> Accessor for the configuration in a construction description's metadata. used 4× in the base game
constructionInstance MetadataAccessor<ConstructionInstanceMetadata, ConstructionConfigMetadata.ConstructionConfig> Accessor for the configuration in a built construction's persistent metadata. used 9× in the base game

Functions

getKey() : string base/tealdef/scripts/construction/construction_config_metadata.d.tl:32

Call as construction_config_metadata.getKey

Notes

Returns the metadata key, "constructionConfig".

Returns string

Example

-- from base/content/landmarks/landmarks.script.tl
api.engine.system.streetConnectorSystem.forEachConstructionWithMetadata(construction_config_metadata.getKey(), false, true,
    function(entity : Engine.Entity, con : Engine.Component.Construction, __ : ConstructionId)
        local constructionData = construction_config_metadata.constructionInstance.get(con.persistentMetadata)
    end)
Used in the base game: 3 times in 3 files

base/content/landmarks/landmarks.script.tl:20

api.engine.system.streetConnectorSystem.forEachConstructionWithMetadata(construction_config_metadata.getKey(), false, true,
base/content/landmarks/landmark_util.tl:104
construction_config_metadata.getKey(), false, true,
base/content/game_mechanics/game_mechanics/notifications/notifications.script.tl:510
api.engine.system.streetConnectorSystem.forEachConstructionWithMetadata(construction_config_metadata.getKey(), false, true,

ConstructionConfigMetadata.ConstructionConfig

record base/tealdef/scripts/construction/construction_config_metadata.d.tl:5

record ConstructionConfig

Notes

Level-up configuration of a construction that is completed by delivering cargo (landmarks). It is stored in the construction description's metadata and copied to the built instance.

Used in the base game: 2 times in 1 file

base/content/scripts/scripts/construction/construction_config_metadata.tl:8

constructionDesc = metadata_util.constructionDesc.register(getKey()) as MetadataAccessor<ConstructionDescMetadata, ConstructionConfigMetadata.ConstructionConfig

Fields

Name Type Description
level integer Current construction level, starting at 1.
numLevels integer Number of levels; the construction is finished when level reaches numLevels.
underConstructionMessage string Short message shown in the notification while the construction is not finished.
underConstructionDescription string Longer description of the construction site shown to the player.
effects {Effect} Bonuses granted when finished.
requirements {Requirement} Cargo deliveries needed; the level rises with the delivered share of the total.
stocks {Stock} Stocks of the construction site.
constructionFinishedSound ResName Sound played with the notification when the construction is finished.

ConstructionConfigMetadata.ConstructionConfig.Requirement

record base/tealdef/scripts/construction/construction_config_metadata.d.tl:10

record Requirement

Notes

Cargo that must be delivered to finish the construction.

Fields

Name Type Description
cargoType string Cargo type resource, e.g. "::/cargos/stone/stone.cargo".
amount integer Amount needed; scaled by the game's landmarkResources advanced option.

ConstructionConfigMetadata.ConstructionConfig.Stock

record base/tealdef/scripts/construction/construction_config_metadata.d.tl:14

record Stock

Notes

A stock of the construction site.

Fields

Name Type Description
type string Stock type, e.g. "INPUT_STOCK".
cargoType ResName Cargo type resource stored in the stock.
capacity integer Stock capacity.

ConstructionConfigMetadata.ConstructionConfig.Effect

record base/tealdef/scripts/construction/construction_config_metadata.d.tl:19

record Effect

Notes

Bonus the finished construction grants to its closest town.

Fields

Name Type Description
carrier string Carrier the bonus applies to, e.g. "ROAD".
type string Kind of bonus, e.g. "comfort".
value number Bonus value; values of several landmarks for the same town, carrier and type are added up.