2017-03-08 07:50:58 +01:00
|
|
|
local CONFIG_FILE_PREFIX = "dfcaverns_"
|
|
|
|
|
|
|
|
dfcaverns.config = {}
|
|
|
|
|
2017-03-16 20:33:50 +01:00
|
|
|
local print_settingtypes = false
|
2017-03-08 07:50:58 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
dfcaverns.config[name] = value
|
|
|
|
|
|
|
|
if print_settingtypes then
|
|
|
|
minetest.debug(CONFIG_FILE_PREFIX..name.." ("..description..") "..stype.." "..tostring(default))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local trees = {
|
2017-03-27 03:45:02 +02:00
|
|
|
{name="fungiwood", delay_multiplier = 1},
|
|
|
|
{name="tunnel_tube", delay_multiplier = 1},
|
|
|
|
{name="spore_tree", delay_multiplier = 1},
|
|
|
|
{name="black_cap", delay_multiplier = 1},
|
|
|
|
{name="nether_cap", delay_multiplier = 1},
|
|
|
|
{name="goblin_cap", delay_multiplier = 1},
|
|
|
|
{name="tower_cap", delay_multiplier = 1},
|
2017-03-08 07:50:58 +01:00
|
|
|
}
|
|
|
|
|
2017-03-17 07:19:49 +01:00
|
|
|
local plants = {
|
|
|
|
{name="cave_wheat", delay_multiplier=1},
|
|
|
|
{name="dimple_cup", delay_multiplier=3},
|
|
|
|
{name="pig_tail", delay_multiplier=1},
|
|
|
|
{name="plump_helmet", delay_multiplier=3},
|
|
|
|
{name="quarry_bush", delay_multiplier=2},
|
|
|
|
{name="sweet_pod", delay_multiplier=2},
|
|
|
|
}
|
|
|
|
|
2017-09-06 03:34:14 +02:00
|
|
|
--Trees
|
|
|
|
|
2017-03-16 20:33:50 +01:00
|
|
|
setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay")
|
|
|
|
setting("int", "tree_max_growth_delay", 4800, "Maximum sapling growth delay")
|
|
|
|
|
2017-03-08 07:50:58 +01:00
|
|
|
for _, tree in pairs(trees) do
|
2017-03-16 20:33:50 +01:00
|
|
|
setting("float", tree.name.."_delay_multiplier", tree.delay_multiplier, tree.name.." growth delay multiplier")
|
2017-03-08 07:50:58 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval")
|
2017-03-14 06:41:24 +01:00
|
|
|
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance")
|
2017-03-16 09:17:55 +01:00
|
|
|
|
2017-09-06 03:34:14 +02:00
|
|
|
--Plants
|
|
|
|
|
2017-04-02 23:39:31 +02:00
|
|
|
setting("int", "plant_growth_time", 500, "Base plant growth time")
|
2017-03-17 07:19:49 +01:00
|
|
|
|
|
|
|
for _, plant in pairs(plants) do
|
2017-04-02 23:39:31 +02:00
|
|
|
setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
|
2017-03-17 07:19:49 +01:00
|
|
|
end
|
|
|
|
|
2017-09-06 03:34:14 +02:00
|
|
|
setting("float", "glow_worm_delay_multiplier", 10.0, "glow worm growth delay multiplier")
|
2017-03-21 08:02:46 +01:00
|
|
|
setting("bool", "light_kills_fungus", true, "Light kills fungus")
|
|
|
|
|
2017-09-06 03:34:14 +02:00
|
|
|
--Caverns
|
|
|
|
|
2017-03-27 03:45:02 +02:00
|
|
|
setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale")
|
|
|
|
setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale")
|
2018-04-22 16:01:13 +02:00
|
|
|
setting("float", "cavern_threshold", 0.5, "Cavern threshold")
|
2017-03-27 03:45:02 +02:00
|
|
|
|
2017-03-21 08:02:46 +01:00
|
|
|
setting("int", "ymax", -300, "Upper limit of level 1")
|
2017-03-22 06:34:44 +01:00
|
|
|
setting("int", "level1_min", -900, "Upper limit of level 2")
|
|
|
|
setting("int", "level2_min", -1500, "Upper limit of level 3")
|
2018-04-22 16:01:13 +02:00
|
|
|
setting("int", "level3_min", -2100, "Upper limit of the sunless sea")
|
|
|
|
setting("int", "sunless_sea_min", -2500, "Lower limit of the sunless sea")
|
2017-09-05 08:48:45 +02:00
|
|
|
|
2018-04-22 16:01:13 +02:00
|
|
|
setting("int", "lava_sea_max", -3000, "Upper limit of the lava sea")
|
|
|
|
setting("int", "lava_sea_min", -3500, "Lower limit of the lava sea")
|
|
|
|
|
|
|
|
setting("float", "lava_sea_threshold", 0.2, "Cavern threshold for sunless and magma seas (higher number means sparser magma)")
|
|
|
|
setting("bool", "enable_lava_sea", true, "Enable magma sea level")
|
2018-04-20 16:41:17 +02:00
|
|
|
|
|
|
|
if minetest.get_modpath("tnt") then
|
|
|
|
dfcaverns.config.enable_tnt = minetest.settings:get_bool("enable_tnt")
|
|
|
|
if dfcaverns.config.enable_tnt == nil then
|
|
|
|
-- Default to enabled when in singleplayer
|
|
|
|
dfcaverns.config.enable_tnt = minetest.is_singleplayer()
|
|
|
|
end
|
|
|
|
end
|
2018-04-22 16:01:13 +02:00
|
|
|
|
2018-04-23 04:16:20 +02:00
|
|
|
dfcaverns.config.sunless_sea_level = dfcaverns.config.level3_min - (dfcaverns.config.level3_min - dfcaverns.config.sunless_sea_min) * 0.5
|