Getting Started: Improve chapter further

master
rubenwardy 2018-09-15 17:04:19 +01:00
parent b9a80a57c3
commit af6bfb8e8c
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
1 changed files with 29 additions and 28 deletions

View File

@ -14,33 +14,34 @@ redirect_from:
Understanding the basic structure of a mod's folder Understanding the basic structure of a mod's folder
is an essential skill when creating mods. is an essential skill when creating mods.
* [Mod Folders](#mod-folders) * [Mod Directory](#mod-directory)
* [Dependencies](#dependencies) * [Dependencies](#dependencies)
* [Mod Packs](#mod-packs) * [Mod Packs](#mod-packs)
* [Example](#example) * [Example](#example)
## Mod Folders ## Mod Directory
Each mod has its own folder where all its Lua code, textures, models, and sounds Each mod has its own directory where all its Lua code, textures, models, and
are placed. These folders need to be placed in a mod location such as sounds are placed. These directories need to be placed in a mod location such as
minetest/mods. minetest/mods.
![Find the mod's folder]({{ page.root }}//static/folder_modfolder.jpg) ![Find the mod's directory]({{ page.root }}/static/folder_modfolder.jpg)
A "mod name" is used to refer to a mod. Each mod should have a unique mod name. A "mod name" is used to refer to a mod. Each mod should have a unique name.
Mod names can include letters, numbers, and underscores. A good mod name should Mod names can include letters, numbers, and underscores. A good name should
describe what the mod does, and the folder which contains the components of a mod describe what the mod does, and the directory which contains the components of a mod
needs to be given the same name as the mod name. needs to be given the same name as the mod name.
To find out if a mod name is available, try searching for it on To find out if a mod name is available, try searching for it on
[content.minetest.net](https://content.minetest.net). [content.minetest.net](https://content.minetest.net).
Mod name (eg: "mymod") mymod
- init.lua - the main scripting code file, which runs when the game loads. ├── init.lua (required) - The main scripting code file. Runs when the game loads.
- mod.conf - a list of mods that need to be loaded before this mod. ├── mod.conf (recommended) - Mod metadata file. Contains description and dependencies.
- (optional) textures/ - images used by the mod, commonly in the format modname_itemname.png. ├── textures (optional)
- (optional) sounds/ - sounds used by the mod. │   └── ... any textures or images
- (optional) models/ - 3d models used by the mod. ├── sounds (optional)
...and any other Lua files to be included. │   └── ... any sounds
└── ... any other files or directories
Only the init.lua file is actually required in a mod for it to run on game load; Only the init.lua file is actually required in a mod for it to run on game load;
however, mod.conf is recommended and other components may be needed however, mod.conf is recommended and other components may be needed
@ -88,25 +89,25 @@ Mods can be grouped into mod packs which allow multiple mods to be packaged
and moved together. They are useful if you want to supply multiple mods to and moved together. They are useful if you want to supply multiple mods to
a player but don't want to make them download each one individually. a player but don't want to make them download each one individually.
modpackfolder/ modpack1
- modone/ ├── modpack.lua (required) - signals that this is a mod pack, content does not matter
- modtwo/ ├── mod1
- modthree/ │   └── ... mod files
- modfour/ └── mymod (optional)
- modpack.txt signals that this is a mod pack, content does not matter    └── ... mod files
## Example ## Example
Are you confused? Don't worry, here is an example which puts all of this together: Are you confused? Don't worry, here is an example which puts all of this together:
### Mod Folder ### Mod Folder
mymod/ mymod
- textures/ ├── textures
- - mymod_node.png │   └── mymod_node.png files
- depends.txt ├── depends.txt
- init.lua ├── init.lua
- mod.conf └── mod.conf
### depends.txt ### depends.txt
default default