add settings

This commit is contained in:
BuckarooBanzay 2021-06-02 14:25:36 +02:00
parent 458bfc24fc
commit d65fcf565f
3 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,13 @@
local MP = minetest.get_modpath("mtinfo")
local mtinfo_enabled = minetest.settings:get_bool("mtinfo.enabled")
local autoshutdown = minetest.settings:get_bool("mtinfo.autoshutdown")
if not mtinfo_enabled then
-- skip everything
return
end
mtinfo = {
basepath = minetest.get_worldpath() .. "/mtinfo",
settings = {
@ -46,7 +54,7 @@ minetest.register_on_mods_loaded(function()
local diff = minetest.get_us_time() - start
print("[mtinfo] export took " .. diff .. " us")
if minetest.settings:get_bool("mtinfo.autoshutdown") then
if autoshutdown then
minetest.request_shutdown("autoshutdown")
end
end)

View File

@ -27,6 +27,11 @@ Generates a static info-page about the world, stats include:
* Start the world
* Open the generated `index.html` in the world-folder `mtinfo` with a web-browser
## Settings
* **mtinfo.enabled** Enables the info-page generation (default `false`)
* **mtinfo.autoshutdown** Shuts down after info-page generation (default `false`)
# Contributors
* https://github.com/BuckarooBanzay

View File

@ -1,3 +1,4 @@
# shutdown after generating
mtinfo.autoshutdown = true
mtinfo.enabled = true