Skip to content

journal

Source: base/tealdef/scripts/journal.d.tl

Notes

Type of the engine's finance journal entry (api.type.JournalEntry): one booking of money with its time, amount and category. Scripts create one with api.type.JournalEntry.new() and book it with api.cmd.makeJournalBookAssetCmd.

Example

-- from base/content/game_mechanics/game_mechanics/subventions/subvention_util.tl
local entry = api.type.JournalEntry.new()
entry.amount = positive and data.amount or -data.amount
entry.time = -1
entry.category.type = api.type.JournalEntry.Type.SUBSIDY
api.cmd.sendCommand(api.cmd.makeJournalBookAssetCmd(api.engine.util.getPlayer(), entry, api.type.Vec3f.new(0, 0, 0)))

JournalEntry

record global base/tealdef/scripts/journal.d.tl:3

global record JournalEntry

Notes

One finance journal booking (api.type.JournalEntry). Create it with api.type.JournalEntry.new(), set amount, time and category, and book it with api.cmd.makeJournalBookAssetCmd.

Fields

Name Type Description
time number Booking time; the base game sets -1 when booking a subsidy.
amount number Booked amount in game currency; positive for income, negative for costs.
category Category Classification of the entry.

Functions

new() : JournalEntry base/tealdef/scripts/journal.d.tl:4

Notes

Creates a new, empty JournalEntry.

Returns JournalEntry

JournalEntry.Type

record base/tealdef/scripts/journal.d.tl:6

record Type

Notes

Principal categories of a journal entry (api.type.JournalEntry.Type).

Used in the base game: 2 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:64

function finances_util.getKeyLabel(key : {JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : string

Fields

Name Type Description
LOAN Type Loan taken or repaid.
INTEREST Type Loan interest.
CONSTRUCTION Type Construction costs (subcategory in category.construction).
ACQUISITION Type Vehicle purchases (shown as "Vehicles" in the finance window).
MAINTENANCE Type Maintenance costs (subcategory in category.maintenance).
INCOME Type Revenue.
OTHER Type Other bookings (subcategory in category.other).
SUBSIDY Type Subsidy (subvention) payments.

JournalEntry.Construction

record base/tealdef/scripts/journal.d.tl:17

record Construction

Notes

Construction subcategories (api.type.JournalEntry.Construction).

Used in the base game: 4 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:31

local getMaintenanceInfraKeyLabel = function(construction : JournalEntry.Construction) : string

Fields

Name Type Description
STREET Construction Streets.
TRACK Construction Tracks.
SIGNAL Construction Signals.
STATION Construction Stations.
DEPOT Construction Depots.
BULLDOZER Construction Bulldozing.
WAREHOUSE Construction Warehouses.
OTHER Construction Other constructions.

JournalEntry.Maintenance

record base/tealdef/scripts/journal.d.tl:29

record Maintenance

Journal entry Maintenance Category

Used in the base game: 2 times in 1 file

base/content/game_mechanics/game_mechanics/finance/finances_util.tl:64

function finances_util.getKeyLabel(key : {JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : string

Fields

Name Type Description
VEHICLE Maintenance Vehicle running costs ("Running Costs Vehicles").
INFRASTRUCTURE Maintenance Infrastructure maintenance.
OTHER Maintenance Other maintenance.
VEHICLE_MAINTENANCE Maintenance Vehicle maintenance ("Maintenance Vehicles").

JournalEntry.Other

record base/tealdef/scripts/journal.d.tl:37

record Other

Journal entry Other Category

Used in the base game: 2 times in 2 files

base/content/game_mechanics/game_mechanics/finance/finances_table.tl:427

tableState:old():foreach_other(function(key : JournalEntry.Other, values : {integer})
base/content/game_mechanics/game_mechanics/finance/finances_util.tl:23
function finances_util.getOtherLabel(other : JournalEntry.Other) : string

Fields

Name Type Description
OTHER Other Other bookings.

JournalEntry.Carrier

record base/tealdef/scripts/journal.d.tl:41

record Carrier

Notes

Carrier subcategories (api.type.JournalEntry.Carrier); the finance window shows one column per carrier.

Used in the base game: 5 times in 2 files

base/content/game_mechanics/game_mechanics/finance/finances_table.tl:263

carrierStates : {{JournalEntry.Carrier, ReactStateT<integer>}},
base/content/game_mechanics/game_mechanics/finance/finances_util.tl:5
function finances_util.getCarrierLabel(carrier : JournalEntry.Carrier) : string

Fields

Name Type Description
ROAD Carrier Road vehicles.
RAIL Carrier Trains.
TRAM Carrier Trams.
OTHER Carrier Not carrier-specific (shown as "General").
AIR Carrier Aircraft.
WATER Carrier Ships.

JournalEntry.Category

record base/tealdef/scripts/journal.d.tl:51

record Category

Details about the classification of the journal entry

Fields

Name Type Description
type Type The principal category
construction Construction The construction subcategory, only if type == Construction
maintenance Maintenance The maintenance subcategory, only if type == Maintenance
other Other The other subcategory, only if type == Other
carrier Carrier The carrier subcategory, only if type == Carrier

Functions

new() : Category base/tealdef/scripts/journal.d.tl:52

Notes

Creates a new, empty Category.

Returns Category