fun_caves/init.lua

108 lines
2.7 KiB
Lua

fun_caves = {}
fun_caves.version = "1.0"
fun_caves.time_factor = 10 -- affects growth abms
fun_caves.light_max = 8 -- light intensity for mushroom growth
fun_caves.path = minetest.get_modpath(minetest.get_current_modname())
fun_caves.world = minetest.get_worldpath()
fun_caves.elixir_armor = minetest.setting_getbool('fun_caves_use_armor_elixirs')
if fun_caves.elixir_armor == nil then
fun_caves.elixir_armor = true
end
fun_caves.expire_elixir_on_death = minetest.setting_getbool('fun_caves_expire_elixir_on_death')
if fun_caves.expire_elixir_on_death == nil then
fun_caves.expire_elixir_on_death = true
end
fun_caves.exploding_fungi = minetest.setting_getbool('fun_caves_exploding_fungi')
if fun_caves.exploding_fungi == nil then
fun_caves.exploding_fungi = true
end
fun_caves.breakable_wood = minetest.setting_getbool('fun_caves_breakable_wood')
if fun_caves.breakable_wood == nil then
fun_caves.breakable_wood = false
end
fun_caves.DEBUG = false -- for maintenance only
local inp = io.open(fun_caves.world..'/fun_caves_data.txt','r')
if inp then
local d = inp:read('*a')
fun_caves.db = minetest.deserialize(d)
else
fun_caves.db = {}
end
-- whether to use biomes and heightmap
fun_caves.use_bi_hi = false
local mg_params = minetest.get_mapgen_params()
if mg_params and mg_params.mgname ~= "v6" and mg_params.mgname ~= "v5" then
fun_caves.use_bi_hi = true
end
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({flags="nocaves,nodungeons"})
end)
-- Check if the table contains an element.
function table.contains(table, element)
for key, value in pairs(table) do
if value == element then
if key then
return key
else
return true
end
end
end
return false
end
-- Modify a node to add a group
function minetest.add_group(node, groups)
local def = minetest.registered_items[node]
if not def then
return false
end
local def_groups = def.groups or {}
for group, value in pairs(groups) do
if value ~= 0 then
def_groups[group] = value
else
def_groups[group] = nil
end
end
minetest.override_item(node, {groups = def_groups})
return true
end
function fun_caves.clone_node(name)
local node = minetest.registered_nodes[name]
local node2 = table.copy(node)
return node2
end
--dofile(fun_caves.path .. "/recipe_list.lua")
dofile(fun_caves.path .. "/abms.lua")
dofile(fun_caves.path .. "/nodes.lua")
dofile(fun_caves.path .. "/deco.lua")
dofile(fun_caves.path .. "/fungal_tree.lua")
dofile(fun_caves.path .. "/elixir.lua")
dofile(fun_caves.path .. "/wallhammer.lua")
dofile(fun_caves.path .. "/mapgen.lua")
dofile(fun_caves.path .. "/chat.lua")
if mobs and mobs.mod == "redo" then
dofile(fun_caves.path .. "/mobs.lua")
end
--fun_caves.print_recipes()