Skip to content

company_metadata

Source: base/tealdef/game_mechanics/company/company_metadata.d.tl

Notes

Company metadata of constructions (metadata.company), which ties perks, landmarks and the headquarters to company ranks and permits.

Globals

Types

Name Definition Description
ConstructionDescReactUtil declared here, defined in ConstructionDescReactUtil Helper module for the info panel of construction menu entries. Load it with ug_require "::/gui/construction/construction_desc_react_util.tl".

CompanyMetadata

record global base/tealdef/game_mechanics/company/company_metadata.d.tl:5

global record CompanyMetadata

Load: local company_metadata = ug_require "/game_mechanics/company/company_metadata.tl"

Notes

Accessors for the company metadata of construction resources, construction instances and savegames.

Example

-- base game: landmarks/statue_of_liberty/statue_of_liberty/statue_of_liberty.con.lua
constr.metadata = {
    company = {
        perkCategory = "LANDMARK",
        rankAndPermits = {{11, 1}},
    },
}

Fields

Name Type Description
constructionDesc MetadataAccessor<ConstructionDescMetadata, CompanyMetadata.ConstructionDesc> Accessor for ConstructionDesc. used 29× in the base game
constructionInstance MetadataAccessor<ConstructionInstanceMetadata, CompanyMetadata.ConstructionInstance> Accessor for ConstructionInstance. used 3× in the base game
savegameScript MetadataAccessor<SavegameScriptMetadata, CompanyMetadata.Savegame> Accessor for Savegame. used 2× in the base game

Functions

getKey() : string base/tealdef/game_mechanics/company/company_metadata.d.tl:42

Call as company_metadata.getKey

Notes

Returns the metadata key.

Returns string: "company".

Used in the base game: 4 times in 2 files

base/content/game_mechanics/game_mechanics/company/company_react_util.tl:204

api.engine.system.streetConnectorSystem.forEachConstructionWithMetadata(company_metadata.getKey(), false, true, checkFn)
base/content/game_mechanics/game_mechanics/company/company_util.tl:164
api.engine.system.streetConnectorSystem.forEachConstructionWithMetadata(company_metadata.getKey(), true, true, checkFn)

CompanyMetadata.ConstructionDesc

record base/tealdef/game_mechanics/company/company_metadata.d.tl:6

record ConstructionDesc

Notes

The metadata.company table of a construction resource.

Used in the base game: 10 times in 7 files

base/content/gui/gui/construction/construction_react_util.tl:1600

local companyMeta : CompanyMetadata.ConstructionDesc = {
base/content/gui/gui/entity_window/entity_window_hud.tl:196
local companyMeta : CompanyMetadata.ConstructionDesc
base/content/gui/gui/entity_window/perk/perk.tl:55
local companyMeta : CompanyMetadata.ConstructionDesc = nil
base/content/game_mechanics/game_mechanics/company/company.script.tl:522
companyMeta : CompanyMetadata.ConstructionDesc
base/content/game_mechanics/game_mechanics/company/company_static_util.tl:94
function company_static_util.getMinRankConsideringPermits(companyMeta : CompanyMetadata.ConstructionDesc) : integer
base/content/game_mechanics/game_mechanics/company/company_util.tl:172
local function checkRanks(company : CompanyMetadata.ConstructionDesc) : string
… and 1 more files.

Fields

Name Type Description
companyRank integer Rank at which the construction unlocks; takes precedence over rankAndPermits.
headquarters boolean Marks the company headquarters.
maxCompanyRank integer Rank above which the construction is obsolete.
permitKey ResName Shared permit key (a company_permit_key resource); without it the construction file is the key.
rankAndPermits {{integer, integer}} {{rank, times}}
perkCategory PerkCategory Kind of perk.
cargoTypes {ResName} Cargo types of the perk.
numbers ConstructionDescReactUtil.Numbers Figures shown in the construction description.
customLandmarkTab CustomLandmarkTab Custom landmark tab.

CompanyMetadata.ConstructionDesc.PerkCategory

enum base/tealdef/game_mechanics/company/company_metadata.d.tl:7

enum PerkCategory

Notes

Kind of company perk.

Used in the base game: 7 times in 2 files

base/content/game_mechanics/game_mechanics/company/company.tl:47

local currentCat : CompanyMetadata.ConstructionDesc.PerkCategory = nil
base/content/game_mechanics/game_mechanics/company/company_react_util.tl:125
local cmpCats = function(valA : CompanyMetadata.ConstructionDesc.PerkCategory, valB : CompanyMetadata.ConstructionDesc.PerkCategory) : boolean

Value Description
"HQ" Headquarters.
"LANDMARK" Landmark.
"MECHANICS" Game-mechanics perk (e.g. pollution cleanup facility, marketing campaign, industry greenify).
"PROSPECTION" Prospection.

CompanyMetadata.ConstructionDesc.CustomLandmarkTab

record base/tealdef/game_mechanics/company/company_metadata.d.tl:23

record CustomLandmarkTab

Notes

Custom tab in which a landmark is listed.

Fields

Name Type Description
name string Tab name.
description string Tab description.
sortKey integer Sort order of the tab.

CompanyMetadata.ConstructionInstance

record base/tealdef/game_mechanics/company/company_metadata.d.tl:31

record ConstructionInstance

Notes

Company metadata stored on a built construction.

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/company/company_metadata.tl:9

constructionInstance = metadata_util.constructionInstance.register(getKey()) as MetadataAccessor<ConstructionInstanceMetadata, CompanyMetadata.ConstructionInsta

Fields

Name Type Description
permitKey ResName Permit key the construction was built with.

CompanyMetadata.Savegame

record base/tealdef/game_mechanics/company/company_metadata.d.tl:35

record Savegame

Notes

Company metadata stored in the savegame metadata.

Used in the base game: 2 times in 2 files

base/content/game_mechanics/game_mechanics/company/company_growth.script.tl:64

local function getCompanySavegameMetadata(scriptState : CompaniesGrowthState) : CompanyMetadata.Savegame
base/content/game_mechanics/game_mechanics/company/company_metadata.tl:10
savegameScript = metadata_util.savegameScript.register(getKey()) as MetadataAccessor<SavegameScriptMetadata, CompanyMetadata.Savegame>,

Fields

Name Type Description
level integer Company rank of the player.