Folder Structure: Improve phrasing/readability
This commit is contained in:
parent
c90d890192
commit
1abb409fec
@ -6,34 +6,35 @@ root: ../../
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
In this chapter we will learn the basic structure of a mod's folder.
|
Understanding the basic structure of a mod's folder
|
||||||
This is an essential skill when creating mods.
|
is an essential skill when creating mods.
|
||||||
|
|
||||||
* Mod Folders
|
* [Mod Folders](#mod-folders)
|
||||||
* Dependencies
|
* [Dependencies](#dependencies)
|
||||||
* Mod Packs
|
* [Mod Packs](#mod-packs)
|
||||||
|
* [Example](#example)
|
||||||
|
|
||||||
## Mod Folders
|
## Mod Folders
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Each mod has its own folder where all its Lua code, textures, models, and sounds
|
Each mod has its own folder where all its Lua code, textures, models, and sounds
|
||||||
are placed. These folders need to be placed in a mod location such as
|
are placed. These folders need to be placed in a mod location such as
|
||||||
minetest/mods. Mods can be grouped into mod packs which are explained below.
|
minetest/mods.
|
||||||
|
|
||||||
A "mod name" is used to refer to a mod. Each mod should have a unique mod name,
|

|
||||||
which you can choose - a good mod name should describe what the mod does.
|
|
||||||
Mod names can be made up of letters, numbers, or underscores. The folder a mod is
|
A "mod name" is used to refer to a mod. Each mod should have a unique mod name.
|
||||||
in needs to be called the same as the mod name.
|
Mod names can include letters, numbers, and underscores. A good mod name should
|
||||||
|
describe what the mod does, and the folder which contains the components of a mod
|
||||||
|
needs to be given the same name as the mod name.
|
||||||
|
|
||||||
### Mod Folder Structure
|
### Mod Folder Structure
|
||||||
Mod name (eg: "mymod")
|
Mod name (eg: "mymod")
|
||||||
- init.lua - the main scripting code file, which is run when the game loads.
|
- init.lua - the main scripting code file, which runs when the game loads.
|
||||||
- (optional) depends.txt - a list of mod names that needs to be loaded before this mod.
|
- (optional) depends.txt - a list of mods that need to be loaded before this mod.
|
||||||
- (optional) textures/ - place images here, commonly in the format modname_itemname.png
|
- (optional) textures/ - images used by the mod, commonly in the format modname_itemname.png.
|
||||||
- (optional) sounds/ - place sounds in here
|
- (optional) sounds/ - sounds used by the mod.
|
||||||
- (optional) models/ - place 3d models in here
|
- (optional) models/ - 3d models used by the mod.
|
||||||
...and any other lua files to be included by init.lua
|
...and any other Lua files to be included.
|
||||||
|
|
||||||
Only the init.lua file is required in a mod for it to run on game load; however,
|
Only the init.lua file is required in a mod for it to run on game load; however,
|
||||||
the other items are needed by some mods to perform their functionality.
|
the other items are needed by some mods to perform their functionality.
|
||||||
@ -52,16 +53,16 @@ needs to be loaded before this mod.
|
|||||||
As you can see, each modname is on its own line.
|
As you can see, each modname is on its own line.
|
||||||
|
|
||||||
Mod names with a question mark following them are optional dependencies.
|
Mod names with a question mark following them are optional dependencies.
|
||||||
If an optional dependency is installed, it is loaded before the mod.
|
If an optional dependency is installed, it is loaded before the mod;
|
||||||
However, if the dependency is not installed, the mod still loads.
|
however, if the dependency is not installed, the mod still loads.
|
||||||
This is in contrast to normal dependencies which will cause the current
|
This is in contrast to normal dependencies which will cause the current
|
||||||
mod not to work if the dependency is not installed.
|
mod not to work if the dependency is not installed.
|
||||||
|
|
||||||
## Mod Packs
|
## Mod Packs
|
||||||
|
|
||||||
Modpacks allow multiple mods to be packaged together and be moved together.
|
Mods can be grouped into mod packs which allow multiple mods to be packaged
|
||||||
They are useful if you want to supply multiple mods to a player but don't
|
and moved together. They are useful if you want to supply multiple mods to
|
||||||
want to make them download each one individually.
|
a player but don't want to make them download each one individually.
|
||||||
|
|
||||||
### Mod Pack Folder Structure
|
### Mod Pack Folder Structure
|
||||||
modpackfolder/
|
modpackfolder/
|
||||||
@ -71,9 +72,9 @@ want to make them download each one individually.
|
|||||||
- modfour/
|
- modfour/
|
||||||
- modpack.txt – signals that this is a mod pack, content does not matter
|
- modpack.txt – signals that this is a mod pack, content does not matter
|
||||||
|
|
||||||
## Example Time
|
## Example
|
||||||
|
|
||||||
Are you confused? Don't worry, here is an example putting 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/
|
||||||
@ -104,7 +105,7 @@ minetest.register_node("mymod:node", {
|
|||||||
})
|
})
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
Our mod has a name of "mymod". It has two text files: init.lua and depends.txt.\\
|
This mod has the name "mymod". It has two text files: init.lua and depends.txt.\\
|
||||||
The script prints a message and then registers a node – which will be explained in the next chapter.\\
|
The script prints a message and then registers a node – which will be explained in the next chapter.\\
|
||||||
The depends text file adds a dependency to the default mod which is in minetest_game.\\
|
The depends text file adds a dependency on the default mod which is in minetest_game.\\
|
||||||
There is also a texture in textures/ for the node.
|
There is also a texture in textures/ for the node.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user