[h1]Entities[/h1]
Everything in the game of Transport Fever is an entity. This includes assets, industries, stations, vehicles, and even lines. To fetch information about them from the game interface, you can use the following methods:
- game.interface.getEntities({pos, radius}, {type, includeData})
- game.interface.getTowns()
- game.interface.getLines({stationGroup})
- game.interface.getVehicles({line, depot, carrier})
- game.interface.getStations({town, townRadius, carrier})
- game.interface.getDepots()
All of these functions return an id, which is an integer. You can get the data behind an ID with the function game.interface.getEntity(id). Depending on which type of entity is returned, the data structures are different. game.interface.getEntities allows you to instantly fetch the data together with the ID. Also, this function allows you to specify an entity type filter.
ASSET_GROUP
Note: Assets with valid groundFaces are by definition a construction and will appear in the list CONSTRUCTION instead of ASSET_GROUP.
{
["count"] = 2, --total number of models used in this asset
["autoRemove"] = true,
["position"] = {[1] = -2264.9399414063, [2] = -3863.5788574219, [3] = 146.23081970215},
["type"] = "ASSET_GROUP",
["id"] = 121,
["models"] = {
["tree/easternwhitepine_rt_2.mdl"] = 2, --number of instances of this mdl in the asset
}
}
CONSTRUCTION
{
["baseNodes"] = { --these ids don't show up anywhere
[1] = 1605,
[2] = 1618,
[3] = 1636,
[4] = 1647,
[5] = 1865,
[6] = 2112,
[7] = 2322,
[8] = 2611
},
["transf"] = {
[1] = 0.41026905179024,
[2] = -0.9119645357132,
[3] = 0,
[4] = 0,
[5] = 0.9119645357132,
[6] = 0.41026905179024,
[7] = 0,
[8] = 0,
[9] = 0,
[10] = 0,
[11] = 1,
[12] = 0,
[13] = -2280.1704101563, -- \
[14] = -648.66674804688, -- | X-Y-Z Position of the constructions origin (differs from position!)
[15] = 107.94593048096, -- /
[16] = 1
},
["params"] = { --all params with which the construction was built
["productionLevel"] = 0,
["seed"] = -17799 --Auto-incrementing, unique parameter which appears on every construction.
},
["name"] = "Würzburg Wald", --Set by the game. Assets with ground faces have the name "no name".
["type"] = "CONSTRUCTION",
["particleSystems"] = {
[1] = 16621 --these ids don't show up anywhere
},
["stations"] = {
[1] = 15095 --STATION
},
["simBuildings"] = {
[1] = 4331 --SIM_BUILDING
},
["baseEdges"] = { --these ids don't show up anywhere
[1] = 3257,
[2] = 2870,
[3] = 2772,
[4] = 3434,
[5] = 2787,
[6] = 3235,
[7] = 2793,
[8] = 3164,
[9] = 3019
},
["townBuildings"] =
{
[1] = 24067 --these ids don't show up anywhere
},
["position"] = { -- X-Y-Z Position of the center of the constructions bounding box
[1] = -2280.1704101563,
[2] = -648.66674804688,
[3] = 114.10034942627
},
["id"] = 4256,
["dateBuilt"] = {["year"] = 1900, ["day"] = 1, ["month"] = 4},
["fileName"] = "industry/forest.con",
["depots"] = {
[1] = 13945 --VEHICLE_DEPOT
}
}
Display More
LINE
Note: lines can't be fetched with the game.interface.getEntities-method. Use game.interface.getLines instead.
{
["id"] = 19159,
["itemsTransported"] = {
["_sum"] = 13,
["_lastYear"] = {
["_sum"] = 0,
["CRUDE"] = 0,
} ,
["_lastMonth"] = {
["_sum"] = 0,
["CRUDE"] = 0,
},
["CRUDE"] = 13,} ,
["name"] = "Freightline",
["stops"] = { --STATION_GROUP
[1] = 19059,
[2] = 19119,} ,
["type"] = "LINE",
}
Display More
SIM_BUILDING
{
["nextUpgradeInMonths"] = 8,
["nextDowngradeInMonths"] = 8,
["position"] = {
[1] = 974.76605224609,
[2] = -3432.8427734375,
[3] = 188.36940002441
},
["name"] = "Wensickendorf Steinbruch #2",
["id"] = 8143,
["itemsProduced"] = {
["_lastYear"] = {["_sum"] = 58, ["STONE"] = 58},
["_sum"] = 58,
["_lastMonth"] = {["_sum"] = 0, ["STONE"] = 0},
["STONE"] = 58
},
["level"] = 0,
["itemsShipped"] = {
["_lastYear"] = {["_sum"] = 0},
["_lastMonth"] = {["_sum"] = 0},
["_sum"] = 0
},
["itemsConsumed"] = {
["_lastYear"] = {["_sum"] = 0},
["_lastMonth"] = {["_sum"] = 0},
["_sum"] = 0
},
["itemsConsumedVehicleUsed"] = {
["_lastYear"] = {["_sum"] = 0},
["_lastMonth"] = {["_sum"] = 0},
["_sum"] = 0
},
["stockList"] = 8142, --CONSTRUCTION
["type"] = "SIM_BUILDING"
}
Display More
STATION_GROUP
{
["cargoWaiting"] = {
["CRUDE"] = 31
},
["itemsUnloaded"] = {
["_lastYear"] = {
["_sum"] = 0
},
["_lastMonth"] = {
["_sum"] = 0
},
["_sum"] = 0
},
["type"] = "STATION_GROUP",
["itemsLoaded"] = {
["_lastYear"] = {
["_sum"] = 0,
["CRUDE"] = 0
},
["_sum"] = 43,
["_lastMonth"] = {
["_sum"] = 30,
["CRUDE"] = 30
},
["CRUDE"] = 43
},
["position"] = {
[1] = 3610.7138671875,
[2] = 1330.49609375,
[3] = 120.83628082275
},
["name"] = "Freinberg Nord",
["id"] = 19059,
["stations"] = {
[1] = 19058 --STATION
}
}
Display More
STATION
{
["cargo"] = true,
["type"] = "STATION",
["town"] = 1149, --TOWN
["carriers"] = { -- Values (multiples are possible): RAIL | ROAD | TRAM | WATER | AIR
["RAIL"] = true
},
["position"] = {
[1] = 3610.7138671875,
[2] = 1330.49609375,
[3] = 120.83628082275
},
["name"] = "Freinberg Nord",
["id"] = 19058,
["stationGroup"] = 19059 --STATION_GROUP
}
Display More
TOWN
{
["lu2cargoInfo"] = {
["RESIDENTIAL"] = {
["rating"] = 0,
["productionRating"] = 0, --unused?
["cargo2productionAndNeeds"] = {}, --unused?
["cargo2supplyAndNeeds"] = {},
["supplyRating"] = 0
},
["INDUSTRIAL"] = {
["rating"] = 0,
["productionRating"] = 0, --unused?
["cargo2productionAndNeeds"] = {}, --unused?
["cargo2supplyAndNeeds"] = {
["FUEL"] = {
[1] = 0,
[2] = 52
},
["MACHINES"] = {
[1] = 0,
[2] = 52
},
["CONSTRUCTION_MATERIALS"] = {
[1] = 0,
[2] = 52
}
},
["supplyRating"] = 0
},
["COMMERCIAL"] = {
["rating"] = 0,
["productionRating"] = 0, --unused?
["cargo2productionAndNeeds"] = {}, --unused?
["cargo2supplyAndNeeds"] = {
["GOODS"] = {
[1] = 0,
[2] = 51
},
["TOOLS"] = {
[1] = 0,
[2] = 51
},
["FOOD"] = {
[1] = 0,
[2] = 51
}
},
["supplyRating"] = 0
}
},
["useLinesCounts"] = {
["COMMERCIAL"] = 0,
["INDUSTRIAL"] = 0
},
["position"] = {
[1] = -2260.474609375,
[2] = 3209.8505859375,
[3] = 139.69999694824
},
["name"] = "Köwerich",
["id"] = 741,
["townDestCounts"] = {
-- travel destination [destination town id] = number
["COMMERCIAL"] = {[741] = 174},
["INDUSTRIAL"] = {[741] = 182}
},
["useLinesPercentage"] = 0,
["type"] = "TOWN",
["counts"] = {
["RESIDENTIAL"] = 183,
["INDUSTRIAL"] = 182,
["COMMERCIAL"] = 174
}
}
Display More
VEHICLE_DEPOT
VEHICLE
{
["depot"] = -1,
["cargoLoad"] = {
["PASSENGERS"] = 9
},
["capacities"] = {
["PASSENGERS"] = 9
},
["id"] = 18143,
["vehicles"] = {
[1] = {
["logo"] = "",
["reversed"] = false,
["fileName"] = "vehicle/tram/halle.mdl",
["loadConfig"] = {
[1] = 0
},
["purchaseDate"] = {
["month"] = 7,
["day"] = 31,
["year"] = 1900
},
["color"] = {
[1] = -1,
[2] = -1,
[3] = -1
}
}
},
["type"] = "VEHICLE",
["state"] = "AT_TERMINAL", --AT_TERMINAL | EN_ROUTE | IN_DEPOT | GOING_TO_DEPOT
["stopIndex"] = 5,
["speed"] = 0,
["position"] = {
[1] = -207.25003051758,
[2] = 902.32940673828,
[3] = 117.12895202637
},
["name"] = "Tram 3",
["line"] = 17972,
["carrier"] = "TRAM"
}
Display More