tutorial_story_util¶
Source: base/tealdef/mission/tutorial/tutorial_story_util.d.tl
Notes
Helpers of the base-game tutorial story (capital town, industries, areas, vehicle lists).
TutorialStoryUtil¶
record global base/tealdef/mission/tutorial/tutorial_story_util.d.tl:3
global record TutorialStoryUtil
Load: local tutorial_story_util = ug_require "::/mission/tutorial/tutorial_story_util.tl"
Notes
Helpers of the base-game tutorial story.
Fields
| Name | Type | Description |
|---|---|---|
TownDistrictRadius |
number |
Radius in metres around a district centre used to find its streets (100). used 31× in the base game |
Functions
getCapital() : Engine.Entity base/tealdef/mission/tutorial/tutorial_story_util.d.tl:5
Call as tutorial_story_util.getCapital
Notes
Returns the tutorial's capital, read from the store_capital task.
Returns Engine.Entity: Town entity, or -1.
Used in the base game: 72 times in 4 files
base/content/mission/mission/tutorial/tutorial_story.tl:279
return tutorial_story_util.getClosestIndustryToTown("::/industries/fishing_grounds/fishing_grounds.con", tutorial_story_util.getCapital())
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:173
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:156
tutorial_story_util.toPosRadius(api.engine.util.town.getTownDistrictCenter(tutorial_story_util.getCapital(), api.type["enum"].LandUseType.COMMERCIAL), tutorial_
base/content/mission/mission/tutorial/tasks/tutorial_init.tl:138
getCapitalName() : string base/tealdef/mission/tutorial/tutorial_story_util.d.tl:6
Call as tutorial_story_util.getCapitalName
Notes
Returns the name of the capital.
Returns string: Name, or "ERROR".
Used in the base game: 35 times in 3 files
base/content/mission/mission/tutorial/tutorial_story.tl:495
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:168
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:168
getSecondTown() : Engine.Entity base/tealdef/mission/tutorial/tutorial_story_util.d.tl:7
Call as tutorial_story_util.getSecondTown
Notes
Returns the tutorial's second town, read from the store_town2 task.
Returns Engine.Entity: Town entity, or -1.
getSecondTownName() : string base/tealdef/mission/tutorial/tutorial_story_util.d.tl:8
Call as tutorial_story_util.getSecondTownName
Notes
Returns the name of the second town.
Returns string: Name, or "ERROR".
toPosRadius(pos : Vec3f, radius : number) : MissionInterface.PosRadius base/tealdef/mission/tutorial/tutorial_story_util.d.tl:9
Call as tutorial_story_util.toPosRadius
Notes
Builds an area from a position and a radius.
| Parameter | Type | Description |
|---|---|---|
pos |
Vec3f |
Centre. |
radius |
number |
Radius in metres. |
Returns MissionInterface.PosRadius: Area.
Used in the base game: 37 times in 3 files
base/content/mission/mission/tutorial/tutorial_story.tl:625
circle = tutorial_story_util.toPosRadius(api.engine.util.town.getTownDistrictCenter(tutorial_story_util.getCapital(), api.type["enum"].LandUseType.RESIDENTIAL),
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:222
tutorial_story_util.toPosRadius(api.engine.util.town.getTownDistrictCenter(tutorial_story_util.getCapital(), api.type["enum"].LandUseType.INDUSTRIAL), tutorial_
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:156
getBaseEdgesInDistrictType(landUseType : LandUseType) : {Engine.Entity} base/tealdef/mission/tutorial/tutorial_story_util.d.tl:10
Call as tutorial_story_util.getBaseEdgesInDistrictType
Notes
Returns the street edges within TownDistrictRadius of the capital's district centre of a land-use type.
| Parameter | Type | Description |
|---|---|---|
landUseType |
LandUseType |
District type. |
Returns {Engine.Entity}: Edge entities.
makeStopConfig(edges : {Engine.Entity}) : BuildConstructionUtil.ProposalHandlerConfig base/tealdef/mission/tutorial/tutorial_story_util.d.tl:11
Call as tutorial_story_util.makeStopConfig
Notes
Builds a proposal check that accepts only street stops placed on the given edges.
| Parameter | Type | Description |
|---|---|---|
edges |
{Engine.Entity} |
Allowed edges. |
Returns BuildConstructionUtil.ProposalHandlerConfig: Proposal handler config.
getDepotPosition() : {number, number, number} base/tealdef/mission/tutorial/tutorial_story_util.d.tl:12
Call as tutorial_story_util.getDepotPosition
Notes
Returns the depot position stored by the store_depot_position task.
Returns {number, number, number}: Position {x, y, z}, or nil.
Used in the base game: 8 times in 3 files
base/content/mission/mission/tutorial/tutorial_story.tl:868
links = { entity_depot = { getLocation = function() : MissionInterface.PosRadius return { pos = tutorial_story_util.getDepotPosition(), radius = DepotRadius } e
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:377
entity_depot = { getLocation = function() : MissionInterface.PosRadius return { pos = tutorial_story_util.getDepotPosition(), radius = IndustryRadius } end }
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:289
getAllBusTypes() : {string : integer} base/tealdef/mission/tutorial/tutorial_story_util.d.tl:13
Call as tutorial_story_util.getAllBusTypes
Notes
Returns every land vehicle model that carries passengers, each with limit 10.
Returns {string : integer}: Model name -> 10.
getAllTrucksWithClasses(allowedClasses : {string}) : {string : integer} base/tealdef/mission/tutorial/tutorial_story_util.d.tl:14
Call as tutorial_story_util.getAllTrucksWithClasses
Notes
Returns every land vehicle model that carries one of the given cargo classes, each with limit 10.
| Parameter | Type | Description |
|---|---|---|
allowedClasses |
{string} |
Cargo classes. |
Returns {string : integer}: Model name -> 10.
makeDisabledListExcept(exceptions? : {string}) : {string} base/tealdef/mission/tutorial/tutorial_story_util.d.tl:15
Call as tutorial_story_util.makeDisabledListExcept
Notes
Returns the list of construction and management menu ids the tutorial disables, minus the exceptions.
| Parameter | Type | Description |
|---|---|---|
exceptions? |
{string} |
Menu ids to keep enabled. |
Returns {string}: Menu ids.
Used in the base game: 35 times in 3 files
base/content/mission/mission/tutorial/tutorial_story.tl:332
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:179
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:178
getClosestIndustryToTown(conName : ResName, townEntity : Engine.Entity) : Engine.Entity base/tealdef/mission/tutorial/tutorial_story_util.d.tl:16
Call as tutorial_story_util.getClosestIndustryToTown
Notes
Returns the industry of a construction type closest to a town; one in the town's area wins.
| Parameter | Type | Description |
|---|---|---|
conName |
ResName |
Construction file of the industry. |
townEntity |
Engine.Entity |
Town. |
Returns Engine.Entity: Industry entity, or -1.
Used in the base game: 7 times in 2 files
base/content/mission/mission/tutorial/tutorial_story.tl:279
return tutorial_story_util.getClosestIndustryToTown("::/industries/fishing_grounds/fishing_grounds.con", tutorial_story_util.getCapital())
base/content/mission/mission/tutorial/tasks/tutorial_init.tl:138
getIndustryToConnect() : Engine.Entity base/tealdef/mission/tutorial/tutorial_story_util.d.tl:17
Call as tutorial_story_util.getIndustryToConnect
Notes
Returns the industry whose road the tutorial init task removed.
Returns Engine.Entity: Industry entity, or -1.
Used in the base game: 21 times in 2 files
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:155
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:155
makeAreaForIndustry(entity : Engine.Entity, radius : number) : MissionInterface.PosRadius base/tealdef/mission/tutorial/tutorial_story_util.d.tl:18
Call as tutorial_story_util.makeAreaForIndustry
Notes
Builds a circle at an industry construction's position.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Industry entity. |
radius |
number |
Radius in metres. |
Returns MissionInterface.PosRadius: Area, or nil.
Used in the base game: 8 times in 2 files
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:329
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:221
makeAreaForIndustryRoadSegment(entity : Engine.Entity) : MissionInterface.PosRadius base/tealdef/mission/tutorial/tutorial_story_util.d.tl:19
Call as tutorial_story_util.makeAreaForIndustryRoadSegment
Notes
Builds a 20 m circle at the start of the industry construction's first frozen edge.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Industry entity. |
Returns MissionInterface.PosRadius: Area, or nil.
Used in the base game: 4 times in 2 files
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:155
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:155
constructPolygonForWaterIndustry(entity : Engine.Entity) : PolygonUtil.Polygon base/tealdef/mission/tutorial/tutorial_story_util.d.tl:20
Call as tutorial_story_util.constructPolygonForWaterIndustry
Notes
Builds a convex polygon around the water body of a water industry, extended 200 m onto land.
| Parameter | Type | Description |
|---|---|---|
entity |
Engine.Entity |
Industry entity. |
Returns PolygonUtil.Polygon: Polygon.
Used in the base game: 2 times in 2 files
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:123
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:124
hasAnySingleVehicleSupplyLine(pos1 : {MissionInterface.PosRadius}, pos2 : {MissionInterface.PosRadius}, cargoTypeRes : string) : boolean base/tealdef/mission/tutorial/tutorial_story_util.d.tl:21
Call as tutorial_story_util.hasAnySingleVehicleSupplyLine
Notes
Tells whether a player road line between any of the start and end areas has exactly one vehicle that can carry the cargo.
| Parameter | Type | Description |
|---|---|---|
pos1 |
{MissionInterface.PosRadius} |
Start areas. |
pos2 |
{MissionInterface.PosRadius} |
End areas. |
cargoTypeRes |
string |
Cargo type resource. |
Returns boolean: true if such a line exists.