Template onetime setup

This commit is contained in:
AliasAlreadyTaken 2022-02-19 04:28:03 +01:00
parent ff053243dc
commit 9308cd3b82
3 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,8 @@
-- Setting a configuration, switch the order in which the settings shall take precedence. First valid one taken.
yl_template.external_value = "mod_default" or minetest.settings:get("external_value") or "default"
yl_template.external_value = "mod_default" or minetest.settings:get("yl_template.external_value") or "default"
yl_template.save_path = "yl_template" or minetest.settings:get("yl_template.save_path") or "default"
yl_template.admin_priv = "admin_priv" or minetest.settings:get("yl_template.admin_priv") or "server"

View File

@ -21,6 +21,7 @@ yl_template.information.name = "yl_template"
yl_template.information.additional = "Additional information"
dofile(yl_template.modpath .. "config.lua")
dofile(yl_template.modpath .. "setup.lua")
dofile(yl_template.modpath .. "privs.lua")
dofile(yl_template.modpath .. "internal.lua")
dofile(yl_template.modpath .. "api.lua")

16
setup.lua Normal file
View File

@ -0,0 +1,16 @@
local function run_once()
local dl = minetest.get_dir_list(yl_template.worldpath, true)
local create = true
for _, v in ipairs(dl) do
if v == yl_template.save_path then
create = false
end
end
if create then
minetest.mkdir(yl_template.worldpath .. DIR_DELIM .. yl_template.save_path)
end
end
run_once()