Directory structure

Important notice

All text files (models, meshes, scripts etc.) should be encoded in UTF-8. Also, it is recommend to use lower-case file names to avoid problems on case-sensitive OSes / file systems.

Mod layout

The game’s installation folder (usually C:\Program Files (x86)\Steam\SteamApps\common\Train Fever on Windows) looks something like this:

Train Fever\
  dlcs\
    ...
  mods\
    ...
  res\
    ...
  ...

All Mods must be installed in the mods/ sub-directory. The directory structure is as follows:

Train Fever\
  mods\
    urbangames_sample_mod_1\        (1)
      config\                       (2) (optional)
        ...
      documents\                    (3) (optional)
        ...
      res\                          (4) (optional)
        ...
      info.lua                      (5)
      image_00.tga                  (6) (optional)
      strings.lua                   (7) (optional)
      main.lua                      (8) (optional)
      filesystem.lua                (9) (optional)
  1. The directory name has the form <id>_<version>. The ID should be as specific as possible, so it should definitely contain the author’s name (or organization) and the Mod name. The version number is an integer starting at one.
  2. Optionally contains mod-related config files (Lua files). These files can be “required” from other Lua files, i.e. the config directory is added to Lua’s package.path list.
  3. Contains user documentation like manuals or read-me files. This directory is ignored by the game.
  4. Most content (like models, textures etc.) goes into this directory. Everything in here can be thought of as if it had been copied (with overwrite) to the base res/ folder.
  5. Contains the Mod’s metadata (like name, description etc.).
  6. An image of 320×180 pixels, shown in the game.
  7. Contains translations of the Mod’s texts.
  8. The main file for script-based modifications. See Scripting for reference.
  9. Defines files and directories to be removed/hidden from the base game.

Versions

Different versions of the same Mod are independent of each other, but when starting a new game, only the latest version is shown to the user.

info.lua

function data()
return {
  name = _("Sample Mod"),         -- (1)
  description = _("modDesc"),
  minorVersion = 0,               -- (2)
  severityAdd = "WARNING",        -- (3)
  severityRemove = "CRITICAL",
}
end
  1. Mod name and description. The _("text") indicates that the text will be translated (see strings.lua below).
  2. Minor version, count up from 0.
  3. Defines what kind of warning to show when the Mod is added to or removed from an existing savegame. Can be NONE, WARNING or CRITICAL.

strings.lua

function data()
return {
  en = {
    modDesc = "This is a sample Mod.",
  },
  de = {
    ["Sample Mod"] = "Beispiel-Mod",
    modDesc = "Dies ist ein Beispiel-Mod.",
  }
}
end

This file contains translations for strings, specified as a list of key/value pairs for each language. If a key does not exist for a given language, the English text is used. If this isn’t defined neither, the key itself is displayed. For a list of possible language codes, see the directory res\strings\.

filesystem.lua

function data()
return {
  hiddenDirs = {
    "res/models/model/vehicle/truck/"
  },
  hiddenFiles = {
    "res/models/model/vehicle/train/borsig_1860.mdl",
    "res/models/model/vehicle/train/br75_4.mdl"
  }
}
end

Allows to specify files and directories that are to be hidden from the game, i.e. it has the same effect as actually deleting the file(s).

One thought on “Directory structure

  1. bonjour je jeu est bien mais beaucoup de default ou mauvaise compréhention du jeu car je ne vois pas a quoi sert les trains de marchandises vu que quand on un réseau on perd plus d argent que l on en gagne vu que les usines fonctionnent bien avec les véhicules routiers mais des que l on veut passer en chemin de fer le réseau routier ne fonctionne plus réellement et avec le réseau de chemin de fer il diminue jusqu a ne plus rien avoir vraiment une dob et en plus je devais avoir le dlc usa et je ne peux pas y jouer perso ras le bol des jeux a moitié fonctionnel

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>