Skip to content

company

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

Notes

State of the company game script (::/game_mechanics/company/company.gs) and the params of its notifications.

CompanyState

record global base/tealdef/game_mechanics/company/company.d.tl:3

global record CompanyState

Notes

Saved state of one company (player) in the company game script.

Fields

Name Type Description
companyEntity EntityUtil.EntityAndRevision Player entity of the company.
consumedPermits {ResName : {integer}} for each permit, list of timestamps when it was consumed
pendingProspections {SpawnIndustry} Running prospections.

CompanyState.SpawnIndustry

record base/tealdef/game_mechanics/company/company.d.tl:4

record SpawnIndustry

Notes

A running prospection, which tries to spawn an industry near a town.

Used in the base game: 2 times in 1 file

base/content/game_mechanics/game_mechanics/company/company.script.tl:96

local function executePendingProspection(companyState : CompanyState, companyEntity : Engine.Entity, pending : CompanyState.SpawnIndustry, fraction : number, fi

Fields

Name Type Description
townEntity EntityUtil.EntityAndRevision Town the prospection targets.
types {string} Industry types that may be spawned; the order is shuffled per attempt.
permitKey ResName Permit used; it is returned if the prospection fails.
cargoType ResName Cargo type of the prospection.
initiatedTimestamp integer Game time (ms) at which the prospection started.
attempts integer Spawn attempts made so far (one per game month).

CompaniesState

record global base/tealdef/game_mechanics/company/company.d.tl:18

global record CompaniesState

Notes

State of the company game script.

Fields

Name Type Description
companyStates {CompanyState} State per company.
basePopulation integer World population when the game was started; the experience needed per rank depends on it. It does not change during play.
version integer Layout version of this state (see CompanyLegacyUtil).

CompanyRankUpNotificationParams

record global base/tealdef/game_mechanics/company/company.d.tl:24

global record CompanyRankUpNotificationParams

Notes

Params of the rank-up notification (company_notification_rank_up.script).

Fields

Name Type Description
companyEntity Engine.Entity Company that reached the rank.
rank integer New rank.

CompanyProspectionNotificationParams

record global base/tealdef/game_mechanics/company/company.d.tl:30

global record CompanyProspectionNotificationParams

Notes

Params of the prospection notification (company_notification_prospection.script).

Fields

Name Type Description
companyEntity Engine.Entity Company.
townEntity EntityUtil.EntityAndRevision Target town.
cargoType ResName Cargo type of the prospection.
start boolean The notification reports the start of the prospection.
resultEntity EntityUtil.EntityAndRevision nil if failed
initiatedTimestamp integer Game time (ms) at which the prospection started.

CompanyProspectionNotificationSimParams

record global base/tealdef/game_mechanics/company/company.d.tl:41

global record CompanyProspectionNotificationSimParams

Notes

Data the notification resolves on the simulation side.

Fields

Name Type Description
townEntityName string Name of the town.

CompanyMarketingNotificationParams

record global base/tealdef/game_mechanics/company/company.d.tl:45

global record CompanyMarketingNotificationParams

Notes

Params of the marketing-campaign notification (company_notification_marketing.script).

Fields

Name Type Description
companyEntity Engine.Entity Company.
townEntity EntityUtil.EntityAndRevision Town of the campaign.
initiatedTimestamp integer Game time (ms) at which the campaign started.
totalDurationMs integer Length of the campaign in game time (ms).
start boolean The notification reports the start of the campaign.

CompanyMarketingNotificationSimParams

record global base/tealdef/game_mechanics/company/company.d.tl:55

global record CompanyMarketingNotificationSimParams

Notes

Data the notification resolves on the simulation side.

Fields

Name Type Description
townEntityName string Name of the town.

CompanyGreenifyNotificationParams

record global base/tealdef/game_mechanics/company/company.d.tl:59

global record CompanyGreenifyNotificationParams

Notes

Params of the industry-greenify notification (company_notification_greenify.script).

Fields

Name Type Description
companyEntity Engine.Entity Company.
constructionEntity EntityUtil.EntityAndRevision Industry construction that was changed.
ecoLevel integer New eco level of the industry.

CompanyGreenifyNotificationSimParams

record global base/tealdef/game_mechanics/company/company.d.tl:65

global record CompanyGreenifyNotificationSimParams

Notes

Data the notification resolves on the simulation side.

Fields

Name Type Description
constructionEntityName string Name of the construction.

CompanyLegacyUtil

record global base/tealdef/game_mechanics/company/company.d.tl:69

global record CompanyLegacyUtil

Notes

Upgrades a company state saved by an older game version.

Fields

Name Type Description
currentVersion integer Current layout version of the company state (4 in the base game).

Functions

updateLegacyState(companiesState : CompaniesState) base/tealdef/game_mechanics/company/company.d.tl:71

Notes

Upgrades the state in place to currentVersion.

Parameter Type Description
companiesState CompaniesState State to upgrade.

CompanyToolParam

record global base/tealdef/game_mechanics/company/company.d.tl:74

global record CompanyToolParam is ToolReactUtil.IToolParam

Notes

Params of the company window.

Fields

Name Type Description
initialTabKey TabKey Tab shown when the window opens.
unlockRank integer Rank to show; defaults to the rank the company has reached.
allCompanyDefinitionsCacheRef ReactRefT<{ConstructionDefinition}> Cached list of all construction definitions with company metadata.

CompanyToolParam.TabKey

enum base/tealdef/game_mechanics/company/company.d.tl:75

enum TabKey

Notes

Tab of the company window.

Used in the base game: 1 time in 1 file

base/content/gui/gui/main/game.tl:309

initialTabKey : CompanyToolParam.TabKey

Value Description
"Company" Ranks and perks.
"Achievements" Achievements.

Exploration

record global base/tealdef/game_mechanics/company/company.d.tl:84

global record Exploration

Notes

Definition of a prospection (generic resource of type company_exploration, e.g. explorations/exploration_clay.res.lua).

Example

function data()
return {
    type = "company_exploration",
    data = {
        cargoType = "::/cargos/clay/clay.cargo",
        icon = "game_mechanics/company/explorations/exploration_clay.tga",
        lockedIcon = "game_mechanics/company/explorations/exploration_clay_locked.tga",
        rankAndPermits = { {3, 1} },
        requiredTags = { "OUTPUT_CLAY" },
        menuCategory = { categories = { { category = "prospections", order = 2000 } } },
    }
}
end

Fields

Name Type Description
permitKey ResName Permit key shared with other constructions or prospections.
rankAndPermits {{integer, integer}} {{rank, times}}
requiredTags {string} Industry tags (e.g. OUTPUT_CLAY) that select the industry types to spawn.
cargoType ResName Cargo type the prospection looks for.
icon ResName Icon of the prospection.
lockedIcon ResName Icon shown while the prospection is locked.
previewIcon ResName Preview icon.
menuCategory ModelMetadata.MenuCategory Menu category of the prospection in the construction menu.