Add 'Building your first mod'

Lucas Schwiderski 2023-03-01 23:03:01 +01:00
parent 0834275a57
commit 88932112e9

@ -0,0 +1,25 @@
In a Command Prompt/terminal, run `dtmt new <path/to/new/folder>` to create a skeleton structure from the default template.
During this, DTMT will prompt for several fields, including:
- `name`: The human-readable name of your mod. This will show up in various places like DTMM's mod list or DMF's mod options view.
- `id`: A unique ID for your mod. The default is generated from `name` and should be good enough in most cases (clicking Enter without typing accepts the default value). This will be used throughout your code (e.g. in `get_mod()` calls).
DTMT will now create the given directory from the mod template:
```
<path/to/new/folder>
└──<id>
├──dtmt.cfg
├──packages
│ └──<id>.package
└──scripts
└──mods
└──<id>
├──data.lua
├──init.lua
└──localization.lua
```
You're now ready to start editing the `init.lua` file. For starters, you might want to just add a simple `print("Hello, world!")`, which will print this string in your console logs once you've loaded the mod.
With the file edited, you now need to turn your mod into something that DTMM can load into the game. To do that, navigate to your mod's folder (where the `dtmt.cfg` is) and run `dtmt build`. Watch the output for any errors, but if all goes well, this will produce a `<id>.zip` file, which you can then import in DTMM and deploy.