Skip to content

town_growth_metadata

Source: base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl

Notes

Construction metadata (town_growth) for town bonuses of landmarks, and the town level-up notification records.

TownGrowthMetadata

record global base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:3

global record TownGrowthMetadata

Load: local town_growth_metadata = ug_require "::/game_mechanics/towns/town_growth_metadata.tl"

Notes

Accessors for the town_growth construction metadata, which gives the closest town a bonus while the construction stands.

Example

-- base/content/landmarks/hq/hq/headquarter.con.lua
metadata = {
    town_growth = {
        xpIncrease = 0.05,
    },
},

Fields

Name Type Description
constructionDesc MetadataAccessor<ConstructionDescMetadata, TownGrowthMetadata.ConstructionDesc> Accessor for TownGrowthMetadata.ConstructionDesc in construction definition metadata. used 2× in the base game
constructionInstance MetadataAccessor<ConstructionInstanceMetadata, TownGrowthMetadata.ConstructionInstance> Accessor for TownGrowthMetadata.ConstructionInstance in a construction's persistent metadata. used 3× in the base game

Functions

getKey() : string base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:17

Call as town_growth_metadata.getKey

Notes

Metadata key of town bonuses.

Returns string: "town_growth"

Used in the base game: 2 times in 2 files

base/content/landmarks/landmark_util.tl:97

town_growth_metadata.getKey(), false, true,
base/content/game_mechanics/game_mechanics/towns/towns.script.tl:197
town_growth_metadata.getKey(), false, true, function(constructionEntity : Engine.Entity, construction : Engine.Component.Construction, __ : ConstructionId)

TownGrowthMetadata.ConstructionDesc

record base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:4

record ConstructionDesc

Notes

Town bonuses in a construction definition's metadata. The construction menu shows them.

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/towns/town_growth_metadata.tl:8

constructionDesc = metadata_util.constructionDesc.register(getKey()) as MetadataAccessor<ConstructionDescMetadata, TownGrowthMetadata.ConstructionDesc>,

Fields

Name Type Description
xpIncrease number Added to the town's experience multiplier; 0.05 means 5 % more experience.
trafficRatingIncrease number Added to the town's traffic rating (0 to 1) before clamping.
reputationRecoveryBoost number Passed as bonus to TownUtil.applyEventDecay.

TownGrowthMetadata.ConstructionInstance

record base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:9

record ConstructionInstance

Notes

Town bonuses in the persistent metadata of a built construction. landmark_util.collectTownGrowthMetadata sums them per closest town.

Used in the base game: 1 time in 1 file

base/content/game_mechanics/game_mechanics/towns/town_growth_metadata.tl:9

constructionInstance = metadata_util.constructionInstance.register(getKey()) as MetadataAccessor<ConstructionInstanceMetadata, TownGrowthMetadata.ConstructionIn

Fields

Name Type Description
xpIncrease number Added to the town's experience multiplier.
trafficRatingIncrease number Added to the town's traffic rating before clamping.
reputationRecoveryBoost number Passed as bonus to TownUtil.applyEventDecay.

TownLevelNotificationInput

record global base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:20

global record TownLevelNotificationInput

Notes

Params of the town level-up notification (town_notification.script).

Fields

Name Type Description
townEntity EntityUtil.EntityAndRevision Town that reached the new level.
level integer New town level; TownUtil.level2name gives its name.

TownLevelNotificationSimInput

record global base/tealdef/game_mechanics/towns/town_growth_metadata.d.tl:25

global record TownLevelNotificationSimInput

Notes

Data the notification's sim update script fills in.

Fields

Name Type Description
townName string Current name of the town.