Update level packs documentation

This commit is contained in:
Wuzzy 2024-12-14 17:33:33 +01:00
parent 5a49a6befb
commit c1f10191b9
2 changed files with 27 additions and 22 deletions

View File

@ -7,7 +7,7 @@ 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:
1) Level schematic (`*.mts`) files. These are for the blocks
1) Level schematic (`*.mts`) files. These are for the blocks of the level
2) 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.
@ -33,11 +33,31 @@ 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.
The definition of this function is as follows:
### `lzr_levels.register_level_pack`
Register a level pack. A level pack is a collection of levels that belong together.
For this to work, the level-related data must be present in the locations defined at
`level_data_file`, `schematic_path` and (optionally) `solutions_path` described below.
If successful, the level pack will appear in the game under the custom levels menu.
Parameters:
* `name`: level pack ID (string, allowed characters are `a-z`, `A-Z`, `0-9` and `_` (underscore))
* `info`: Table of optional additional information, with these fields:
* `title`: human-readable level pack title
* `description`: short description/explanation about this level pack. 1-3 sentences.
* `textdomain_level_names`: textdomain of the translation file containing the translated level names (default: no translation)
* `textdomain_npc_texts`: textdomain of the translation file containing the translated texts for NPCs like Goldie the Parrot (default: no translation)
* `level_data_file`: Path to CSV file containing metadata of all levels (default: `<modpath>/data/level_data.csv`)
* `schematic_path`: Path to directory containing the level '.mts' schematic files (default: `<modpath>/schematics`)
* `solutions_path`: Path to directory containing the OPTIONAL level '.sol.csv' solution files (default: `<modpath>/solutions`)
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.
@ -57,8 +77,10 @@ First, the file structure:
* `example_levels_level_names.de.po`
* `example_levels_npc_texts.pot`
* `example_levels_npc_texts.de.po`
```
The code of `init.lua`:
```
local S = minetest.get_translator("example_levels")
lzr_levels.register_level_pack("example",

View File

@ -1379,24 +1379,7 @@ function lzr_levels.get_current_level_data()
return current_level_data
end
--[[
Register a level pack. A level pack is a collection of levels that belong together.
For this to work, the level-related data must be present in the locations defined at
level_data_file, schematic_path and (optionally) solutions_path described below.
If successful, the level pack will appear in the game under the custom levels menu.
Parameters:
* name: level pack ID (string, allowed characters are a-z, A-Z, 0-9 and _ (underscore))
* info: Table of optional additional information, with these fields:
* title: human-readable level pack title
* description: short description/explanation about this level pack. 1-3 sentences.
* textdomain_level_names: textdomain of the translation file containing the translated level names (default: no translation)
* textdomain_npc_texts: textdomain of the translation file containing the translated texts for NPCs like Goldie the Parrot (default: no translation)
* level_data_file: Path to CSV file containing metadata of all levels (default: <modpath>/data/level_data.csv)
* schematic_path: Path to directory containing the level '.mts' schematic files (default: <modpath>/schematics)
* solutions_path: Path to directory containing the OPTIONAL level '.sol.csv' solution files (default: <modpath>/solutions)
]]
-- Register a level pack. See `LEVEL_PACKS.md` for documentation
function lzr_levels.register_level_pack(name, info)
local mod = minetest.get_current_modname()