From d65fcf565f69b0d0af85270bb17b4fe8f27b8dc2 Mon Sep 17 00:00:00 2001 From: BuckarooBanzay Date: Wed, 2 Jun 2021 14:25:36 +0200 Subject: [PATCH] add settings --- init.lua | 10 +++++++++- readme.md | 5 +++++ scripts/minetest.conf | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 702d80f..a60e787 100644 --- a/init.lua +++ b/init.lua @@ -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) diff --git a/readme.md b/readme.md index a3b2007..1504e9c 100644 --- a/readme.md +++ b/readme.md @@ -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 diff --git a/scripts/minetest.conf b/scripts/minetest.conf index 6d4045b..f9f4e88 100644 --- a/scripts/minetest.conf +++ b/scripts/minetest.conf @@ -1,3 +1,4 @@ # shutdown after generating mtinfo.autoshutdown = true +mtinfo.enabled = true \ No newline at end of file