Add settings system (closes #6)

This commit is contained in:
Zughy 2023-08-23 13:49:37 +02:00
parent 9f85564753
commit 75ce39a0eb
4 changed files with 21 additions and 0 deletions

3
IGNOREME/README.md Normal file
View File

@ -0,0 +1,3 @@
**EDITING THIS FOLDER IS USELESS, EDIT THE ONE CALLED parties IN THE WORLD FOLDER INSTEAD**
The first time the world is launched with `parties` on, this folder is copy-pasted into the world folder (with the sole exception of this file). The purpose of this folder is to provide a template for the settings file.

1
IGNOREME/SETTINGS.lua Normal file
View File

@ -0,0 +1 @@
--TODO

View File

@ -14,6 +14,9 @@ Minimalist party mod for Minetest
### Chat
* `/p <message>` writes a message in the party chat
## Customisation
Launch the world at least once with `parties` enabled. Then customise the mod going to `your world folder/parties`
## Developers
[In-depth API documentation](https://gitlab.com/zughy-friends-minetest/parties/-/blob/master/DOCS.md)

14
src/_load.lua Normal file
View File

@ -0,0 +1,14 @@
local function load_world_folder()
local wrld_dir = minetest.get_worldpath() .. "/parties"
local content = minetest.get_dir_list(wrld_dir)
-- se la cartella di parties non esiste/è vuota, copio la cartella base `IGNOREME`
if not next(content) then
local src_dir = minetest.get_modpath("parties") .. "/IGNOREME"
minetest.cpdir(src_dir, wrld_dir)
os.remove(wrld_dir .. "/README.md")
content = minetest.get_dir_list(wrld_dir)
end
end
load_world_folder()