Data structures returned by game.interface

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


Sie betrachten gerade eine ältere Version des Eintrags. Klicken Sie hier, um zur aktuellen Version zu gelangen.

  • A comprehensive overview over the data structures returned by game.interface.getEntity for different entity types
    [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: [list][*][tt]game.interface.getEntities({pos, radius}, {type, includeData})[/tt] [*][tt]game.interface.getTowns()[/tt] [*][tt]game.interface.getLines({stationGroup})[/tt] [*][tt]game.interface.getVehicles({line, depot, carrier})[/tt] [*][tt]game.interface.getStations({town, townRadius, carrier})[/tt] [*][tt]game.interface.getDepots()[/tt] [/list] All of these functions return an id, which is an integer. You can get the data behind an ID with the function [tt]game.interface.getEntity(id)[/tt]. Depending on which type of entity is returned, the data structures are different. [tt]game.interface.getEntities[/tt] allows you to instantly fetch the data together with the ID. Also, this function allows you to specify an entity type filter. [b]ASSET_GROUP[/b] [i]Note: Assets with valid [tt]groundFaces[/tt] are by definition a construction and will appear in the list CONSTRUCTION instead of ASSET_GROUP.[/i] [spoiler] [code=lua]{ ["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 } }[/code] [/spoiler] [b]CONSTRUCTION[/b] [spoiler] [code=lua]{ ["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 } }[/code][/spoiler] [b]LINE[/b] [i]Note: lines can't be fetched with the [tt]game.interface.getEntities[/tt]-method. Use [tt]game.interface.getLines[/tt] instead.[/i] [spoiler] [code=lua]{ ["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", }[/code][/spoiler] [b]SIM_BUILDING[/b] [spoiler] [code=lua]{ ["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" }[/code][/spoiler] [b]STATION_GROUP[/b] [spoiler] [code=lua]{ ["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 } }[/code] [/spoiler] [b]STATION[/b] [spoiler] [code=lua]{ ["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 }[/code] [/spoiler] [b]TOWN[/b] [spoiler] [code=lua]{ ["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 } }[/code] [/spoiler] [b]VEHICLE_DEPOT[/b] [spoiler] [code=lua]{ ["type"] = "VEHICLE_DEPOT", ["position"] = { [1] = -551.77056884766, [2] = 553.2109375, [3] = 107.28010559082 }, ["name"] = "Tramdepot Obersteinebach", ["id"] = 13945, ["carrier"] = "TRAM" -- Values: RAIL | ROAD | TRAM | WATER | AIR }[/code] [/spoiler] [b]VEHICLE[/b] [spoiler] [code=lua]{ ["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" }[/code][/spoiler]

Teilen