2.3 KiB
Level packs
A level pack is a collection of levels that belong together.
This is the best way to store and share custom levels, but it requires Lua programming skills to add a new level pack.
To add a new level pack, a new Luanti mod must be created containing these things:
- Level schematic (
*.mts
) files. These are for the blocks - Level metadata in a level data CSV file. This contains all information that the schematic file cannot hold, e.g. title, boundary blocks, weather, sky, etc. The level data CSV specifies the metadata for ALL levels at once. This file also defines the level order. Levels at the top will be played first.
- Lua code to register the level pack (see below)
The Lua mod must depend on lzr_levels
.
File structure
Normally, the file structure of the mod is as follows:
mod.conf
: Must declare dependency onlzr_levels
init.lua
: Lua code to register level pack (see below)data/level_data.csv
: CSV file for level metadata for ALL levelsschematics/
: The level*.mts
files go heresolutions/
: (optional) Level solution files*.sol.csv
go here.locale/
: (optional) To store the locale files, if present
Some of these file locations may be changed by parameters of the
function lzr_levels.register_level_pack
.
Register the level pack
To register a level pack, you must call lzr_levels.register_level_pack
.
The full definition of this function can be found in the code comment above that
function in the lzr_levels
mod.
If successful, the level pack will appear in the game under the custom levels menu.
Example
A simple example with one level, translated into German.
First, the file structure:
mod.conf
init.lua
schematics
example.mts
data
level_data.csv
locale
example_levels.pot
example_levels.po.de
example_levels_level_names.pot
example_levels_level_names.de.po
example_levels_npc_texts.pot
example_levels_npc_texts.de.po
local S = minetest.get_translator("example_levels")
lzr_levels.register_level_pack("example",
{
title = S("My Example Levels"),
description = S("Some example levels to test things."),
textdomain_npc_texts = "example_levels_npc_texts",
textdomain_level_names = "example_levels_level_names",
}
)