[Blocked Image: https://ftp.train-fever.net/flaggen/de.png] Die Deutsche Version gibt es hier: mod.lua und strings.lua - Erklärung und Inhalt
1 Official Format by Urban Games (mod.lua)
The basic format of the mod.lua file that is required for each mod in the root directory
function data()
return {
info = {
name = _("Sample mod"), -- name of mod
description = _("modDesc"), -- optional, description
minorVersion = 0, -- minorVersion (integer)
severityAdd = "WARNING", -- NONE, WARNING, CRITICAL
severityRemove = "CRITICAL", --
visible = true, -- optional, default: true
-- if false, mod is hidden
},
-- options = ..
-- runFn = ..
-- checkActiveFn = ..
}
end
Display More
2 Additional Information for TPFMM
Basic Information
tfnetId = 0, -- optional, transportfever.net entry id
steamId = 0, -- optional, steam workshop file id
url = "https://transportfever.net" -- optional, url to mod homepage
Authors
authors = { -- optional, information about authors
{ -- add one or multiple authors
name = "Author 1", -- author name
role = "CREATOR", -- CREATOR, CO_CREATOR, TESTER, BASED_ON, OTHER
tfnetId = 00000, -- optional, id at transportfever.net
steamId = 0000, -- optional, steam id
}, -- optional, add more authors
},
Tags
Dependencies
Define dependencies to other mods that are required in order for the mod to function as desired, not evaluated by the game but informs mod managers which other mods to download. For the download, at least one online source has to be defined
3 Translations (strings.lua)
All strings put in _("") will be translated based on the strings.lua file:
function data()
return {
de = {
["my mod"] = "Mein Mod", -- call to _("my mod") will be
-- replaced with "mein Mod",
-- if language is german
["the description"] = "Beschreibung",
-- _("the description") ⇒ "Beschreibung"
},
}
end
Display More
[box]Note:
If a variable is passed to the _() function, the content of the variable, not the variable name itself is passed to the function. This, in combination with global variables in lua lead to the scenario in which description and name of multiple mods where overwritten by each other in a beta patch of Transport Fever. Although this is fixed by now, Urban Games and strongly advises to only use local variables. Pesonally, I advice to not use variables for the translation function.[/box]
4 Example Files
Very simple file with single author
function data()
return {
info = {
name = _("name"),
description = _("desc"),
minorVersion = 2,
severityAdd = "NONE"
severityRemove = "CRITICAL",
authors = {
{
name = "John Doe",
role = "CREATOR",
tfnetId = 1,
},
},
tags = {"train", "multiple_unit"},
},
}
end
Display More
function data()
return {
en = {
["name"] = "My Train Mod",
["desc"] = "This is my first train mod. Have fun.",
},
de = {
["name"] = "Mein Zug Mod",
["desc"] = "Das ist mein erster Zug Mod, viel Spaß.",
},
}
end
Display More
A repaint mod, that requires the mod defined above
function data()
return {
info = {
name = _("name"),
description = _("desc"),
minorVersion = 1,
severityAdd = "NONE"
severityRemove = "CRITICAL",
authors = {
{
name = "jane",
role = "CREATOR",
tfnetId = 00000,
steamId = 0000,
text = "text",
},
{
name = "John Doe",
role = "BASED_ON",
tfnetID = 1,
},
},
dependencies = { "base_mod_1" },
tags = {"repaint", "train", "multiple_unit"},
},
}
end
Display More