Goods, definition of

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the Transport-Fever Community

  • A brief explanation on how to define custom goods for transport and processing in TPF2

    Defining a custom good in the game is not particularly complicated.


    To begin, create a directory res\config\cargo_types and a file (good´s name).cargo.lua.


    This file looks as follows:



    "id = " defines the name for the games internal use. It is written in CAPITALS and obviously has to be unique.

    "name = " defines the name displayed to the player when e. g. the mouse pointer hovers over the good icon.

    "weight = " is a crates mass when filled with the good.


    The block "levelModels = " tells the game what a bulk load of the good will look like in an open wagon. If no bulk transport is intended, it can be omitted.

    The block "discreteModels =" defines a crate of the good in question. It will always be included: even bulk merchandise like coal can travel in crates in this game on occasion.


    "townInput = " will tell the game the new good is to be consumed by cities. The three options "RESIDENTIAL", "COMMERCIAL" or "INDUSTRIAL" will see the good delivered to the respective section of the town. In case of intermediate products that will only be consumed by factories, this block can be omitted.


    The .mdl files are located in the directories as defined in above blocks. They are no different from all other models.


    With the good now defined, we will need an icon for the user interface, showing up wherever the good is transported, processed or produced. These files will be placed in res\textures\ui\hud and come in three versions.


    Firstly, there is cargo_NAME.tga. It is sized 24x24 pixels and will show up e. g. to indicate cargo waiting at stations.


    Secondly, there is cargo_NAME@2x.tga. Its size is 50x50 pixels and it will be displayed at the factories producing or requiring the good.


    And finally, there is cargo_NAME_small.tga, 10x10 pixels large, and showing up in the "recipe" displayed in the window called for by clicking the factory.


    "NAME" is of course a wildcard and will be replaced by the internal name as defined in the .cargo.lua under "name = ".


    Now, in order to process the good in a factory, head over to the respective works .con. At the very end of the file, there is a block looking like this:


    Code
    1. local stockListConfig = {
    2. stocks = { "COAL" },
    3. rule = { input = { { 3 } }, output = { OIL = 1, COKE = 1 }, capacity = 200 },
    4. }

    ...which is nearly self-explanatory. "stocks = " define the goods that are stored on the factory grounds in open air. "rule = " tells the factory what it is to produce and from what raw material. The block shown above for example will have the factory store COAL in open crates and use 3 COAL to create 1 OIL and one COKE. "capacity = " defines how much of the goods can be stored in the factory.


    And finally, we will need a vehicle to transport the new goods.


    In each transport vehicles .mdl, quite far down, there are text blocks defining the compartments and their possible contents. There is a lexicon article explaining the general issues with cargo holds, I will assume this information known and not repeat it here.


    Code
    1. {
    2. {capacity = 44, cargoBay = {bbMax = { 28.51, 1.62, 7.35, },bbMin = { 20.14, -1.62, 4.95, }, cargoFormat = "", childId = 0, gridSize = { 4, 2, }, sizePolicy = "STRETCH_HEIGHT_SCALEY", type = "DISCRETE", },
    3. type = "STEEL",
    4. },
    5. },

    Just copy and duplicate this block; however, under "type = " enter the ingame name of Your newly created good. Then the vehicle should be able to carry it; it is possible though that this change will only affect newly purchased examples after this change within a running game.

Share