mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-11-05 10:00:40 +01:00
27 lines
853 B
Lua
27 lines
853 B
Lua
|
local CONFIG_FILE_PREFIX = "dfcaverns_"
|
||
|
|
||
|
df_mapitems.config = {}
|
||
|
|
||
|
local print_settingtypes = false
|
||
|
|
||
|
local function setting(stype, name, default, description)
|
||
|
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 == "int" or stype == "float" then
|
||
|
value = tonumber(minetest.setting_get(CONFIG_FILE_PREFIX..name))
|
||
|
end
|
||
|
if value == nil then
|
||
|
value = default
|
||
|
end
|
||
|
df_mapitems.config[name] = value
|
||
|
|
||
|
if print_settingtypes then
|
||
|
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
|
||
|
end
|
||
|
end
|
||
|
|
||
|
setting("float", "glow_worm_delay_multiplier", 10.0, "glow worm growth delay multiplier")
|
||
|
setting("bool", "snareweed_damage", true, "Snareweed causes damage to players")
|