finances_util¶
Source: base/tealdef/game_mechanics/finance/finances_util.d.tl
Notes
Labels and ordering of journal entries in the finances window.
FinancesUtil¶
record global base/tealdef/game_mechanics/finance/finances_util.d.tl:3
global record FinancesUtil
Load: local finances_util = ug_require "/game_mechanics/finance/finances_util.tl"
Notes
Labels and ordering of journal entries.
Functions
getCarrierLabel(JournalEntry.Carrier) : string base/tealdef/game_mechanics/finance/finances_util.d.tl:4
Call as finances_util.getCarrierLabel
Notes
Returns the label of a journal carrier (Road, Rail, Tram, Air, Water, General).
| Parameter | Type | Description |
|---|---|---|
#1 |
JournalEntry.Carrier |
Carrier. |
Returns string: Label, or an empty string.
getOtherLabel(JournalEntry.Other) : string base/tealdef/game_mechanics/finance/finances_util.d.tl:5
Call as finances_util.getOtherLabel
Notes
Returns the label of the journal category Other.
| Parameter | Type | Description |
|---|---|---|
#1 |
JournalEntry.Other |
Category. |
Returns string: Label, or an empty string.
getKeyLabel({JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : string base/tealdef/game_mechanics/finance/finances_util.d.tl:6
Call as finances_util.getKeyLabel
Notes
Returns the row label of a journal key (Revenue, running costs, upkeep, construction, Vehicles, Subsidies).
| Parameter | Type | Description |
|---|---|---|
#1 |
{JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction} |
{type, maintenance, construction}. |
Returns string: Label, or an empty string.
scaleWithInflation(number) : integer base/tealdef/game_mechanics/finance/finances_util.d.tl:7
Call as finances_util.scaleWithInflation
Notes
Scales an amount by a factor that grows linearly from 1 in 1900 to 4 in 2000 (the current game year) and rounds it up to 10 000.
| Parameter | Type | Description |
|---|---|---|
#1 |
number |
Amount in game currency. |
Returns integer: Scaled amount.
Used in the base game: 9 times in 4 files
base/content/game_mechanics/game_mechanics/subventions/deliver_cargo/deliver_cargo.script.tl:120
local upfrontPayment = finances_util.scaleWithInflation(0.75 * math.random(20, 50) * 100000 * riskFactor * api.res.getBaseConfig().advancedOptions.subventionFin
base/content/game_mechanics/game_mechanics/subventions/deliver_workers/deliver_workers.script.tl:92
local upfrontPayment = finances_util.scaleWithInflation(0.75 * math.random(20, 50) * 100000 * riskFactor * api.res.getBaseConfig().advancedOptions.subventionFin
base/content/game_mechanics/game_mechanics/subventions/deliver_cargo_town/deliver_cargo_town.script.tl:194
local upfrontPayment = finances_util.scaleWithInflation(0.75 * math.random(20, 50) * 100000 * riskFactor * api.res.getBaseConfig().advancedOptions.subventionFin
base/content/game_mechanics/game_mechanics/subventions/deliver_passengers/deliver_passengers.script.tl:105
getKeyGroupOrder({JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction}) : integer base/tealdef/game_mechanics/finance/finances_util.d.tl:8
Call as finances_util.getKeyGroupOrder
Notes
Returns the sort group of a journal key (1 vehicle running costs, 2 vehicle maintenance, 3 infrastructure, 4 income, 5 other).
| Parameter | Type | Description |
|---|---|---|
#1 |
{JournalEntry.Type, JournalEntry.Maintenance, JournalEntry.Construction} |
{type, maintenance, construction}. |
Returns integer: Sort group.