mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-03 04:20:02 -04:00
Add config API for per-world configuration options (mapgen for example)
This commit is contained in:
parent
ba8cbbcdbd
commit
11dc442a52
2 changed files with 17 additions and 0 deletions
16
mods/default/config.lua
Normal file
16
mods/default/config.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
default.config = Settings(minetest.get_worldpath().."/default.conf")
|
||||
|
||||
local conf_table = default.config:to_table()
|
||||
|
||||
local defaults = {
|
||||
}
|
||||
|
||||
for k, v in pairs(defaults) do
|
||||
if conf_table[k] == nil then
|
||||
if minetest.setting_get(k) ~= nil then
|
||||
default.config:set(k, minetest.setting_get(k))
|
||||
else
|
||||
default.config:set(k, v)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -36,6 +36,7 @@ default.gui_suvival_form = "size[8,8.5]"..
|
|||
default.get_hotbar_bg(0,4.25)
|
||||
|
||||
-- Load files
|
||||
dofile(minetest.get_modpath("default").."/config.lua")
|
||||
dofile(minetest.get_modpath("default").."/functions.lua")
|
||||
dofile(minetest.get_modpath("default").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("default").."/tools.lua")
|
||||
|
|
Loading…
Add table
Reference in a new issue