User Tools

Site Tools

Urban Games


Cargo Types

Cargo Types are used to define the different freights that should be transported in Transport Fever 2. They are configured in .lua files in the res/config/cargo_types/ folder.


The basic structure of a cargo type config is:

function data()
    id = "IRON_ORE", 
    name = _("Iron ore"), 
    weight = 1200.0,
    order = 4,
    levelModels = { 
      MEDIUM4x1 = "industry/cargo/level/iron_ore_level_4x1.mdl", 
      MEDIUM2x1 = "industry/cargo/level/iron_ore_level_2x1.mdl"
    discreteModels = { 
      SMALL = "industry/cargo/iron_ore_small.mdl", 
      BIG = "industry/cargo/iron_ore_big.mdl"
    townInput = { "INDUSTRIAL", },

The properties are:

  • id is a unique string that is used as a reference in many other configurations, e.g. industries and vehicles. It is common that the id is in CAPS and uses underscores to seperate words.
  • name is a string that is used wherever the name of the cargo is displayed. It can be translated in a strings.lua file.
  • weight is the weight of one cargo unit. For bulk cargo, a cargo unit usually is assumed as 1 m³.
  • order is used for the sorting in lists where several or all cargos are listed.
  • townInput is a list of keys. To define the cargo type as a end product for commercial districts, add “COMMERCIAL” to the list. For industrial districts, add “INDUSTRIAL”. When unset or left empty, the cargo type is not required by any town.

Cargo Models

Cargo types provide generic models that are automatically fitted in the cargo bays of vehicles and displayed on station plattforms or in stock areas of industries. The models are referenced in the levelModels or discreteModels block.

The levelModels block is used for surface models in open wagons and tippers to visualize bulk cargo.

  • MEDIUM4x1 is a model with a side ratio of 4 to 1.
  • MEDIUM2x1 is a model with a side ratio of 2 to 1.

The discreteModels block is used for every other model. These are used outside of vehicles too.

  • SMALL is a model that is used for a single cargo unit.
  • BIG is a model that is used for 10 cargo units.

It is recommended that the small models have a volume of approximately 1 cubic meter. The big models can be bigger. For both models, it is recommended that they are formed to be stackable so that cargo vehicles can use several layers of the models. Keep this in mind when defining the bounding box too to get the height right.

For all cargo models, the model origin should be in the center of the bottom.

It is possible to use these generic models for the custom cargo model configurations too by prefixing the key with # like “#MEDIUM4x1”.

UI Icons

The cargo icons are located in the res/textures/ui/hud/ folder. They each are named like <cargo_type_filename>@2x.tga and have a height of 50 pixels. The icons use a flat style without shadows and have a black outline to improve contrast ingame.

modding/cargotypes.txt · Last modified: 2020/06/11 02:02 by yoshi