Module api.engine.util🔗
Contains definitions for of api.engine.util
global record EngineUtil
getPlayer: function(): Engine.Entity getWorld: function(): Engine.Entity getCalendarDate: function(gameTime : number): Date getYear: function(): integer hasStartedAsMission: function(): boolean getEntityName: function(Engine.Entity): string getEntityNameStem: function(Engine.Entity): {string, Engine.Entity} cargo: UtilCargo construction: UtilConstruction chart: UtilChart finance: UtilFinance headquarters: UtilHeadquarters line: UtilLine logbook: UtilLogbook maintenance: UtilMaintenance octree: UtilOctree parallelStrip: UtilParallelStrip pathfinding: UtilPathfinding station: UtilStation stock: UtilStock town: UtilTown transport: UtilTransport vehicle: UtilVehicle industry: UtilIndustry proposal: UtilProposal emission: UtilEmission formatAge: function(begin : integer, end : integer): string endglobal record UtilCargo
isGoodQuality: function(sim : Engine.Entity): booleanrecord CargoQualityData
clone: function(CargoQualityData): CargoQualityData countBad: integer countTotal: integer averageQuality: number | nil isVeryBad: boolean endgetCargoQualityDataForLine: function(lineEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForVehicle: function(vehicleEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStation: function(stationEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStationGroup: function(stationGroupEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStop: function(lineEntity : Engine.Entity, stopIndex : integer, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtTerminal: function(stationGroupEntity : Engine.Entity, stationTerminal : StationTerminal, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForStockList: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForStock: function(stockListEntity : Engine.Entity, stockId : StockId, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getSummarizedCargoQualityDataForStockList: function(stockListEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getSummarizedCargoQualityDataForLine: function(lineEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getSummarizedCargoQualityDataForVehicle: function(vehicleEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getNumCargoPerTypeInVehicle: function(vehicleEntity : Engine.Entity): {integer} endrecord SummarizedCargoQualityData
clone: function(SummarizedCargoQualityData): SummarizedCargoQualityData passengers: CargoQualityData cargo: CargoQualityData endglobal record UtilChart
getChartLabel: function(config : ChartConfig, index : integer, abbreviated : boolean): string setLastValue: function(chartResult : ChartResult, series : integer, value : number) endglobal record UtilConstruction
getNumAndFilledAutoFillSlots: function(entity : Engine.Entity): {integer, integer} getConstructionEntity: function(depotEntity : Engine.Entity): Engine.Entity getSlotTypes: function(entity : Engine.Entity): {string} getConstructionResult: function(constructionResName : ResName, constructionTemplate : integer, parameters : {<any type> : <any type>}): ConstructionResult getGlobalConstructionParams: function(): {string : number} getCostMultiplierForYear: function(costMultipliers : {integer : number}, currentYear : integer): number findSegmentsToDelete: function(constructionEntity : Engine.Entity, keepIndustryRoads : boolean): {Engine.Entity} endglobal record UtilEmission
getCurrentEmission: function(entity : Engine.Entity, type : Engine.Component.EmissionGrid.Type): number getPollutionEmittersInSettlementArea: function(entity : Engine.Entity): {{Engine.Entity, number}} getNoiseEmittersNearSettlementLandUses: function(entity : Engine.Entity, distance : number, landUseTypes : {LandUseType}): {{Engine.Entity, number}} endglobal record UtilFinance
getAccountChart: function(entity : Engine.Entity, config : ChartConfig): ChartResult getDebtChart: function(entity : Engine.Entity, config : ChartConfig, integer): ChartResult calculateBalance: function(entities : {Engine.Entity}, begin : integer, end : integer, true : boolean, only : JournalEntry.Maintenance): integer calculateEarnings: function(playerEntity : Engine.Entity): integer computeFinanceTable: function(playerEntity : Engine.Entity, config : ChartConfig): FinanceData getPlayersBalance: function(playerEntity : Engine.Entity): integer calcIncomeSince: function(current : number, playerEntity : Engine.Entity): number getLastIncomeTime: function(playerEntity : Engine.Entity): integer getFirstIncomeTime: function(playerEntity : Engine.Entity): integer endglobal record UtilHeadquarters
getTransportedData: function(): TransportationStats getCompaniesValue: function(): CompanyValue endglobal record UtilIndustry
getIndustryProductivityInfo: function(entity : Engine.Entity): IndustryProductivityInfo getClosingIndustries: function(): {{Engine.Entity, ResName}} getEconomyCargoDependencies: function(economyId : integer): {string : {string : number}} endrecord IndustryProductivityInfo
producing: boolean boostFromRule: boolean boostFromPersonCapacity: boolean endglobal record UtilLine
record PathProblemLocation
edgeIndex: integer node: NodeId nodePosition: Vec3f okModes: {TransportMode : boolean} relaxedModes: {TransportMode : boolean} allowedModes: {TransportMode : boolean} endrecord TerminalCapacityUsage
equals: function(TerminalCapacityUsage, TerminalCapacityUsage): boolean used: number capacity: number endgetLineCapacityUsages: function(line : Engine.Entity, allCapacities : boolean): {CargoTypeId : LineCapacityUsage} calcLineStationThroughput: function(lineEntity : Engine.Entity): integer getMaxFrequency: function(lineEntity : Engine.Entity): number getDetailedLineProblems: function(lineEntity : Engine.Entity): {{StopState}} getLineProblems: function(): {{Engine.Entity, integer, PathProblemLocation}} getLineStationProblems: function(): {{Engine.Entity, Engine.Entity, LineStationProblem}} isLineCompatibleWithCarrier: function(lineEntity : Engine.Entity, carrier : Carrier, distinguishTramFromRoad : boolean): boolean isLineCompatibleWithAnyCarrier: function(lineEntity : Engine.Entity, carriers : {Carrier}, distinguishTramFromRoad : boolean): boolean supportsReservation: function(lineEntity : Engine.Entity): boolean getLineIssues: function(lineEntity : Engine.Entity, allIssues : boolean): {LineIssue} getLinesIssues: function(playerEntity : Engine.Entity, allIssues : boolean): {Engine.Entity : {LineIssue}} getFailedPathReason: function(vehicle : Engine.Entity, line : Engine.Entity, fullLine : boolean): Failure getNoRoadConnectionProblems: function(): {Engine.Entity} endrecord StopState
empty: boolean noPath: boolean noPathFromAlternative: {integer, PathProblemLocation} noPathToAlternative: {integer, PathProblemLocation} duplicateStop: boolean incompatibleStop: boolean noPathLocation: PathProblemLocation endglobal record UtilLogbook
getLogValuePerYear: function(entity : Engine.Entity, logName : string): integer getLogValueMostRecent: function(entity : Engine.Entity, logName : string): integer getLogValueOldest: function(entity : Engine.Entity, logName : string): integer logValue: function(entity : Engine.Entity, logName : string, value : integer) getChart: function(logbookEntity : Engine.Entity, logNames : {string}, xMin : number, xMax : number, yMin : number, yMax : number, ChartConfig : ChartConfig): ChartResult getChartDiff: function(entity : Engine.Entity, logNames : {string}, config : ChartConfig): ChartResult endglobal record UtilMaintenance
calcMaintenanceForStationGroup: function(stationGroupEntity : Engine.Entity): integer calcMaintenanceForSubconstruction: function(subconstructionEntity : Engine.Entity): integer endglobal record UtilOctree
findEntitiesInCircle: function(center : Vec2f, radius : number, componentType : Engine.ComponentType): {Engine.Entity} findTransportNetworkNodesInCircle: function(center : Vec2f, radius : number): {NodeId} areWaypointsOnLine: function(waypoints : {Vec2f}, lineEntity : Engine.Entity, tolerance : number): boolean endglobal record UtilParallelStrip
getStripInfo: function(entity : Engine.Entity): StripInfo isBridge: function(entity : Engine.Entity): boolean isTunnel: function(entity : Engine.Entity): boolean endglobal record UtilPathfinding
findPath: function(startingEdgesAndLengths : {EdgeIdDirAndLength}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}, maxLength : number): {{EdgeId, boolean}} findPathNodeToNode: function(startNodes : {NodeId}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}): {{EdgeId, boolean}} getTargetsByLandUse: function(): {<any type> : <any type>} findDubinsPath: function(p0 : Vec3f, t0 : Vec3f, p1 : Vec3f, t1 : Vec3f, turnRadius : number): {{EdgeGeometry, boolean}} endrecord EdgeIdDirAndLength
edgeId: EdgeId dir: boolean length: number new: function(EdgeId, boolean, number): EdgeIdDirAndLength endglobal record UtilProposal
makeProposalData: function(Proposal, Context): ProposalData makeIndustrySpawnProposal: function(industryTypeTag : string, townEntity : Engine.Entity): Proposal makeSegmentsRemoveProposal: function(segmentsToRemove : {Engine.Entity}): Proposal createProposalRemove: function(entity : Engine.Entity, context : Context): Proposal createProposalReplaceConstruction: function(entity : Engine.Entity, params : {<any type> : <any type>}, newResName : ResName): Proposal createIndustryProposal: function(seed : string, industryRectangle : IndustryInfo, context : Context): Proposal createBridgeOrTunnelProposal: function(parallelStripEntity : Engine.Entity, newTypeIndex : integer): Proposal createDoubleSlipSwitchProposal: function(entity : Engine.Entity, doubleSlipSwitch : boolean): Proposal createTrafficLightProposal: function(entity : Engine.Entity, trafficLightConfig : Engine.Component.TrafficLightConfig, trafficLightPreference : TrafficLightPreference): Proposal getBridgeOrTunnelRelatedRevisions: function(parallelStripEntity : Engine.Entity): {Engine.Entity : Engine.Revision} didBridgeOrTunnelRelatedRevisionsChange: function(parallelStripEntity : Engine.Entity, revisions : {Engine.Entity : Engine.Revision}): boolean makeReforestationProposal: function(seed : integer, numTilesToUpdate : integer, maxTreesPerTile : integer): Proposal refreshConstruction: function(entity : Engine.Entity, constructionFilepath : string): Proposal replaceSegment: function(entity : Engine.Entity, streetTemplate : ResName): Proposal checkProposalConnectsNodes: function(startNode : Engine.Entity, startEdge : Engine.Entity, targetNode : Engine.Entity, streetProposal : Proposal.StreetProposal, isApply : boolean, maxDepth : number): boolean makeIndustryExtendProposal: function(industry : Engine.Entity, trySlots : integer, numExtendSlots : integer): {Proposal, {integer}} createSubconstructionLotList: function(Proposal.Subconstruction, Mat4f): Engine.Component.LotList getConstructionArea: function(proposal : Proposal): number endglobal record UtilStation
calculateStationUsage: function(station : Engine.Entity): StationUsage calculateStationTerminalUsage: function(station : Engine.Entity, terminalIndex : integer): UtilLine.TerminalCapacityUsagerecord StationUsage
totalUsed: integer overflow: integer poolCapacity: integer terminalCapacity: integer endcalculateStationGroupCargo: function(stationGroup : Engine.Entity, flatTerminalIndex : integer): StationGroupCapacityUsage isStationOfType: function(stationEntity : Engine.Entity, cargo : boolean): boolean findStationGroupWithOverlappingCatchmentOfDifferentCarriers: function(): {{Engine.Entity, Engine.Entity}} endrecord StationGroupCapacityUsage
equals: function(StationGroupCapacityUsage, StationGroupCapacityUsage): boolean capacity: integer waitingHallCapacity: integer used: integer overflow: boolean endglobal record UtilStock
getStockCargoTypes: function(stockListEntity : Engine.Entity, stockId : StockId): {CargoTypeId} getCargoTypeShippedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoShippedPerYear: function(stockListEntity : Engine.Entity): integer getCargoTypeDeliveredPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoDeliveredPerYear: function(stockListEntity : Engine.Entity): integer getCargoConsumedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoProducedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoMaxProductionPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoMaxConsumptionPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getInputsOutputsFromRules: function(stockListEntity : Engine.Entity): {{CargoTypeId}, {CargoTypeId}} getCargoOutputPerYear: function(stockListEntity : Engine.Entity): integer getCargoLogValueDiffPerYear: function(stockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer getCargoLogPerYearForTarget: function(sourceStockListEntity : Engine.Entity, targetStockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer getCargoLogPerYearForTargetFilter: function(sourceStockListEntity : Engine.Entity, targetFilter : function(Engine.Entity) : boolean, logType : string, cargoTypeId : CargoTypeId): integer getProductionRating: function(stockListEntity : Engine.Entity): number getStockGroupsByTypeAndCargoTypes: function(stockListEntity : Engine.Entity, sortByType : boolean, showEmpty : boolean): {{StockListType, {StockId}, {CargoTypeId}, integer}} getStockListsWithThrownAwayCargo: function(): {Engine.Entity : integer} hasAnyCompatibleStock: function(entities : {Engine.Entity}, cargoTypeId : CargoTypeId, load : boolean): boolean getAdjustedDeliveryTime: function(cargoTypeId : CargoTypeId): integer isCargoTypeCurrentlyProduced: function(cargoTypeId : CargoTypeId): boolean endglobal record UtilTown
record TownReachability
commercialPrivate: integer commercialPublic: integer industrialPrivate: integer industrialPublic: integer endcomputeWeightedTargetTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} computeUnweightedTargetTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} computeActualTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} getLandUse2CargoTypes: function(): {LandUseType : {CargoTypeId}} getTownReachability: function(townEntity : Engine.Entity): TownReachability getTownEmission: function(townEntity : Engine.Entity): TownEmission getTownEmissionDB: function(townEntity : Engine.Entity): TownEmission getTownCapacityUsage: function(townEntity : Engine.Entity): {TownCapacityUsage} getTownHappinessStats: function(townEntity : Engine.Entity, numTopLines : integer): TownHappinessStats getTownDeliveriesStats: function(townEntity : Engine.Entity, interval : integer, perLine : boolean, perCargoType : boolean): {Engine.Entity : {CargoTypeId : {integer, integer}}} getTownStockCargo: function(townEntity : Engine.Entity): {CargoTypeId : {integer, integer}} getTerrainBrushVolumeImpact: function(proposal : Proposal): {Engine.Entity : {number, number}} getTerrainAlignmentImpact: function(proposalData : ProposalData): {Engine.Entity : {number, number}} getAutoRemovalEntityImpact: function(proposalData : ProposalData): {Engine.Entity : {number, number}} getTownNoisePerDistrict: function(townEntity : Engine.Entity, landUseTypes : {LandUseType}): {LandUseType : {number, integer}} getImpactFromDistance: function(distance : number): number computeTownsTrafficSpeedMap: function(samplesCoefficient : number): {Engine.Entity : {number, {integer}}} getTownProblems: function(): {{{Engine.Entity}, TownProblem}} isNeighbourTown: function(townEntity1 : Engine.Entity, townEntity2 : Engine.Entity): boolean getClosestTown: function(position : Vec3f): Engine.Entity getRandomTownPosition: function(townEntity : Engine.Entity, seed : integer): Vec2f isLineStoppingInTown: function(lineEntity : Engine.Entity, townEntity : Engine.Entity): boolean getTownLineUsage: function(townEntity : Engine.Entity): number getSourceToDestinationCount: function(townEntitiy : Engine.Entity, destinationIsTownMap : {Engine.Entity : boolean}, selectLandUse : integer): {Engine.Entity : DestinationUseCount} getTownDistrictCenter: function(entity : Engine.Entity, landUseTypes : LandUseType): Vec3f endrecord TownHappinessStats
travellingInside: {integer, integer} travellingTo: ByResident travellingFrom: ByResident atBuilding: {integer, integer} byCar: {integer, integer} walking: {integer, integer} byLine: {{Engine.Entity, ByResident}} endglobal record UtilTransport
calcPosition: function(eg : EdgeGeometry, t : number): Vec3f calcPositionAndDirection: function(eg : EdgeGeometry, t : number, forward : boolean): {Vec3f} transportModesToCarriers: function(transportModes : {TransportMode}): {Carrier} getStartPort: function(edge : {EdgeId, boolean}): PortId getEndPort: function(edge : {EdgeId, boolean}): PortId isPortLocked: function(port : integer): boolean endglobal record UtilVehicle
findBestLineAndDepotForVehicle: function(vehicleEntity : Engine.Entity): {Engine.Entity, Engine.Entity} findBestDepotForLine: function(carrier : Carrier, transportModes : {TransportMode}, lineEntity : Engine.Entity, position : Vec3f): Engine.Entity getSpeed: function(vehicleEntity : Engine.Entity): number getPosition: function(vehicleEntity : Engine.Entity): Vec3f calcPathPosData: function(vehicleEntity : Engine.Entity): PathPosData getDirection: function(vehicleEntity : Engine.Entity): Vec3f getVehiclesByCarrier: function(carrier : Carrier): {Engine.Entity} getVehicles: function(): {Engine.Entity} getRunningCost: function(vehicleEntity : Engine.Entity): number getDepreciatedValue: function(vehicleEntity : Engine.Entity): integer getPartPrice: function(part : TransportVehiclePart): integer getLength: function(modelAsset : Model): number getAllCargoForCargoTypeSet: function(cargoTypeSet : CargoTypeSet): {CargoTypeId} getVehicleLoadedCargoTypes: function(vehicleEntity : Engine.Entity): {CargoTypeId} getVehicleProblems: function(): {{{Engine.Entity}, VehicleProblem}} getMaintenanceEmissionPenalty: function(maintenanceState : number): number getMaintenanceComfortPenalty: function(maintenanceState : number): number getMaintenanceTopSpeedPenalty: function(topSpeedMaintenanceFactorPenaltyPerLevel : number, maintenanceState : number): number getMaintenanceRunningCostPenalty: function(maintenanceState : number): number getVehicleType: function(vehicleEntity : Engine.Entity): integer getVehicleCapacities: function(vehicleEntity : Engine.Entity): {integer} getVehicleUnsetCapacities: function(vehicleEntity : Engine.Entity): {{integer}} end
Category: main🔗
EngineUtil🔗
global record EngineUtil
getPlayer: function(): Engine.Entity getWorld: function(): Engine.Entity getCalendarDate: function(gameTime : number): Date getYear: function(): integer hasStartedAsMission: function(): boolean getEntityName: function(Engine.Entity): string getEntityNameStem: function(Engine.Entity): {string, Engine.Entity} cargo: UtilCargo construction: UtilConstruction chart: UtilChart finance: UtilFinance headquarters: UtilHeadquarters line: UtilLine logbook: UtilLogbook maintenance: UtilMaintenance octree: UtilOctree parallelStrip: UtilParallelStrip pathfinding: UtilPathfinding station: UtilStation stock: UtilStock town: UtilTown transport: UtilTransport vehicle: UtilVehicle industry: UtilIndustry proposal: UtilProposal emission: UtilEmission formatAge: function(begin : integer, end : integer): string end
Collection of engine specific utils grouped by system
EngineUtil.getPlayer🔗
function EngineUtil.getPlayer(): Engine.Entity
Obtains the player entity.
ReturnsEngine.Entity— entity id
EngineUtil.getWorld🔗
function EngineUtil.getWorld(): Engine.Entity
Obtains the world entity.
ReturnsEngine.Entity— entity id
EngineUtil.getCalendarDate🔗
function EngineUtil.getCalendarDate(gameTime : number): Date
Return the calendar date of the gametime, assuming current ingame speed.
ParametersgameTime:number— gametime for which to obtain the date
Date— calendar date matching the game time at the current speed
EngineUtil.getYear🔗
function EngineUtil.getYear(): integerReturns
integer
EngineUtil.hasStartedAsMission🔗
function EngineUtil.hasStartedAsMission(): boolean
Returns true if currently an active mission, started from the menu, is running
Returnsboolean— true if mission is running
EngineUtil.getEntityName🔗
function EngineUtil.getEntityName(Engine.Entity): string
Get name of an (existing) entity, computing it from the base construction if needed.
ParametersEngine.Entity
string— string Entity name, or nil
EngineUtil.getEntityNameStem🔗
function EngineUtil.getEntityNameStem(Engine.Entity): {string, Engine.Entity}
Get name stem of an (existing) entity
ParametersEngine.Entity
{string, Engine.Entity}— string Entity name and Entity where the stem came from (both can be nil)
EngineUtil.cargo🔗
EngineUtil.cargo: UtilCargo
EngineUtil.construction🔗
EngineUtil.construction: UtilConstruction
EngineUtil.chart🔗
EngineUtil.chart: UtilChart
EngineUtil.finance🔗
EngineUtil.finance: UtilFinance
EngineUtil.headquarters🔗
EngineUtil.headquarters: UtilHeadquarters
EngineUtil.line🔗
EngineUtil.line: UtilLine
EngineUtil.logbook🔗
EngineUtil.logbook: UtilLogbook
EngineUtil.maintenance🔗
EngineUtil.maintenance: UtilMaintenance
EngineUtil.octree🔗
EngineUtil.octree: UtilOctree
EngineUtil.parallelStrip🔗
EngineUtil.parallelStrip: UtilParallelStrip
EngineUtil.pathfinding🔗
EngineUtil.pathfinding: UtilPathfinding
EngineUtil.station🔗
EngineUtil.station: UtilStation
EngineUtil.stock🔗
EngineUtil.stock: UtilStock
EngineUtil.town🔗
EngineUtil.town: UtilTown
EngineUtil.transport🔗
EngineUtil.transport: UtilTransport
EngineUtil.vehicle🔗
EngineUtil.vehicle: UtilVehicle
EngineUtil.industry🔗
EngineUtil.industry: UtilIndustry
EngineUtil.proposal🔗
EngineUtil.proposal: UtilProposal
EngineUtil.emission🔗
EngineUtil.emission: UtilEmission
EngineUtil.formatAge🔗
function EngineUtil.formatAge(begin : integer, end : integer): string
Format age of a vehicle using current ingame speed.
Parametersbegin:integer— timestamp of the time intervalend:integer— timestamp of the time interval
string— formatted output, e.g. "6 years"
Category: globals🔗
UtilCargo🔗
global record UtilCargo
isGoodQuality: function(sim : Engine.Entity): booleanrecord CargoQualityData
clone: function(CargoQualityData): CargoQualityData countBad: integer countTotal: integer averageQuality: number | nil isVeryBad: boolean endgetCargoQualityDataForLine: function(lineEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForVehicle: function(vehicleEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStation: function(stationEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStationGroup: function(stationGroupEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtStop: function(lineEntity : Engine.Entity, stopIndex : integer, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataAtTerminal: function(stationGroupEntity : Engine.Entity, stationTerminal : StationTerminal, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForStockList: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getCargoQualityDataForStock: function(stockListEntity : Engine.Entity, stockId : StockId, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData getSummarizedCargoQualityDataForStockList: function(stockListEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getSummarizedCargoQualityDataForLine: function(lineEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getSummarizedCargoQualityDataForVehicle: function(vehicleEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData getNumCargoPerTypeInVehicle: function(vehicleEntity : Engine.Entity): {integer} endrecord SummarizedCargoQualityData
clone: function(SummarizedCargoQualityData): SummarizedCargoQualityData passengers: CargoQualityData cargo: CargoQualityData end
UtilCargo.isGoodQuality🔗
function UtilCargo.isGoodQuality(sim : Engine.Entity): boolean
Check if a cargo is in time / a person is happy
Parameterssim:Engine.Entity— cargo or person entity
boolean— true if good quality
UtilCargo.CargoQualityData🔗
record UtilCargo.CargoQualityData
clone: function(CargoQualityData): CargoQualityData countBad: integer countTotal: integer averageQuality: number | nil isVeryBad: boolean end
UtilCargo.CargoQualityData.clone🔗
function UtilCargo.CargoQualityData.clone(CargoQualityData): CargoQualityDataParameters
CargoQualityData
CargoQualityData
UtilCargo.CargoQualityData.countBad🔗
UtilCargo.CargoQualityData.countBad: integer
UtilCargo.CargoQualityData.countTotal🔗
UtilCargo.CargoQualityData.countTotal: integer
UtilCargo.CargoQualityData.averageQuality🔗
UtilCargo.CargoQualityData.averageQuality: number | nil
UtilCargo.CargoQualityData.isVeryBad🔗
UtilCargo.CargoQualityData.isVeryBad: boolean
UtilCargo.SummarizedCargoQualityData🔗
UtilCargo.SummarizedCargoQualityData.clone🔗
function UtilCargo.SummarizedCargoQualityData.clone(SummarizedCargoQualityData): SummarizedCargoQualityDataParameters
SummarizedCargoQualityData
SummarizedCargoQualityData
UtilCargo.SummarizedCargoQualityData.passengers🔗
UtilCargo.SummarizedCargoQualityData.passengers: CargoQualityData
UtilCargo.SummarizedCargoQualityData.cargo🔗
UtilCargo.SummarizedCargoQualityData.cargo: CargoQualityData
UtilCargo.getCargoQualityDataForLine🔗
function UtilCargo.getCargoQualityDataForLine(lineEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get cargo type quality data in a line.
ParameterslineEntity:Engine.Entity— line entitycargoTypeId:CargoTypeId— cargo type (passengers allowed)
UtilCargo.CargoQualityData— data about cargo quality
UtilCargo.getCargoQualityDataForVehicle🔗
function UtilCargo.getCargoQualityDataForVehicle(vehicleEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get cargo type quality data in a vehicle.
ParametersvehicleEntity:Engine.Entity— vehicle entitycargoTypeId:CargoTypeId— cargo type (passengers allowed)
UtilCargo.CargoQualityData— data about cargo quality
UtilCargo.getCargoQualityDataAtStation🔗
function UtilCargo.getCargoQualityDataAtStation(stationEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get all persons waiting at a station plus the number of unhappy ones.
ParametersstationEntity:Engine.Entity— station entitycargoTypeId:CargoTypeId— the cargo type (passengers allowed)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getCargoQualityDataAtStationGroup🔗
function UtilCargo.getCargoQualityDataAtStationGroup(stationGroupEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get all persons waiting at station group plus the number of unhappy ones.
ParametersstationGroupEntity:Engine.Entity— station group entitycargoTypeId:CargoTypeId— the cargo type (passengers allowed)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getCargoQualityDataAtStop🔗
function UtilCargo.getCargoQualityDataAtStop(lineEntity : Engine.Entity, stopIndex : integer, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get all persons waiting at a certain line stop plus the number of unhappy ones.
ParameterslineEntity:Engine.Entity— line entitystopIndex:integer— index of stopcargoTypeId:CargoTypeId— the cargo type (passengers allowed)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getCargoQualityDataAtTerminal🔗
function UtilCargo.getCargoQualityDataAtTerminal(stationGroupEntity : Engine.Entity, stationTerminal : StationTerminal, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get all persons waiting at a certain terminal plus the number of unhappy ones.
ParametersstationGroupEntity:Engine.Entity— station group entitystationTerminal:StationTerminal— the affected station and terminal indicescargoTypeId:CargoTypeId— the cargo type (passengers allowed)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getCargoQualityDataForStockList🔗
function UtilCargo.getCargoQualityDataForStockList(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get stock list cargo type quality.
ParametersstockListEntity:Engine.Entity— stockList entitycargoTypeId:CargoTypeId— the cargo type (passengers allowed but doesn't make sense)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getCargoQualityDataForStock🔗
function UtilCargo.getCargoQualityDataForStock(stockListEntity : Engine.Entity, stockId : StockId, cargoTypeId : CargoTypeId): UtilCargo.CargoQualityData
Get stock cargo type quality (over all cargo types).
ParametersstockListEntity:Engine.Entity— stockList entitystockId:StockId— stock id inside the stock listcargoTypeId:CargoTypeId— the cargo type (passing nil will aggregate over all cargo types)
UtilCargo.CargoQualityData— cargo quality data
UtilCargo.getSummarizedCargoQualityDataForStockList🔗
function UtilCargo.getSummarizedCargoQualityDataForStockList(stockListEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData
Get stock list cargo type quality (over all cargo types).
ParametersstockListEntity:Engine.Entity— stockList entity
UtilCargo.SummarizedCargoQualityData— cargo quality data
UtilCargo.getSummarizedCargoQualityDataForLine🔗
function UtilCargo.getSummarizedCargoQualityDataForLine(lineEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData
Get cargo type quality summary.
ParameterslineEntity:Engine.Entity— line entity
UtilCargo.SummarizedCargoQualityData— cargo quality data
UtilCargo.getSummarizedCargoQualityDataForVehicle🔗
function UtilCargo.getSummarizedCargoQualityDataForVehicle(vehicleEntity : Engine.Entity): UtilCargo.SummarizedCargoQualityData
Get cargo type quality summary.
ParametersvehicleEntity:Engine.Entity— vehicle entity
UtilCargo.SummarizedCargoQualityData— cargo quality data
UtilCargo.getNumCargoPerTypeInVehicle🔗
function UtilCargo.getNumCargoPerTypeInVehicle(vehicleEntity : Engine.Entity): {integer}
Get total amount of cargo loaded in the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
{integer}— number of cargo items per type
UtilChart🔗
global record UtilChart
getChartLabel: function(config : ChartConfig, index : integer, abbreviated : boolean): string setLastValue: function(chartResult : ChartResult, series : integer, value : number) end
UtilChart.getChartLabel🔗
function UtilChart.getChartLabel(config : ChartConfig, index : integer, abbreviated : boolean): string
Get label for X axis of date charts.
Parametersconfig:ChartConfig— chart configindex:integer— group index of which the label should be returnedabbreviated:boolean— if label should be for range (true) or point (false)
string— chart label string
UtilChart.setLastValue🔗
function UtilChart.setLastValue(chartResult : ChartResult, series : integer, value : number)
Set the last value for a chart result.
ParameterschartResult:ChartResult— chart result containing the series to be updatedseries:integer— series index of which the last value should be setvalue:number— value to set as the last value of the series
UtilConstruction🔗
global record UtilConstruction
getNumAndFilledAutoFillSlots: function(entity : Engine.Entity): {integer, integer} getConstructionEntity: function(depotEntity : Engine.Entity): Engine.Entity getSlotTypes: function(entity : Engine.Entity): {string} getConstructionResult: function(constructionResName : ResName, constructionTemplate : integer, parameters : {<any type> : <any type>}): ConstructionResult getGlobalConstructionParams: function(): {string : number} getCostMultiplierForYear: function(costMultipliers : {integer : number}, currentYear : integer): number findSegmentsToDelete: function(constructionEntity : Engine.Entity, keepIndustryRoads : boolean): {Engine.Entity} end
UtilConstruction.getNumAndFilledAutoFillSlots🔗
function UtilConstruction.getNumAndFilledAutoFillSlots(entity : Engine.Entity): {integer, integer}
Get total number of auto fill slots and number of filled auto fill slots.
Parametersentity:Engine.Entity— construction entity
{integer, integer}— num filled auto fill slots
UtilConstruction.getConstructionEntity🔗
function UtilConstruction.getConstructionEntity(depotEntity : Engine.Entity): Engine.Entity
Gets construction entity for the entity.
ParametersdepotEntity:Engine.Entity— the entity for which the containing construction should be fetched
Engine.Entity— construction entity
UtilConstruction.getSlotTypes🔗
function UtilConstruction.getSlotTypes(entity : Engine.Entity): {string}
Get slot types of construction.
Parametersentity:Engine.Entity— construction entity
{string}— slot types
UtilConstruction.getConstructionResult🔗
function UtilConstruction.getConstructionResult(constructionResName : ResName, constructionTemplate : integer, parameters : {<any type> : <any type>}): ConstructionResult
Get construction result for a given construction.
ParametersconstructionResName:ResName— resource name of the constructionconstructionTemplate:integer— template indexparameters:{<any type> : <any type>}— parameters for the updateFn
ConstructionResult— construction result
UtilConstruction.getGlobalConstructionParams🔗
function UtilConstruction.getGlobalConstructionParams(): {string : number}
Get global construction params
Returns{string : number}— global construction parameters
UtilConstruction.getCostMultiplierForYear🔗
function UtilConstruction.getCostMultiplierForYear(costMultipliers : {integer : number}, currentYear : integer): number
Get cost multiplier for year
ParameterscostMultipliers:{integer : number}— cost multipliers by yearcurrentYear:integer— current year
number— cost multiplier
UtilConstruction.findSegmentsToDelete🔗
function UtilConstruction.findSegmentsToDelete(constructionEntity : Engine.Entity, keepIndustryRoads : boolean): {Engine.Entity}
Get street segments to remove when a construction entity is removed
ParametersconstructionEntity:Engine.Entity— the construction entity we want to find segments forkeepIndustryRoads:boolean— (default = false) whether to keep the segments that are built with the industry
{Engine.Entity}— the street segments to remove
UtilEmission🔗
global record UtilEmission
getCurrentEmission: function(entity : Engine.Entity, type : Engine.Component.EmissionGrid.Type): number getPollutionEmittersInSettlementArea: function(entity : Engine.Entity): {{Engine.Entity, number}} getNoiseEmittersNearSettlementLandUses: function(entity : Engine.Entity, distance : number, landUseTypes : {LandUseType}): {{Engine.Entity, number}} end
UtilEmission.getCurrentEmission🔗
function UtilEmission.getCurrentEmission(entity : Engine.Entity, type : Engine.Component.EmissionGrid.Type): number
Get current emission at entity.
Parametersentity:Engine.Entity— the entity with Emission componenttype:Engine.Component.EmissionGrid.Type— emission type
number— emission value
UtilEmission.getPollutionEmittersInSettlementArea🔗
function UtilEmission.getPollutionEmittersInSettlementArea(entity : Engine.Entity): {{Engine.Entity, number}}
Get all pollution emitters in settlement area.
Parametersentity:Engine.Entity— the town entity
{{Engine.Entity, number}}— list of emitters with emission values
UtilEmission.getNoiseEmittersNearSettlementLandUses🔗
function UtilEmission.getNoiseEmittersNearSettlementLandUses(entity : Engine.Entity, distance : number, landUseTypes : {LandUseType}): {{Engine.Entity, number}}
Get all noise emitters near land uses of a settlement.
Parametersentity:Engine.Entity— the settlement entitydistance:number— maximum distancelandUseTypes:{LandUseType}— land use type filter
{{Engine.Entity, number}}— list of emitters with emission values
UtilFinance🔗
global record UtilFinance
getAccountChart: function(entity : Engine.Entity, config : ChartConfig): ChartResult getDebtChart: function(entity : Engine.Entity, config : ChartConfig, integer): ChartResult calculateBalance: function(entities : {Engine.Entity}, begin : integer, end : integer, true : boolean, only : JournalEntry.Maintenance): integer calculateEarnings: function(playerEntity : Engine.Entity): integer computeFinanceTable: function(playerEntity : Engine.Entity, config : ChartConfig): FinanceData getPlayersBalance: function(playerEntity : Engine.Entity): integer calcIncomeSince: function(current : number, playerEntity : Engine.Entity): number getLastIncomeTime: function(playerEntity : Engine.Entity): integer getFirstIncomeTime: function(playerEntity : Engine.Entity): integer end
UtilFinance.getAccountChart🔗
function UtilFinance.getAccountChart(entity : Engine.Entity, config : ChartConfig): ChartResult
Get chart for account (income and costs).
Parametersentity:Engine.Entity— entity with account componentconfig:ChartConfig— chart config
ChartResult— chart result
UtilFinance.getDebtChart🔗
function UtilFinance.getDebtChart(entity : Engine.Entity, config : ChartConfig, integer): ChartResult
Get chart for debts.
Parametersentity:Engine.Entity— entity with account componentconfig:ChartConfig— chart configinteger
ChartResult— chart result
UtilFinance.calculateBalance🔗
function UtilFinance.calculateBalance(entities : {Engine.Entity}, begin : integer, end : integer, true : boolean, only : JournalEntry.Maintenance): integer
Get (summed) balance of entities
Parametersentities:{Engine.Entity}— (having an account)begin:integer— time (interval)end:integer— time (interval)true:boolean— if only maintenance/income entries are to be consideredonly:JournalEntry.Maintenance— consider for given maintenance type (use nil for all)
integer— (summed) balance over given interval's time
UtilFinance.calculateEarnings🔗
function UtilFinance.calculateEarnings(playerEntity : Engine.Entity): integer
Get the earnings from beginning of the year to now
ParametersplayerEntity:Engine.Entity— player entity
integer— earnings
UtilFinance.computeFinanceTable🔗
function UtilFinance.computeFinanceTable(playerEntity : Engine.Entity, config : ChartConfig): FinanceData
Get current state of fincance table.
ParametersplayerEntity:Engine.Entity— player entityconfig:ChartConfig— config of chart behind the table
FinanceData— struct holding all the relevant values
UtilFinance.getPlayersBalance🔗
function UtilFinance.getPlayersBalance(playerEntity : Engine.Entity): integer
Get balance of the player's bank account.
ParametersplayerEntity:Engine.Entity— the player entity
integer— balance or nil, if player has won the lottery and money is infinite
UtilFinance.calcIncomeSince🔗
function UtilFinance.calcIncomeSince(current : number, playerEntity : Engine.Entity): number
The income since the specified time (non-inclusive).
Parameterscurrent:number— game timeplayerEntity:Engine.Entity— the player entity
number— The income
UtilFinance.getLastIncomeTime🔗
function UtilFinance.getLastIncomeTime(playerEntity : Engine.Entity): integer
The time of the last income.
ParametersplayerEntity:Engine.Entity— the player entity
integer— The time of the last income entry
UtilFinance.getFirstIncomeTime🔗
function UtilFinance.getFirstIncomeTime(playerEntity : Engine.Entity): integer
The time of the first income.
ParametersplayerEntity:Engine.Entity— the player entity
integer— The time of the first income entry
UtilHeadquarters🔗
global record UtilHeadquarters
getTransportedData: function(): TransportationStats getCompaniesValue: function(): CompanyValue end
UtilHeadquarters.getTransportedData🔗
function UtilHeadquarters.getTransportedData(): TransportationStats
Obtains the transportation data.
ReturnsTransportationStats— some transportation statistics for the company
UtilHeadquarters.getCompaniesValue🔗
function UtilHeadquarters.getCompaniesValue(): CompanyValue
Obtains the companie's value
ReturnsCompanyValue— company value data
UtilIndustry🔗
global record UtilIndustry
getIndustryProductivityInfo: function(entity : Engine.Entity): IndustryProductivityInfo getClosingIndustries: function(): {{Engine.Entity, ResName}} getEconomyCargoDependencies: function(economyId : integer): {string : {string : number}} endrecord IndustryProductivityInfo
producing: boolean boostFromRule: boolean boostFromPersonCapacity: boolean end
UtilIndustry.IndustryProductivityInfo🔗
record UtilIndustry.IndustryProductivityInfo
producing: boolean boostFromRule: boolean boostFromPersonCapacity: boolean end
UtilIndustry.IndustryProductivityInfo.producing🔗
UtilIndustry.IndustryProductivityInfo.producing: boolean
UtilIndustry.IndustryProductivityInfo.boostFromRule🔗
UtilIndustry.IndustryProductivityInfo.boostFromRule: boolean
UtilIndustry.IndustryProductivityInfo.boostFromPersonCapacity🔗
UtilIndustry.IndustryProductivityInfo.boostFromPersonCapacity: boolean
UtilIndustry.getIndustryProductivityInfo🔗
function UtilIndustry.getIndustryProductivityInfo(entity : Engine.Entity): IndustryProductivityInfo
Get the industry's productivity
Parametersentity:Engine.Entity— the industry entity
IndustryProductivityInfo— productivity info
UtilIndustry.getClosingIndustries🔗
function UtilIndustry.getClosingIndustries(): {{Engine.Entity, ResName}}
Get list of industries that are closing
Returns{{Engine.Entity, ResName}}— list of industry entities and their resource names
UtilIndustry.getEconomyCargoDependencies🔗
function UtilIndustry.getEconomyCargoDependencies(economyId : integer): {string : {string : number}}
Get the cargo dependencies of an economy
ParameterseconomyId:integer— the economy id
{string : {string : number}}— A map from cargoTag to a map of industryTag to count
UtilLine🔗
global record UtilLine
record PathProblemLocation
edgeIndex: integer node: NodeId nodePosition: Vec3f okModes: {TransportMode : boolean} relaxedModes: {TransportMode : boolean} allowedModes: {TransportMode : boolean} endrecord TerminalCapacityUsage
equals: function(TerminalCapacityUsage, TerminalCapacityUsage): boolean used: number capacity: number endgetLineCapacityUsages: function(line : Engine.Entity, allCapacities : boolean): {CargoTypeId : LineCapacityUsage} calcLineStationThroughput: function(lineEntity : Engine.Entity): integer getMaxFrequency: function(lineEntity : Engine.Entity): number getDetailedLineProblems: function(lineEntity : Engine.Entity): {{StopState}} getLineProblems: function(): {{Engine.Entity, integer, PathProblemLocation}} getLineStationProblems: function(): {{Engine.Entity, Engine.Entity, LineStationProblem}} isLineCompatibleWithCarrier: function(lineEntity : Engine.Entity, carrier : Carrier, distinguishTramFromRoad : boolean): boolean isLineCompatibleWithAnyCarrier: function(lineEntity : Engine.Entity, carriers : {Carrier}, distinguishTramFromRoad : boolean): boolean supportsReservation: function(lineEntity : Engine.Entity): boolean getLineIssues: function(lineEntity : Engine.Entity, allIssues : boolean): {LineIssue} getLinesIssues: function(playerEntity : Engine.Entity, allIssues : boolean): {Engine.Entity : {LineIssue}} getFailedPathReason: function(vehicle : Engine.Entity, line : Engine.Entity, fullLine : boolean): Failure getNoRoadConnectionProblems: function(): {Engine.Entity} endrecord StopState
empty: boolean noPath: boolean noPathFromAlternative: {integer, PathProblemLocation} noPathToAlternative: {integer, PathProblemLocation} duplicateStop: boolean incompatibleStop: boolean noPathLocation: PathProblemLocation end
UtilLine.LineCapacityUsage🔗
UtilLine.LineCapacityUsage.used🔗
UtilLine.LineCapacityUsage.used: number
Currently used capacity
UtilLine.LineCapacityUsage.capacity🔗
UtilLine.LineCapacityUsage.capacity: number
Total capacity
UtilLine.PathProblemLocation🔗
record UtilLine.PathProblemLocation
edgeIndex: integer node: NodeId nodePosition: Vec3f okModes: {TransportMode : boolean} relaxedModes: {TransportMode : boolean} allowedModes: {TransportMode : boolean} end
UtilLine.PathProblemLocation.edgeIndex🔗
UtilLine.PathProblemLocation.edgeIndex: integer
UtilLine.PathProblemLocation.node🔗
UtilLine.PathProblemLocation.node: NodeId
UtilLine.PathProblemLocation.nodePosition🔗
UtilLine.PathProblemLocation.nodePosition: Vec3f
UtilLine.PathProblemLocation.okModes🔗
UtilLine.PathProblemLocation.okModes: {TransportMode : boolean}
compatible transport modes present on the last compatible edge (e.g. ELECTRIC_TRAIN)
UtilLine.PathProblemLocation.relaxedModes🔗
UtilLine.PathProblemLocation.relaxedModes: {TransportMode : boolean}
compatible relaxed transport modes on the first incompatible edge.
Example 1: okModes[ELECTRIC_TRAIN], relaxedModes[TRAIN] -> relaxation allowed the use of non-electric train, indicating missing catenaries
Example 2: okModes[TRAM], relaxedModes[ROAD] -> relaxation allowed the use of road instead of tram, indicating missing tram lanes
note that this can never overlap with okModes (otherwise there would not be a problem here)
UtilLine.PathProblemLocation.allowedModes🔗
UtilLine.PathProblemLocation.allowedModes: {TransportMode : boolean}
Allowed modes for the line / vehicle in general
UtilLine.TerminalCapacityUsage🔗
record UtilLine.TerminalCapacityUsage
equals: function(TerminalCapacityUsage, TerminalCapacityUsage): boolean used: number capacity: number end
UtilLine.TerminalCapacityUsage.equals🔗
function UtilLine.TerminalCapacityUsage.equals(TerminalCapacityUsage, TerminalCapacityUsage): booleanParameters
TerminalCapacityUsageTerminalCapacityUsage
boolean
UtilLine.TerminalCapacityUsage.used🔗
UtilLine.TerminalCapacityUsage.used: number
Currently used capacity
UtilLine.TerminalCapacityUsage.capacity🔗
UtilLine.TerminalCapacityUsage.capacity: number
Total capacity
UtilLine.StopState🔗
record UtilLine.StopState
empty: boolean noPath: boolean noPathFromAlternative: {integer, PathProblemLocation} noPathToAlternative: {integer, PathProblemLocation} duplicateStop: boolean incompatibleStop: boolean noPathLocation: PathProblemLocation end
Information about the problem of a line.
UtilLine.StopState.empty🔗
UtilLine.StopState.empty: boolean
No vehicles and less than 2 stops
UtilLine.StopState.noPath🔗
UtilLine.StopState.noPath: boolean
No path between stops
UtilLine.StopState.noPathFromAlternative🔗
UtilLine.StopState.noPathFromAlternative: {integer, PathProblemLocation}
No path from an alternative stop {flattenedTerminalIndex, optional problem location}
UtilLine.StopState.noPathToAlternative🔗
UtilLine.StopState.noPathToAlternative: {integer, PathProblemLocation}
No path to an alternative stop {flattenedTerminalIndex, optional problem location}
UtilLine.StopState.duplicateStop🔗
UtilLine.StopState.duplicateStop: boolean
Stop is a duplicate
UtilLine.StopState.incompatibleStop🔗
UtilLine.StopState.incompatibleStop: boolean
Stop is incompatible with the line's transport mode
UtilLine.StopState.noPathLocation🔗
UtilLine.StopState.noPathLocation: PathProblemLocation
Optional problem location in case of noPath
UtilLine.getLineCapacityUsages🔗
function UtilLine.getLineCapacityUsages(line : Engine.Entity, allCapacities : boolean): {CargoTypeId : LineCapacityUsage}
Get line capacity usages.
Parametersline:Engine.Entity— line entityallCapacities:boolean— whether to return all capacities or the capacities for the vehicles current load config
{CargoTypeId : LineCapacityUsage}— map of cargo type to capacity usage
UtilLine.calcLineStationThroughput🔗
function UtilLine.calcLineStationThroughput(lineEntity : Engine.Entity): integer
Calc line throughput
ParameterslineEntity:Engine.Entity— line entity
integer— throughput value
UtilLine.getMaxFrequency🔗
function UtilLine.getMaxFrequency(lineEntity : Engine.Entity): number
Get line max frequency
ParameterslineEntity:Engine.Entity— line entity
number— max frequency
UtilLine.getDetailedLineProblems🔗
function UtilLine.getDetailedLineProblems(lineEntity : Engine.Entity): {{StopState}}
Get lines with detailed problems per stop
ParameterslineEntity:Engine.Entity— line entity
{{StopState}}— list of stop problems
UtilLine.getLineProblems🔗
function UtilLine.getLineProblems(): {{Engine.Entity, integer, PathProblemLocation}}
Get lines with problems
Returns{{Engine.Entity, integer, PathProblemLocation}}— list of {line entity, problem type, optional info about 1st problem and its location}
UtilLine.getLineStationProblems🔗
function UtilLine.getLineStationProblems(): {{Engine.Entity, Engine.Entity, LineStationProblem}}
Get station problems with lines
Returns{{Engine.Entity, Engine.Entity, LineStationProblem}}— list of line entity, station group entity and problem type
UtilLine.isLineCompatibleWithCarrier🔗
function UtilLine.isLineCompatibleWithCarrier(lineEntity : Engine.Entity, carrier : Carrier, distinguishTramFromRoad : boolean): boolean
Check if line is ok with provided carrier
ParameterslineEntity:Engine.Entity— line entitycarrier:Carrier— carrier typedistinguishTramFromRoad:boolean— if tram should not be counted as road
boolean— true if the line is compatible with the specified carrier
UtilLine.isLineCompatibleWithAnyCarrier🔗
function UtilLine.isLineCompatibleWithAnyCarrier(lineEntity : Engine.Entity, carriers : {Carrier}, distinguishTramFromRoad : boolean): boolean
Check if line is ok with any of provided carriers
ParameterslineEntity:Engine.Entity— line entitycarriers:{Carrier}— list of carrier typesdistinguishTramFromRoad:boolean— if tram should not be counted as road
boolean— true if the line is compatible with any of the specified carriers
UtilLine.supportsReservation🔗
function UtilLine.supportsReservation(lineEntity : Engine.Entity): boolean
Check if line supports reservations
ParameterslineEntity:Engine.Entity— line entity
boolean— whether line supports reservations
UtilLine.getLineIssues🔗
function UtilLine.getLineIssues(lineEntity : Engine.Entity, allIssues : boolean): {LineIssue}
Get line configuration problems for the line
ParameterslineEntity:Engine.Entity— line entityallIssues:boolean— whether to return all issues
{LineIssue}— all line issues of the line
UtilLine.getLinesIssues🔗
function UtilLine.getLinesIssues(playerEntity : Engine.Entity, allIssues : boolean): {Engine.Entity : {LineIssue}}
Get line configuration problems for the player lines
ParametersplayerEntity:Engine.Entity— player entityallIssues:boolean— whether to return all issues
{Engine.Entity : {LineIssue}}— all line issues of the lines belonging to the player
UtilLine.getFailedPathReason🔗
function UtilLine.getFailedPathReason(vehicle : Engine.Entity, line : Engine.Entity, fullLine : boolean): Failure
Get the reason for failed pathfinding search
Parametersvehicle:Engine.Entity— vehicle entityline:Engine.Entity— line entityfullLine:boolean— whether to check full line
Failure— failure reason
UtilLine.getNoRoadConnectionProblems🔗
function UtilLine.getNoRoadConnectionProblems(): {Engine.Entity}
Get nodes (construction entities) without any road connection
Returns{Engine.Entity}— list of node entities
UtilLogbook🔗
global record UtilLogbook
getLogValuePerYear: function(entity : Engine.Entity, logName : string): integer getLogValueMostRecent: function(entity : Engine.Entity, logName : string): integer getLogValueOldest: function(entity : Engine.Entity, logName : string): integer logValue: function(entity : Engine.Entity, logName : string, value : integer) getChart: function(logbookEntity : Engine.Entity, logNames : {string}, xMin : number, xMax : number, yMin : number, yMax : number, ChartConfig : ChartConfig): ChartResult getChartDiff: function(entity : Engine.Entity, logNames : {string}, config : ChartConfig): ChartResult end
UtilLogbook.getLogValuePerYear🔗
function UtilLogbook.getLogValuePerYear(entity : Engine.Entity, logName : string): integer
Get log value difference in the last year for cargo type
Parametersentity:Engine.Entity— entity with logbook componentlogName:string— log entry name
integer— log value difference in the last year for cargo type
UtilLogbook.getLogValueMostRecent🔗
function UtilLogbook.getLogValueMostRecent(entity : Engine.Entity, logName : string): integer
Get most recent log value
Parametersentity:Engine.Entity— entity with logbook componentlogName:string— log entry name
integer— log value difference in the last year for cargo type
UtilLogbook.getLogValueOldest🔗
function UtilLogbook.getLogValueOldest(entity : Engine.Entity, logName : string): integer
Get oldest log value
Parametersentity:Engine.Entity— entity with logbook componentlogName:string— log entry name
integer— oldest log value
UtilLogbook.logValue🔗
function UtilLogbook.logValue(entity : Engine.Entity, logName : string, value : integer)
Log a value
Parametersentity:Engine.Entity— entity with logbook componentlogName:string— log entry namevalue:integer— value to log
UtilLogbook.getChart🔗
function UtilLogbook.getChart(logbookEntity : Engine.Entity, logNames : {string}, xMin : number, xMax : number, yMin : number, yMax : number, ChartConfig : ChartConfig): ChartResult
Get chart for logbook
ParameterslogbookEntity:Engine.Entity— entity with logbook componentlogNames:{string}— log typesxMin:number— Starting value of x-axis (automatically reduced to the lowest x in the data)xMax:number— End value of x-axis (automatically increased to the highest x in the data)yMin:number— Starting value of y-axis (automatically reduced to the lowest y in the data)yMax:number— End value of y-axis (automatically increased to the highest y in the data)ChartConfig:ChartConfig— config of the chart to get
ChartResult— chart result
UtilLogbook.getChartDiff🔗
function UtilLogbook.getChartDiff(entity : Engine.Entity, logNames : {string}, config : ChartConfig): ChartResult
Get diff chart for logbooks
Parametersentity:Engine.Entity— entity with logbook componentlogNames:{string}— log typesconfig:ChartConfig— chart config
ChartResult— chart result
UtilMaintenance🔗
global record UtilMaintenance
calcMaintenanceForStationGroup: function(stationGroupEntity : Engine.Entity): integer calcMaintenanceForSubconstruction: function(subconstructionEntity : Engine.Entity): integer end
UtilMaintenance.calcMaintenanceForStationGroup🔗
function UtilMaintenance.calcMaintenanceForStationGroup(stationGroupEntity : Engine.Entity): integer
Calculate maintenance cost for a station group
ParametersstationGroupEntity:Engine.Entity— station group entity
integer— maintenance cost
UtilMaintenance.calcMaintenanceForSubconstruction🔗
function UtilMaintenance.calcMaintenanceForSubconstruction(subconstructionEntity : Engine.Entity): integer
Calculate maintenance cost for a subconstruction
ParameterssubconstructionEntity:Engine.Entity— subconstruction entity
integer— maintenance cost
UtilOctree🔗
global record UtilOctree
findEntitiesInCircle: function(center : Vec2f, radius : number, componentType : Engine.ComponentType): {Engine.Entity} findTransportNetworkNodesInCircle: function(center : Vec2f, radius : number): {NodeId} areWaypointsOnLine: function(waypoints : {Vec2f}, lineEntity : Engine.Entity, tolerance : number): boolean end
UtilOctree.findEntitiesInCircle🔗
function UtilOctree.findEntitiesInCircle(center : Vec2f, radius : number, componentType : Engine.ComponentType): {Engine.Entity}
Get entities in given radius and component type
Parameterscenter:Vec2f— center positionradius:number— search radiuscomponentType:Engine.ComponentType— component type
{Engine.Entity}— list of entities
UtilOctree.findTransportNetworkNodesInCircle🔗
function UtilOctree.findTransportNetworkNodesInCircle(center : Vec2f, radius : number): {NodeId}
Get transport network nodes in given radius
Parameterscenter:Vec2f— center positionradius:number— search radius
{NodeId}— list of node IDs
UtilOctree.areWaypointsOnLine🔗
function UtilOctree.areWaypointsOnLine(waypoints : {Vec2f}, lineEntity : Engine.Entity, tolerance : number): boolean
Check if waypoints are on a line
Parameterswaypoints:{Vec2f}— list of positionslineEntity:Engine.Entity— the line entitytolerance:number— distance tolerance
boolean— true if waypoints are on line
UtilParallelStrip🔗
global record UtilParallelStrip
getStripInfo: function(entity : Engine.Entity): StripInfo isBridge: function(entity : Engine.Entity): boolean isTunnel: function(entity : Engine.Entity): boolean end
UtilParallelStrip.StripInfo🔗
record UtilParallelStrip.StripInfo
carrier: Carrier edgeType: BaseEdgeType edgeTypeIndex: integer end
UtilParallelStrip.StripInfo.carrier🔗
UtilParallelStrip.StripInfo.carrier: Carrier
UtilParallelStrip.StripInfo.edgeType🔗
UtilParallelStrip.StripInfo.edgeType: BaseEdgeType
UtilParallelStrip.StripInfo.edgeTypeIndex🔗
UtilParallelStrip.StripInfo.edgeTypeIndex: integer
UtilParallelStrip.getStripInfo🔗
function UtilParallelStrip.getStripInfo(entity : Engine.Entity): StripInfo
Get strip information for a parallel strip entity
Parametersentity:Engine.Entity— parallel strip entity
StripInfo— strip information
UtilParallelStrip.isBridge🔗
function UtilParallelStrip.isBridge(entity : Engine.Entity): boolean
Check if entity is a bridge
Parametersentity:Engine.Entity— parallel strip entity
boolean— true if bridge
UtilParallelStrip.isTunnel🔗
function UtilParallelStrip.isTunnel(entity : Engine.Entity): boolean
Check if entity is a tunnel
Parametersentity:Engine.Entity— parallel strip entity
boolean— true if tunnel
UtilPathfinding🔗
global record UtilPathfinding
findPath: function(startingEdgesAndLengths : {EdgeIdDirAndLength}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}, maxLength : number): {{EdgeId, boolean}} findPathNodeToNode: function(startNodes : {NodeId}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}): {{EdgeId, boolean}} getTargetsByLandUse: function(): {<any type> : <any type>} findDubinsPath: function(p0 : Vec3f, t0 : Vec3f, p1 : Vec3f, t1 : Vec3f, turnRadius : number): {{EdgeGeometry, boolean}} endrecord EdgeIdDirAndLength
edgeId: EdgeId dir: boolean length: number new: function(EdgeId, boolean, number): EdgeIdDirAndLength end
UtilPathfinding.EdgeIdDirAndLength🔗
record UtilPathfinding.EdgeIdDirAndLength
edgeId: EdgeId dir: boolean length: number new: function(EdgeId, boolean, number): EdgeIdDirAndLength end
UtilPathfinding.EdgeIdDirAndLength.edgeId🔗
UtilPathfinding.EdgeIdDirAndLength.edgeId: EdgeId
Edge ID
UtilPathfinding.EdgeIdDirAndLength.dir🔗
UtilPathfinding.EdgeIdDirAndLength.dir: boolean
Direction
UtilPathfinding.EdgeIdDirAndLength.length🔗
UtilPathfinding.EdgeIdDirAndLength.length: number
Length
UtilPathfinding.EdgeIdDirAndLength.new🔗
function UtilPathfinding.EdgeIdDirAndLength.new(EdgeId, boolean, number): EdgeIdDirAndLength
Generates a new item.
ParametersEdgeIdbooleannumber
EdgeIdDirAndLength
UtilPathfinding.EdgeIdDir🔗
UtilPathfinding.EdgeIdDir.edgeId🔗
UtilPathfinding.EdgeIdDir.edgeId: EdgeId
Edge ID
UtilPathfinding.EdgeIdDir.dir🔗
UtilPathfinding.EdgeIdDir.dir: boolean
Direction
UtilPathfinding.EdgeIdDir.new🔗
function UtilPathfinding.EdgeIdDir.new(EdgeId, boolean): EdgeIdDir
Generates a new item.
ParametersEdgeIdboolean
EdgeIdDir
UtilPathfinding.findPath🔗
function UtilPathfinding.findPath(startingEdgesAndLengths : {EdgeIdDirAndLength}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}, maxLength : number): {{EdgeId, boolean}}
Find a path between starting edges and end destination nodes, using a given set of transport modes.
ParametersstartingEdgesAndLengths:{EdgeIdDirAndLength}— Vector of EdgeIdDirAndLengthdestinationNodes:{NodeId}— Vector of NodeIdtransportModeSet:{TransportMode}— Vector of TransportModemaxLength:number— maximum path length
{{EdgeId, boolean}}— a vector with pairs of EdgeId and bool values
UtilPathfinding.findPathNodeToNode🔗
function UtilPathfinding.findPathNodeToNode(startNodes : {NodeId}, destinationNodes : {NodeId}, transportModeSet : {TransportMode}): {{EdgeId, boolean}}
Find a path between starting nodes and end destination nodes, using a given set of transport modes.
ParametersstartNodes:{NodeId}— Vector of NodeIddestinationNodes:{NodeId}— Vector of NodeIdtransportModeSet:{TransportMode}— Vector of TransportMode
{{EdgeId, boolean}}— a vector with pairs of EdgeId and bool values
UtilPathfinding.getTargetsByLandUse🔗
function UtilPathfinding.getTargetsByLandUse(): {<any type> : <any type>}Returns
{<any type> : <any type>}
UtilPathfinding.findDubinsPath🔗
function UtilPathfinding.findDubinsPath(p0 : Vec3f, t0 : Vec3f, p1 : Vec3f, t1 : Vec3f, turnRadius : number): {{EdgeGeometry, boolean}}
Find a Dubins path between two points with directions
Parametersp0:Vec3f— first pointt0:Vec3f— tangent at p0p1:Vec3f— second pointt1:Vec3f— tangent at p1turnRadius:number— maximal turn radius
{{EdgeGeometry, boolean}}— A list of EdgeGeometries and direction
UtilProposal🔗
global record UtilProposal
makeProposalData: function(Proposal, Context): ProposalData makeIndustrySpawnProposal: function(industryTypeTag : string, townEntity : Engine.Entity): Proposal makeSegmentsRemoveProposal: function(segmentsToRemove : {Engine.Entity}): Proposal createProposalRemove: function(entity : Engine.Entity, context : Context): Proposal createProposalReplaceConstruction: function(entity : Engine.Entity, params : {<any type> : <any type>}, newResName : ResName): Proposal createIndustryProposal: function(seed : string, industryRectangle : IndustryInfo, context : Context): Proposal createBridgeOrTunnelProposal: function(parallelStripEntity : Engine.Entity, newTypeIndex : integer): Proposal createDoubleSlipSwitchProposal: function(entity : Engine.Entity, doubleSlipSwitch : boolean): Proposal createTrafficLightProposal: function(entity : Engine.Entity, trafficLightConfig : Engine.Component.TrafficLightConfig, trafficLightPreference : TrafficLightPreference): Proposal getBridgeOrTunnelRelatedRevisions: function(parallelStripEntity : Engine.Entity): {Engine.Entity : Engine.Revision} didBridgeOrTunnelRelatedRevisionsChange: function(parallelStripEntity : Engine.Entity, revisions : {Engine.Entity : Engine.Revision}): boolean makeReforestationProposal: function(seed : integer, numTilesToUpdate : integer, maxTreesPerTile : integer): Proposal refreshConstruction: function(entity : Engine.Entity, constructionFilepath : string): Proposal replaceSegment: function(entity : Engine.Entity, streetTemplate : ResName): Proposal checkProposalConnectsNodes: function(startNode : Engine.Entity, startEdge : Engine.Entity, targetNode : Engine.Entity, streetProposal : Proposal.StreetProposal, isApply : boolean, maxDepth : number): boolean makeIndustryExtendProposal: function(industry : Engine.Entity, trySlots : integer, numExtendSlots : integer): {Proposal, {integer}} createSubconstructionLotList: function(Proposal.Subconstruction, Mat4f): Engine.Component.LotList getConstructionArea: function(proposal : Proposal): number end
UtilProposal.makeProposalData🔗
function UtilProposal.makeProposalData(Proposal, Context): ProposalDataParameters
ProposalContext
ProposalData
UtilProposal.makeIndustrySpawnProposal🔗
function UtilProposal.makeIndustrySpawnProposal(industryTypeTag : string, townEntity : Engine.Entity): Proposal
Tries to generate a proposal for randomly placing an industry.
ParametersindustryTypeTag:string— The type of the industrytownEntity:Engine.Entity— the town designating the target voronoi cell (or nil to spawn anywhere in the world)
Proposal— the generated proposal, or nil
UtilProposal.makeSegmentsRemoveProposal🔗
function UtilProposal.makeSegmentsRemoveProposal(segmentsToRemove : {Engine.Entity}): Proposal
Makes a proposal to remove segments
ParameterssegmentsToRemove:{Engine.Entity}— list of segments to remove
Proposal— the generated proposal
UtilProposal.createProposalRemove🔗
function UtilProposal.createProposalRemove(entity : Engine.Entity, context : Context): Proposal
Tries to generate a proposal to remove a construction
Parametersentity:Engine.Entity— the entity to removecontext:Context— construction context
Proposal— the generated proposal, or nil
UtilProposal.createProposalReplaceConstruction🔗
function UtilProposal.createProposalReplaceConstruction(entity : Engine.Entity, params : {<any type> : <any type>}, newResName : ResName): Proposal
Replaces an existing construction with a new one
Parametersentity:Engine.Entity— the entity to replaceparams:{<any type> : <any type>}— parameters for the new constructionnewResName:ResName— resource name of the new construction (if nil, the same as the old one is used)
Proposal— the generated proposal, or nil
UtilProposal.createIndustryProposal🔗
function UtilProposal.createIndustryProposal(seed : string, industryRectangle : IndustryInfo, context : Context): Proposal
Tries to generate a proposal to build an industry
Parametersseed:string— random seedindustryRectangle:IndustryInfo— industry rectangle datacontext:Context— construction context
Proposal— the generated proposal, or nil
UtilProposal.createBridgeOrTunnelProposal🔗
function UtilProposal.createBridgeOrTunnelProposal(parallelStripEntity : Engine.Entity, newTypeIndex : integer): Proposal
Creates a bridge or tunnel proposal for changing the type of a parallel strip entity.
ParametersparallelStripEntity:Engine.Entity— parallel strip entitynewTypeIndex:integer— new resource type index for bridge or tunnel
Proposal— the generated proposal
UtilProposal.createDoubleSlipSwitchProposal🔗
function UtilProposal.createDoubleSlipSwitchProposal(entity : Engine.Entity, doubleSlipSwitch : boolean): Proposal
Creates a double slip switch proposal for changing the switch type of a base node configuration entity.
Parametersentity:Engine.Entity— base node entitydoubleSlipSwitch:boolean— double slip switch true to create double slip switch, false for single slip switch
Proposal
UtilProposal.createTrafficLightProposal🔗
function UtilProposal.createTrafficLightProposal(entity : Engine.Entity, trafficLightConfig : Engine.Component.TrafficLightConfig, trafficLightPreference : TrafficLightPreference): Proposal
Creates a proposal that changes the traffic light configuration of a base node
Parametersentity:Engine.Entity— base node entitytrafficLightConfig:Engine.Component.TrafficLightConfig— the configuration of traffic light, including phases and typetrafficLightPreference:TrafficLightPreference— whether a traffic light should be generated or not (or automtically decided)
Proposal
UtilProposal.getBridgeOrTunnelRelatedRevisions🔗
function UtilProposal.getBridgeOrTunnelRelatedRevisions(parallelStripEntity : Engine.Entity): {Engine.Entity : Engine.Revision}
Gets bridge or tunnel related revisions for a parallel strip entity.
ParametersparallelStripEntity:Engine.Entity— parallel strip entity
{Engine.Entity : Engine.Revision}— map of entity to revision
UtilProposal.didBridgeOrTunnelRelatedRevisionsChange🔗
function UtilProposal.didBridgeOrTunnelRelatedRevisionsChange(parallelStripEntity : Engine.Entity, revisions : {Engine.Entity : Engine.Revision}): boolean
Checks if bridge or tunnel related revisions changed for a parallel strip entity.
ParametersparallelStripEntity:Engine.Entity— parallel strip entityrevisions:{Engine.Entity : Engine.Revision}— map of entity to revision
boolean— true if any related revision changed
UtilProposal.makeReforestationProposal🔗
function UtilProposal.makeReforestationProposal(seed : integer, numTilesToUpdate : integer, maxTreesPerTile : integer): Proposal
Creates a reforestation proposal.
Parametersseed:integer— random seednumTilesToUpdate:integer— maximum number of tiles being updatedmaxTreesPerTile:integer— maximum number of trees planted per tile
Proposal— the generated proposal
UtilProposal.refreshConstruction🔗
function UtilProposal.refreshConstruction(entity : Engine.Entity, constructionFilepath : string): Proposal
Refreshes a construction. This returns a proposal that needs to be applied with a makeWorldBuildProposalCmd
entity:Engine.Entity— the entity with a construction to refreshconstructionFilepath:string— the construction to refresh the entity with
Proposal— a proposal for the refreshed construction
UtilProposal.replaceSegment🔗
function UtilProposal.replaceSegment(entity : Engine.Entity, streetTemplate : ResName): Proposal
Refreshes a street/track segment (base edge). This returns a proposal that needs to be applied with a makeWorldBuildProposalCmd
entity:Engine.Entity— the entity with a construction to refreshstreetTemplate:ResName— the street template file path to refresh the entity with (optionally). Use with caution.
Proposal— a proposal for the refreshed segment
UtilProposal.checkProposalConnectsNodes🔗
function UtilProposal.checkProposalConnectsNodes(startNode : Engine.Entity, startEdge : Engine.Entity, targetNode : Engine.Entity, streetProposal : Proposal.StreetProposal, isApply : boolean, maxDepth : number): boolean
Check if a street proposal connects the start node to the target node.
ParametersstartNode:Engine.Entity— the starting base node entitystartEdge:Engine.Entity— the starting base edge entitytargetNode:Engine.Entity— the target node entitystreetProposal:Proposal.StreetProposal— the street proposal to checkisApply:boolean— whether the proposal is being appliedmaxDepth:number— (optional) specify a maximum distance which is traversed in the network
boolean— true if the proposal connects the nodes
UtilProposal.makeIndustryExtendProposal🔗
function UtilProposal.makeIndustryExtendProposal(industry : Engine.Entity, trySlots : integer, numExtendSlots : integer): {Proposal, {integer}}
Create proposal to extend industry
Parametersindustry:Engine.Entity— industry entitytrySlots:integer— number of slots to try extending tonumExtendSlots:integer— number of slots to extend
{Proposal, {integer}}— the proposal and (if it is colliding) indices of colliding subconstructions
UtilProposal.createSubconstructionLotList🔗
function UtilProposal.createSubconstructionLotList(Proposal.Subconstruction, Mat4f): Engine.Component.LotListParameters
Proposal.SubconstructionMat4f
Engine.Component.LotList
UtilProposal.getConstructionArea🔗
function UtilProposal.getConstructionArea(proposal : Proposal): number
Calculate the area of new constructions in the proposal.
Parametersproposal:Proposal— the proposal to calculate the area for
number— the approximate area of new constructions in the proposal in square meters
UtilStation🔗
global record UtilStation
calculateStationUsage: function(station : Engine.Entity): StationUsage calculateStationTerminalUsage: function(station : Engine.Entity, terminalIndex : integer): UtilLine.TerminalCapacityUsagerecord StationUsage
totalUsed: integer overflow: integer poolCapacity: integer terminalCapacity: integer endcalculateStationGroupCargo: function(stationGroup : Engine.Entity, flatTerminalIndex : integer): StationGroupCapacityUsage isStationOfType: function(stationEntity : Engine.Entity, cargo : boolean): boolean findStationGroupWithOverlappingCatchmentOfDifferentCarriers: function(): {{Engine.Entity, Engine.Entity}} endrecord StationGroupCapacityUsage
equals: function(StationGroupCapacityUsage, StationGroupCapacityUsage): boolean capacity: integer waitingHallCapacity: integer used: integer overflow: boolean end
UtilStation.StationUsage🔗
record UtilStation.StationUsage
totalUsed: integer overflow: integer poolCapacity: integer terminalCapacity: integer end
UtilStation.StationUsage.totalUsed🔗
UtilStation.StationUsage.totalUsed: integer
UtilStation.StationUsage.overflow🔗
UtilStation.StationUsage.overflow: integer
UtilStation.StationUsage.poolCapacity🔗
UtilStation.StationUsage.poolCapacity: integer
UtilStation.StationUsage.terminalCapacity🔗
UtilStation.StationUsage.terminalCapacity: integer
UtilStation.calculateStationUsage🔗
function UtilStation.calculateStationUsage(station : Engine.Entity): StationUsage
Get station usages
Parametersstation:Engine.Entity— station entity
StationUsage— total usage, overflow and pool capacity for station
UtilStation.calculateStationTerminalUsage🔗
function UtilStation.calculateStationTerminalUsage(station : Engine.Entity, terminalIndex : integer): UtilLine.TerminalCapacityUsage
Get station terminal usages
Parametersstation:Engine.Entity— station entityterminalIndex:integer— terminal index
UtilLine.TerminalCapacityUsage— capacity and usage for a terminal (or the pool if terminal is -1)
UtilStation.StationGroupCapacityUsage🔗
record UtilStation.StationGroupCapacityUsage
equals: function(StationGroupCapacityUsage, StationGroupCapacityUsage): boolean capacity: integer waitingHallCapacity: integer used: integer overflow: boolean end
UtilStation.StationGroupCapacityUsage.equals🔗
function UtilStation.StationGroupCapacityUsage.equals(StationGroupCapacityUsage, StationGroupCapacityUsage): booleanParameters
StationGroupCapacityUsageStationGroupCapacityUsage
boolean
UtilStation.StationGroupCapacityUsage.capacity🔗
UtilStation.StationGroupCapacityUsage.capacity: integer
UtilStation.StationGroupCapacityUsage.waitingHallCapacity🔗
UtilStation.StationGroupCapacityUsage.waitingHallCapacity: integer
UtilStation.StationGroupCapacityUsage.used🔗
UtilStation.StationGroupCapacityUsage.used: integer
UtilStation.StationGroupCapacityUsage.overflow🔗
UtilStation.StationGroupCapacityUsage.overflow: boolean
UtilStation.calculateStationGroupCargo🔗
function UtilStation.calculateStationGroupCargo(stationGroup : Engine.Entity, flatTerminalIndex : integer): StationGroupCapacityUsage
Get station group cargo usage
ParametersstationGroup:Engine.Entity— station group entityflatTerminalIndex:integer— terminal index
StationGroupCapacityUsage— capacity and usage + overflow for a StationGroup
UtilStation.isStationOfType🔗
function UtilStation.isStationOfType(stationEntity : Engine.Entity, cargo : boolean): boolean
Check if station supports cargo/passengers
ParametersstationEntity:Engine.Entity— station entitycargo:boolean— check for cargo support or passenger support
boolean— whether station supports cargo/passengers
UtilStation.findStationGroupWithOverlappingCatchmentOfDifferentCarriers🔗
function UtilStation.findStationGroupWithOverlappingCatchmentOfDifferentCarriers(): {{Engine.Entity, Engine.Entity}}
Check for stations with overlapping catchment areas
Returns{{Engine.Entity, Engine.Entity}}— list of station group entity pairs
UtilStock🔗
global record UtilStock
getStockCargoTypes: function(stockListEntity : Engine.Entity, stockId : StockId): {CargoTypeId} getCargoTypeShippedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoShippedPerYear: function(stockListEntity : Engine.Entity): integer getCargoTypeDeliveredPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoDeliveredPerYear: function(stockListEntity : Engine.Entity): integer getCargoConsumedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoProducedPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoMaxProductionPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getCargoMaxConsumptionPerYear: function(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer getInputsOutputsFromRules: function(stockListEntity : Engine.Entity): {{CargoTypeId}, {CargoTypeId}} getCargoOutputPerYear: function(stockListEntity : Engine.Entity): integer getCargoLogValueDiffPerYear: function(stockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer getCargoLogPerYearForTarget: function(sourceStockListEntity : Engine.Entity, targetStockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer getCargoLogPerYearForTargetFilter: function(sourceStockListEntity : Engine.Entity, targetFilter : function(Engine.Entity) : boolean, logType : string, cargoTypeId : CargoTypeId): integer getProductionRating: function(stockListEntity : Engine.Entity): number getStockGroupsByTypeAndCargoTypes: function(stockListEntity : Engine.Entity, sortByType : boolean, showEmpty : boolean): {{StockListType, {StockId}, {CargoTypeId}, integer}} getStockListsWithThrownAwayCargo: function(): {Engine.Entity : integer} hasAnyCompatibleStock: function(entities : {Engine.Entity}, cargoTypeId : CargoTypeId, load : boolean): boolean getAdjustedDeliveryTime: function(cargoTypeId : CargoTypeId): integer isCargoTypeCurrentlyProduced: function(cargoTypeId : CargoTypeId): boolean end
UtilStock.getStockCargoTypes🔗
function UtilStock.getStockCargoTypes(stockListEntity : Engine.Entity, stockId : StockId): {CargoTypeId}
Get stock cargo types.
ParametersstockListEntity:Engine.Entity— entity containting the stocklist componentstockId:StockId— stock id
{CargoTypeId}— set of CargoTypeId
UtilStock.getCargoTypeShippedPerYear🔗
function UtilStock.getCargoTypeShippedPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo shipped per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo shipped per year
UtilStock.getCargoShippedPerYear🔗
function UtilStock.getCargoShippedPerYear(stockListEntity : Engine.Entity): integer
Get num cargo shipped per year
ParametersstockListEntity:Engine.Entity— list entity
integer— num cargo shipped per year
UtilStock.getCargoTypeDeliveredPerYear🔗
function UtilStock.getCargoTypeDeliveredPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo delivered per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo delivered per year
UtilStock.getCargoDeliveredPerYear🔗
function UtilStock.getCargoDeliveredPerYear(stockListEntity : Engine.Entity): integer
Get num cargo delivered (to entity) per year
ParametersstockListEntity:Engine.Entity— stock list entity
integer— num cargo delivered per year
UtilStock.getCargoConsumedPerYear🔗
function UtilStock.getCargoConsumedPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo consumed per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo consumed per year
UtilStock.getCargoProducedPerYear🔗
function UtilStock.getCargoProducedPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo produced per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo produced per year
UtilStock.getCargoMaxProductionPerYear🔗
function UtilStock.getCargoMaxProductionPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo max production per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo max production per year
UtilStock.getCargoMaxConsumptionPerYear🔗
function UtilStock.getCargoMaxConsumptionPerYear(stockListEntity : Engine.Entity, cargoTypeId : CargoTypeId): integer
Get num cargo max consumption per year
ParametersstockListEntity:Engine.Entity— list entitycargoTypeId:CargoTypeId— cargo type id
integer— num cargo max consumption per year
UtilStock.getInputsOutputsFromRules🔗
function UtilStock.getInputsOutputsFromRules(stockListEntity : Engine.Entity): {{CargoTypeId}, {CargoTypeId}}
Get inputs and outputs from rules
ParametersstockListEntity:Engine.Entity— list entity
{{CargoTypeId}, {CargoTypeId}}— inputs and outputs cargo types
UtilStock.getCargoOutputPerYear🔗
function UtilStock.getCargoOutputPerYear(stockListEntity : Engine.Entity): integer
Get the total number of cargo produced per year
ParametersstockListEntity:Engine.Entity— list entity
integer— num cargo produced per year
UtilStock.getCargoLogValueDiffPerYear🔗
function UtilStock.getCargoLogValueDiffPerYear(stockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer
Get cargo log value in the last year for cargo type
ParametersstockListEntity:Engine.Entity— stock list entitylogType:string— the logbook typecargoTypeId:CargoTypeId— cargo type
integer— cargo log value difference in the last year for cargo type
UtilStock.getCargoLogPerYearForTarget🔗
function UtilStock.getCargoLogPerYearForTarget(sourceStockListEntity : Engine.Entity, targetStockListEntity : Engine.Entity, logType : string, cargoTypeId : CargoTypeId): integer
Get num cargo log per year
ParameterssourceStockListEntity:Engine.Entity— stock list entitytargetStockListEntity:Engine.Entity— stock list entitylogType:string— the logbook typecargoTypeId:CargoTypeId— the cargo type
integer— num cargo shipped per year
UtilStock.getCargoLogPerYearForTargetFilter🔗
function UtilStock.getCargoLogPerYearForTargetFilter(sourceStockListEntity : Engine.Entity, targetFilter : function(Engine.Entity) : boolean, logType : string, cargoTypeId : CargoTypeId): integer
Get num cargo log per year
ParameterssourceStockListEntity:Engine.Entity— stock list entitytargetFilter:function(Engine.Entity): boolean— filter function to filter target entitieslogType:string— the logbook typecargoTypeId:CargoTypeId— the cargo type
integer— num cargo shipped per year
UtilStock.getProductionRating🔗
function UtilStock.getProductionRating(stockListEntity : Engine.Entity): number
Get stocklist production rating
ParametersstockListEntity:Engine.Entity— list entity
number— production rating
UtilStock.getStockGroupsByTypeAndCargoTypes🔗
function UtilStock.getStockGroupsByTypeAndCargoTypes(stockListEntity : Engine.Entity, sortByType : boolean, showEmpty : boolean): {{StockListType, {StockId}, {CargoTypeId}, integer}}
Get stock groups by type and cargo types
ParametersstockListEntity:Engine.Entity— list entitysortByType:boolean— sort by typeshowEmpty:boolean— show empty groups
{{StockListType, {StockId}, {CargoTypeId}, integer}}— {StockListType, {StockId}, {CargoTypeId}, int} list of stock list type, stock ids, cargo types and count per group
UtilStock.getStockListsWithThrownAwayCargo🔗
function UtilStock.getStockListsWithThrownAwayCargo(): {Engine.Entity : integer}
Get stock lists with thrown away cargo
Returns{Engine.Entity : integer}— map of entity to amount thrown away
UtilStock.hasAnyCompatibleStock🔗
function UtilStock.hasAnyCompatibleStock(entities : {Engine.Entity}, cargoTypeId : CargoTypeId, load : boolean): boolean
Check if any stock is compatible
Parametersentities:{Engine.Entity}— list of entities to checkcargoTypeId:CargoTypeId— cargo typeload:boolean— whether to check for loading/input (true) or unloading/output (false)
boolean— true if any stock is compatible
UtilStock.getAdjustedDeliveryTime🔗
function UtilStock.getAdjustedDeliveryTime(cargoTypeId : CargoTypeId): integer
Get adjusted delivery time
ParameterscargoTypeId:CargoTypeId— cargo type
integer— adjusted delivery time in seconds
UtilStock.isCargoTypeCurrentlyProduced🔗
function UtilStock.isCargoTypeCurrentlyProduced(cargoTypeId : CargoTypeId): boolean
Check if cargo type is currently produced
ParameterscargoTypeId:CargoTypeId— cargo type
boolean— true if cargo type is currently produced
UtilTown🔗
global record UtilTown
record TownReachability
commercialPrivate: integer commercialPublic: integer industrialPrivate: integer industrialPublic: integer endcomputeWeightedTargetTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} computeUnweightedTargetTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} computeActualTownBuildingCapacityPerType: function(townEntity : Engine.Entity): {{integer, integer, integer, integer}} getLandUse2CargoTypes: function(): {LandUseType : {CargoTypeId}} getTownReachability: function(townEntity : Engine.Entity): TownReachability getTownEmission: function(townEntity : Engine.Entity): TownEmission getTownEmissionDB: function(townEntity : Engine.Entity): TownEmission getTownCapacityUsage: function(townEntity : Engine.Entity): {TownCapacityUsage} getTownHappinessStats: function(townEntity : Engine.Entity, numTopLines : integer): TownHappinessStats getTownDeliveriesStats: function(townEntity : Engine.Entity, interval : integer, perLine : boolean, perCargoType : boolean): {Engine.Entity : {CargoTypeId : {integer, integer}}} getTownStockCargo: function(townEntity : Engine.Entity): {CargoTypeId : {integer, integer}} getTerrainBrushVolumeImpact: function(proposal : Proposal): {Engine.Entity : {number, number}} getTerrainAlignmentImpact: function(proposalData : ProposalData): {Engine.Entity : {number, number}} getAutoRemovalEntityImpact: function(proposalData : ProposalData): {Engine.Entity : {number, number}} getTownNoisePerDistrict: function(townEntity : Engine.Entity, landUseTypes : {LandUseType}): {LandUseType : {number, integer}} getImpactFromDistance: function(distance : number): number computeTownsTrafficSpeedMap: function(samplesCoefficient : number): {Engine.Entity : {number, {integer}}} getTownProblems: function(): {{{Engine.Entity}, TownProblem}} isNeighbourTown: function(townEntity1 : Engine.Entity, townEntity2 : Engine.Entity): boolean getClosestTown: function(position : Vec3f): Engine.Entity getRandomTownPosition: function(townEntity : Engine.Entity, seed : integer): Vec2f isLineStoppingInTown: function(lineEntity : Engine.Entity, townEntity : Engine.Entity): boolean getTownLineUsage: function(townEntity : Engine.Entity): number getSourceToDestinationCount: function(townEntitiy : Engine.Entity, destinationIsTownMap : {Engine.Entity : boolean}, selectLandUse : integer): {Engine.Entity : DestinationUseCount} getTownDistrictCenter: function(entity : Engine.Entity, landUseTypes : LandUseType): Vec3f endrecord TownHappinessStats
travellingInside: {integer, integer} travellingTo: ByResident travellingFrom: ByResident atBuilding: {integer, integer} byCar: {integer, integer} walking: {integer, integer} byLine: {{Engine.Entity, ByResident}} end
UtilTown.TownReachability🔗
record UtilTown.TownReachability
commercialPrivate: integer commercialPublic: integer industrialPrivate: integer industrialPublic: integer end
UtilTown.TownReachability.commercialPrivate🔗
UtilTown.TownReachability.commercialPrivate: integer
UtilTown.TownReachability.commercialPublic🔗
UtilTown.TownReachability.commercialPublic: integer
UtilTown.TownReachability.industrialPrivate🔗
UtilTown.TownReachability.industrialPrivate: integer
UtilTown.TownReachability.industrialPublic🔗
UtilTown.TownReachability.industrialPublic: integer
UtilTown.TownCapacityUsage🔗
UtilTown.TownCapacityUsage.used🔗
UtilTown.TownCapacityUsage.used: integer
UtilTown.TownCapacityUsage.capacity🔗
UtilTown.TownCapacityUsage.capacity: integer
UtilTown.TownEmission🔗
UtilTown.TownEmission.noise🔗
UtilTown.TownEmission.noise: number
UtilTown.TownEmission.pollution🔗
UtilTown.TownEmission.pollution: number
UtilTown.TownEmission.areaSquareKm🔗
UtilTown.TownEmission.areaSquareKm: number
UtilTown.DestinationUseCount🔗
UtilTown.DestinationUseCount.count🔗
UtilTown.DestinationUseCount.count: integer
UtilTown.DestinationUseCount.linesUseCount🔗
UtilTown.DestinationUseCount.linesUseCount: integer
UtilTown.TownHappinessStats🔗
record UtilTown.TownHappinessStats
travellingInside: {integer, integer} travellingTo: ByResident travellingFrom: ByResident atBuilding: {integer, integer} byCar: {integer, integer} walking: {integer, integer} byLine: {{Engine.Entity, ByResident}} end
UtilTown.TownHappinessStats.ByResident🔗
record UtilTown.TownHappinessStats.ByResident
resident: {integer, integer} nonResident: {integer, integer} end
UtilTown.TownHappinessStats.ByResident.resident🔗
UtilTown.TownHappinessStats.ByResident.resident: {integer, integer}
UtilTown.TownHappinessStats.ByResident.nonResident🔗
UtilTown.TownHappinessStats.ByResident.nonResident: {integer, integer}
UtilTown.TownHappinessStats.travellingInside🔗
UtilTown.TownHappinessStats.travellingInside: {integer, integer}
UtilTown.TownHappinessStats.travellingTo🔗
UtilTown.TownHappinessStats.travellingTo: ByResident
UtilTown.TownHappinessStats.travellingFrom🔗
UtilTown.TownHappinessStats.travellingFrom: ByResident
UtilTown.TownHappinessStats.atBuilding🔗
UtilTown.TownHappinessStats.atBuilding: {integer, integer}
UtilTown.TownHappinessStats.byCar🔗
UtilTown.TownHappinessStats.byCar: {integer, integer}
UtilTown.TownHappinessStats.walking🔗
UtilTown.TownHappinessStats.walking: {integer, integer}
UtilTown.TownHappinessStats.byLine🔗
UtilTown.TownHappinessStats.byLine: {{Engine.Entity, ByResident}}
UtilTown.computeWeightedTargetTownBuildingCapacityPerType🔗
function UtilTown.computeWeightedTargetTownBuildingCapacityPerType(townEntity : Engine.Entity): {{integer, integer, integer, integer}}
Get weighted target level to capacities distribution for each land use type for the town
ParameterstownEntity:Engine.Entity— town entity
{{integer, integer, integer, integer}}— level to capacities distribution
UtilTown.computeUnweightedTargetTownBuildingCapacityPerType🔗
function UtilTown.computeUnweightedTargetTownBuildingCapacityPerType(townEntity : Engine.Entity): {{integer, integer, integer, integer}}
Get unweighted target level to capacities distribution for each land use type for the town
ParameterstownEntity:Engine.Entity— town entity
{{integer, integer, integer, integer}}— level to capacities distribution
UtilTown.computeActualTownBuildingCapacityPerType🔗
function UtilTown.computeActualTownBuildingCapacityPerType(townEntity : Engine.Entity): {{integer, integer, integer, integer}}
Get actual level to capacities distribution for each land use type for the town
ParameterstownEntity:Engine.Entity— town entity
{{integer, integer, integer, integer}}— level to capacities distribution
UtilTown.getLandUse2CargoTypes🔗
function UtilTown.getLandUse2CargoTypes(): {LandUseType : {CargoTypeId}}
Get town available cargo needs
Returns{LandUseType : {CargoTypeId}}— map of land use to cargo types
UtilTown.getTownReachability🔗
function UtilTown.getTownReachability(townEntity : Engine.Entity): TownReachability
Get town reachability
ParameterstownEntity:Engine.Entity— town entity
TownReachability— reachability data
UtilTown.getTownEmission🔗
function UtilTown.getTownEmission(townEntity : Engine.Entity): TownEmission
Get town emission in power
ParameterstownEntity:Engine.Entity— town entity
TownEmission— emission data in power
UtilTown.getTownEmissionDB🔗
function UtilTown.getTownEmissionDB(townEntity : Engine.Entity): TownEmission
Get town emission in decibel
ParameterstownEntity:Engine.Entity— town entity
TownEmission— emission data in decibel
UtilTown.getTownCapacityUsage🔗
function UtilTown.getTownCapacityUsage(townEntity : Engine.Entity): {TownCapacityUsage}
Get town capacity usage
ParameterstownEntity:Engine.Entity— town entity
{TownCapacityUsage}— capacity usage per land use type
UtilTown.getTownHappinessStats🔗
function UtilTown.getTownHappinessStats(townEntity : Engine.Entity, numTopLines : integer): TownHappinessStats
Get number of unhappy people travelling by lines to or from the town
ParameterstownEntity:Engine.Entity— town entitynumTopLines:integer— number of top lines to consider for the stat
TownHappinessStats— number of unhappy and total people travelling by lines
UtilTown.getTownDeliveriesStats🔗
function UtilTown.getTownDeliveriesStats(townEntity : Engine.Entity, interval : integer, perLine : boolean, perCargoType : boolean): {Engine.Entity : {CargoTypeId : {integer, integer}}}
Get town cargo deliveries stats
ParameterstownEntity:Engine.Entity— town entityinterval:integer— time interval in miliseconds for the statsperLine:boolean— whether to get stats per lineperCargoType:boolean— whether to get stats per cargo type
{Engine.Entity : {CargoTypeId : {integer, integer}}}— delivery stats
UtilTown.getTownStockCargo🔗
function UtilTown.getTownStockCargo(townEntity : Engine.Entity): {CargoTypeId : {integer, integer}}
Obtains information about towns and cargo
ParameterstownEntity:Engine.Entity— the entity of the town
{CargoTypeId : {integer, integer}}— map of cargo type to stock and capacity
UtilTown.getTerrainBrushVolumeImpact🔗
function UtilTown.getTerrainBrushVolumeImpact(proposal : Proposal): {Engine.Entity : {number, number}}
Get the impact of using terrain brush on towns reputation
Parametersproposal:Proposal— the terrain change proposal
{Engine.Entity : {number, number}}— the impact change for volume added and volume removed for each town
UtilTown.getTerrainAlignmentImpact🔗
function UtilTown.getTerrainAlignmentImpact(proposalData : ProposalData): {Engine.Entity : {number, number}}
Get the terrain alignment impact on towns reputation
ParametersproposalData:ProposalData— the proposal data
{Engine.Entity : {number, number}}— the impact change for volume added and volume removed for each town
UtilTown.getAutoRemovalEntityImpact🔗
function UtilTown.getAutoRemovalEntityImpact(proposalData : ProposalData): {Engine.Entity : {number, number}}
Get the impact from auto removal of trees and rocks on towns reputation
ParametersproposalData:ProposalData— the proposal data
{Engine.Entity : {number, number}}— the impact change for removed trees and rocks for each town
UtilTown.getTownNoisePerDistrict🔗
function UtilTown.getTownNoisePerDistrict(townEntity : Engine.Entity, landUseTypes : {LandUseType}): {LandUseType : {number, integer}}
Get town noise per district
ParameterstownEntity:Engine.Entity— town entitylandUseTypes:{LandUseType}— land use types to check
{LandUseType : {number, integer}}— average noise and affected capacity per district
UtilTown.getImpactFromDistance🔗
function UtilTown.getImpactFromDistance(distance : number): number
Get the impact for reputation the distance has for towns
Parametersdistance:number— distance value
number— the impact from the distance
UtilTown.computeTownsTrafficSpeedMap🔗
function UtilTown.computeTownsTrafficSpeedMap(samplesCoefficient : number): {Engine.Entity : {number, {integer}}}
Get traffic speed for all towns
ParameterssamplesCoefficient:number— coefficient to adjust the number of samples of streets used for traffic rating calculation
{Engine.Entity : {number, {integer}}}— traffic speed and number of streets per congestion level
UtilTown.getTownProblems🔗
function UtilTown.getTownProblems(): {{{Engine.Entity}, TownProblem}}
Get towns with problems
Returns{{{Engine.Entity}, TownProblem}}— town entity and problem
UtilTown.isNeighbourTown🔗
function UtilTown.isNeighbourTown(townEntity1 : Engine.Entity, townEntity2 : Engine.Entity): boolean
Check if town is neighbor town
ParameterstownEntity1:Engine.Entity— town entitytownEntity2:Engine.Entity— town entity
boolean— whether town is neighbor
UtilTown.getClosestTown🔗
function UtilTown.getClosestTown(position : Vec3f): Engine.Entity
Get closest town to position
Parametersposition:Vec3f— world position
Engine.Entity— closest town entity
UtilTown.getRandomTownPosition🔗
function UtilTown.getRandomTownPosition(townEntity : Engine.Entity, seed : integer): Vec2f
Get a random 2d point inside the voronoi cell of the town
ParameterstownEntity:Engine.Entity— the town in which to searchseed:integer— a random seed for the generation
Vec2f— a point inside the town voronoi cell
UtilTown.isLineStoppingInTown🔗
function UtilTown.isLineStoppingInTown(lineEntity : Engine.Entity, townEntity : Engine.Entity): boolean
Check if Line has at least 1 stop in the town's area
ParameterslineEntity:Engine.Entity— line entitytownEntity:Engine.Entity— town entity
boolean— whether line stops in town
UtilTown.getTownLineUsage🔗
function UtilTown.getTownLineUsage(townEntity : Engine.Entity): number
Get town line usage
ParameterstownEntity:Engine.Entity— town entity
number— fraction of people using lines in the town
UtilTown.getSourceToDestinationCount🔗
function UtilTown.getSourceToDestinationCount(townEntitiy : Engine.Entity, destinationIsTownMap : {Engine.Entity : boolean}, selectLandUse : integer): {Engine.Entity : DestinationUseCount}
Get town destinations table content (work, shop and line usage info)
ParameterstownEntitiy:Engine.Entity— town entitydestinationIsTownMap:{Engine.Entity : boolean}— map of entity to isTown (destinations of town)selectLandUse:integer— 0 (Usage), 1 (Shopping), 2 (Work)
{Engine.Entity : DestinationUseCount}— destination use counts
UtilTown.getTownDistrictCenter🔗
function UtilTown.getTownDistrictCenter(entity : Engine.Entity, landUseTypes : LandUseType): Vec3f
Get the district center of the town entity
Parametersentity:Engine.Entity— town entitylandUseTypes:LandUseType— land use types to check
Vec3f— destination use counts
UtilTransport🔗
global record UtilTransport
calcPosition: function(eg : EdgeGeometry, t : number): Vec3f calcPositionAndDirection: function(eg : EdgeGeometry, t : number, forward : boolean): {Vec3f} transportModesToCarriers: function(transportModes : {TransportMode}): {Carrier} getStartPort: function(edge : {EdgeId, boolean}): PortId getEndPort: function(edge : {EdgeId, boolean}): PortId isPortLocked: function(port : integer): boolean end
UtilTransport.calcPosition🔗
function UtilTransport.calcPosition(eg : EdgeGeometry, t : number): Vec3f
Calc position along a transport edge.
Parameterseg:EdgeGeometry— edge geometryt:number— progress along the edge [ 0, 1]
Vec3f— position on the edge
UtilTransport.calcPositionAndDirection🔗
function UtilTransport.calcPositionAndDirection(eg : EdgeGeometry, t : number, forward : boolean): {Vec3f}
Calc position along a transport edge.
Parameterseg:EdgeGeometry— edge geometryt:number— progress along the edge [ 0, 1]forward:boolean— optional bool (forward or backward t -> t - 1.0)
{Vec3f}— position on the edge and direction
UtilTransport.transportModesToCarriers🔗
function UtilTransport.transportModesToCarriers(transportModes : {TransportMode}): {Carrier}
Transform list of transport modes to a vector of carriers.
ParameterstransportModes:{TransportMode}— list of transport modes
{Carrier}— carriers for a given set of transport modes
UtilTransport.getStartPort🔗
function UtilTransport.getStartPort(edge : {EdgeId, boolean}): PortId
Obtains the start connection of this edge.
Parametersedge:{EdgeId, boolean}— the edge with direction
PortId— PortId at the edge's start
UtilTransport.getEndPort🔗
function UtilTransport.getEndPort(edge : {EdgeId, boolean}): PortId
Obtains the end connection of this edge.
Parametersedge:{EdgeId, boolean}— the edge with direction
PortId— PortId at the edge's end
UtilTransport.isPortLocked🔗
function UtilTransport.isPortLocked(port : integer): boolean
Check if a port is locked.
Parametersport:integer— the port
boolean— true if the port is locked, false otherwise
UtilVehicle🔗
global record UtilVehicle
findBestLineAndDepotForVehicle: function(vehicleEntity : Engine.Entity): {Engine.Entity, Engine.Entity} findBestDepotForLine: function(carrier : Carrier, transportModes : {TransportMode}, lineEntity : Engine.Entity, position : Vec3f): Engine.Entity getSpeed: function(vehicleEntity : Engine.Entity): number getPosition: function(vehicleEntity : Engine.Entity): Vec3f calcPathPosData: function(vehicleEntity : Engine.Entity): PathPosData getDirection: function(vehicleEntity : Engine.Entity): Vec3f getVehiclesByCarrier: function(carrier : Carrier): {Engine.Entity} getVehicles: function(): {Engine.Entity} getRunningCost: function(vehicleEntity : Engine.Entity): number getDepreciatedValue: function(vehicleEntity : Engine.Entity): integer getPartPrice: function(part : TransportVehiclePart): integer getLength: function(modelAsset : Model): number getAllCargoForCargoTypeSet: function(cargoTypeSet : CargoTypeSet): {CargoTypeId} getVehicleLoadedCargoTypes: function(vehicleEntity : Engine.Entity): {CargoTypeId} getVehicleProblems: function(): {{{Engine.Entity}, VehicleProblem}} getMaintenanceEmissionPenalty: function(maintenanceState : number): number getMaintenanceComfortPenalty: function(maintenanceState : number): number getMaintenanceTopSpeedPenalty: function(topSpeedMaintenanceFactorPenaltyPerLevel : number, maintenanceState : number): number getMaintenanceRunningCostPenalty: function(maintenanceState : number): number getVehicleType: function(vehicleEntity : Engine.Entity): integer getVehicleCapacities: function(vehicleEntity : Engine.Entity): {integer} getVehicleUnsetCapacities: function(vehicleEntity : Engine.Entity): {{integer}} end
UtilVehicle.findBestLineAndDepotForVehicle🔗
function UtilVehicle.findBestLineAndDepotForVehicle(vehicleEntity : Engine.Entity): {Engine.Entity, Engine.Entity}
Searches the best line and depot for the vehicle
ParametersvehicleEntity:Engine.Entity— the vehicle for which to search the best line and depot
{Engine.Entity, Engine.Entity}— line and depot entities, if found
UtilVehicle.findBestDepotForLine🔗
function UtilVehicle.findBestDepotForLine(carrier : Carrier, transportModes : {TransportMode}, lineEntity : Engine.Entity, position : Vec3f): Engine.Entity
Searches the best depot for the line or position (in case of air vehicles)
Parameterscarrier:Carrier— the carrier to search fortransportModes:{TransportMode}— the transport modes to check for connectivitylineEntity:Engine.Entity— the line to search the depot forposition:Vec3f— the position from which to search (air/water vehicles only)
Engine.Entity— best depot, if any
UtilVehicle.getSpeed🔗
function UtilVehicle.getSpeed(vehicleEntity : Engine.Entity): number
Get speed of the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
number— speed
UtilVehicle.getPosition🔗
function UtilVehicle.getPosition(vehicleEntity : Engine.Entity): Vec3f
Get the position of the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
Vec3f— world position
UtilVehicle.calcPathPosData🔗
function UtilVehicle.calcPathPosData(vehicleEntity : Engine.Entity): PathPosData
Get the position, direction and curvature of the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
PathPosData— position and direction information for the vehicle
UtilVehicle.getDirection🔗
function UtilVehicle.getDirection(vehicleEntity : Engine.Entity): Vec3f
Get the direction of the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
Vec3f— direction
UtilVehicle.getVehiclesByCarrier🔗
function UtilVehicle.getVehiclesByCarrier(carrier : Carrier): {Engine.Entity}
Gets all vehicles using by a given carrier
Parameterscarrier:Carrier— kind of carrier
{Engine.Entity}— list of vehicle entities
UtilVehicle.getVehicles🔗
function UtilVehicle.getVehicles(): {Engine.Entity}
Gets all vehicles
Returns{Engine.Entity}— list of vehicle entities
UtilVehicle.getRunningCost🔗
function UtilVehicle.getRunningCost(vehicleEntity : Engine.Entity): number
Get running cost of the vehicle per year
ParametersvehicleEntity:Engine.Entity— vehicle entity
number— running cost
UtilVehicle.getDepreciatedValue🔗
function UtilVehicle.getDepreciatedValue(vehicleEntity : Engine.Entity): integer
Get vehicle depreciated value
ParametersvehicleEntity:Engine.Entity— vehicle entity
integer— depreciated value
UtilVehicle.getPartPrice🔗
function UtilVehicle.getPartPrice(part : TransportVehiclePart): integer
Get vehicle part value
Parameterspart:TransportVehiclePart— transport vehicle part
integer— value
UtilVehicle.getLength🔗
function UtilVehicle.getLength(modelAsset : Model): number
Get length of the vehicle model
ParametersmodelAsset:Model— model asset
number— length
UtilVehicle.getAllCargoForCargoTypeSet🔗
function UtilVehicle.getAllCargoForCargoTypeSet(cargoTypeSet : CargoTypeSet): {CargoTypeId}
Get cargo in CargoTypeSet
ParameterscargoTypeSet:CargoTypeSet— cargo type set
{CargoTypeId}— CargoTypeId in the set
UtilVehicle.getVehicleLoadedCargoTypes🔗
function UtilVehicle.getVehicleLoadedCargoTypes(vehicleEntity : Engine.Entity): {CargoTypeId}
Get list of cargo types loaded in the vehicle
ParametersvehicleEntity:Engine.Entity— vehicle entity
{CargoTypeId}— list of cargo types loaded in the vehicle
UtilVehicle.getVehicleProblems🔗
function UtilVehicle.getVehicleProblems(): {{{Engine.Entity}, VehicleProblem}}
Get vehicles with problems
Returns{{{Engine.Entity}, VehicleProblem}}— vehicle entity and problem
UtilVehicle.getMaintenanceEmissionPenalty🔗
function UtilVehicle.getMaintenanceEmissionPenalty(maintenanceState : number): number
Get vehicle emission penalty in percent
ParametersmaintenanceState:number— maintenance state
number— emission penalty in percent
UtilVehicle.getMaintenanceComfortPenalty🔗
function UtilVehicle.getMaintenanceComfortPenalty(maintenanceState : number): number
Get vehicle comfort penalty in percent
ParametersmaintenanceState:number— maintenance state
number— comfort penalty in percent
UtilVehicle.getMaintenanceTopSpeedPenalty🔗
function UtilVehicle.getMaintenanceTopSpeedPenalty(topSpeedMaintenanceFactorPenaltyPerLevel : number, maintenanceState : number): number
Get vehicle top speed penalty in percent
ParameterstopSpeedMaintenanceFactorPenaltyPerLevel:number— penalty factor per levelmaintenanceState:number— maintenance state
number— top speed penalty in percent
UtilVehicle.getMaintenanceRunningCostPenalty🔗
function UtilVehicle.getMaintenanceRunningCostPenalty(maintenanceState : number): number
Get vehicle running cost penalty in percent
ParametersmaintenanceState:number— maintenance state
number— running cost penalty in percent
UtilVehicle.getVehicleType🔗
function UtilVehicle.getVehicleType(vehicleEntity : Engine.Entity): integer
Get the vehicle's type
ParametersvehicleEntity:Engine.Entity— vehicle entity
integer— vehicle type
UtilVehicle.getVehicleCapacities🔗
function UtilVehicle.getVehicleCapacities(vehicleEntity : Engine.Entity): {integer}
Get vehicle capacities
ParametersvehicleEntity:Engine.Entity— vehicle entity
{integer}— vehicle capacities
UtilVehicle.getVehicleUnsetCapacities🔗
function UtilVehicle.getVehicleUnsetCapacities(vehicleEntity : Engine.Entity): {{integer}}
Get vehicle unset capacities
ParametersvehicleEntity:Engine.Entity— vehicle entity
{{integer}}— vehicle unset capacities for each unset capacity