Add 'Migrating from loose files'
parent
2917b11829
commit
70e5892758
1 changed files with 62 additions and 0 deletions
62
Migrating-from-loose-files.md
Normal file
62
Migrating-from-loose-files.md
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
> **NOTE**: If this is your first time migrating a mod, I strongly suggest going through [Building your first mod](Building-your-first-mod) once, to play around with and get a feel for the new file structure.
|
||||||
|
|
||||||
|
To migrate Lua files from a loose file structure to something that can be built into mod bundles with DTMT, the following is needed:
|
||||||
|
|
||||||
|
- a `dtmt.cfg` that defines the mod's metadata, entry points and packages
|
||||||
|
- at least one `.package` file that includes your Lua files
|
||||||
|
|
||||||
|
Use the following template to create your `dtmt.cfg`:
|
||||||
|
|
||||||
|
```sjson
|
||||||
|
// The ID string you pass to `get_mod()`
|
||||||
|
id = ""
|
||||||
|
// The human-readable name of the mod. This will show up in places like DTMM's mod list and DMF's options view
|
||||||
|
name = ""
|
||||||
|
// A summary of what your mod does. Shows up in DTMM
|
||||||
|
description = ""
|
||||||
|
// A version number to track changes in your mod with. Not used, yet, but good practice to always have anyways.
|
||||||
|
version = ""
|
||||||
|
|
||||||
|
// The Lua files passed in the second parameter of DMF's `new_mod`
|
||||||
|
resources = {
|
||||||
|
// The Lua file to be called by DMF when it initializes your mod.
|
||||||
|
init = ""
|
||||||
|
data = ""
|
||||||
|
localization = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
// At least one package file to load your files. It doesn't have to be named after your mod's ID value, but it is good practice to do so.
|
||||||
|
"packages/<id>"
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Please note that all file paths should be specified _without_ file extension. The `resources` section can be adapted from the contents of your `.mod` file. All instances of `<id>` are intended to be replaced with the value you specify in `id = ""`, i.e. the value passed to DMF's `new_mod` and `get_mod`.
|
||||||
|
|
||||||
|
The `.package` file supports wildcards, so the most simple version would look like this:
|
||||||
|
|
||||||
|
```sjson
|
||||||
|
lua = [
|
||||||
|
"scripts/mods/<id>/*"
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
A suggested final file structure looks as follows:
|
||||||
|
|
||||||
|
```none
|
||||||
|
<path/to/new/folder>
|
||||||
|
└──<id>
|
||||||
|
├──dtmt.cfg
|
||||||
|
├──packages
|
||||||
|
│ └──<id>.package
|
||||||
|
└──scripts
|
||||||
|
└──mods
|
||||||
|
└──<id>
|
||||||
|
├──data.lua
|
||||||
|
├──init.lua
|
||||||
|
└──localization.lua
|
||||||
|
```
|
||||||
|
|
||||||
|
All additional Lua files can then be dropped into `scripts/mods/<id>` (sub-directories are supported) and can be `require`d in-game with the full path, e.g. `require("scripts/mods/<id>/my_extra_file")`.
|
||||||
|
|
||||||
|
Modding veterans from VT2 may recognize this file structure 🙂
|
Loading…
Add table
Reference in a new issue