Began moving values to config.lua so they can be specified in the .conf file
parent
9cee177c65
commit
045e9641d2
|
@ -0,0 +1,24 @@
|
|||
|
||||
local CONFIG_FILE_PREFIX = "caverealms."
|
||||
|
||||
caverealms.config = {}
|
||||
|
||||
-- This function based on kaeza/minetest-irc/config.lua and used under the
|
||||
-- terms of BSD 2-clause license.
|
||||
local function setting(stype, name, default)
|
||||
local value
|
||||
if stype == "bool" then
|
||||
value = minetest.setting_getbool(CONFIG_FILE_PREFIX..name)
|
||||
elseif stype == "string" then
|
||||
value = minetest.setting_get(CONFIG_FILE_PREFIX..name)
|
||||
elseif stype == "number" then
|
||||
value = tonumber(minetest.setting_get(CONFIG_FILE_PREFIX..name))
|
||||
end
|
||||
if value == nil then
|
||||
value = default
|
||||
end
|
||||
caverealms.config[name] = value
|
||||
end
|
||||
|
||||
setting("number", "ymin", -33000)
|
||||
setting("number", "ymax", -700)
|
16
init.lua
16
init.lua
|
@ -3,10 +3,16 @@
|
|||
-- Depends default
|
||||
-- License: code WTFPL
|
||||
|
||||
-- Parameters
|
||||
caverealms = {}
|
||||
|
||||
local YMIN = -33000 -- Approximate realm limits.
|
||||
local YMAX = -700
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
||||
dofile(modpath.."/config.lua")
|
||||
|
||||
-- Parameters (see also config.lua)
|
||||
|
||||
local YMIN = caverealms.config.ymin -- Approximate realm limits.
|
||||
local YMAX = caverealms.config.ymax
|
||||
local XMIN = -33000
|
||||
local XMAX = 33000
|
||||
local ZMIN = -33000
|
||||
|
@ -64,10 +70,6 @@ local np_wave = {
|
|||
persist = 0.5
|
||||
}
|
||||
|
||||
-- Stuff
|
||||
|
||||
caverealms = {}
|
||||
|
||||
-- Nodes
|
||||
|
||||
--glowing crystal
|
||||
|
|
Loading…
Reference in New Issue