dfcaverns/df_trees/init.lua

67 lines
1.7 KiB
Lua
Raw Normal View History

df_trees = {}
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/doc.lua")
dofile(modpath.."/aliases.lua")
local S, NS = dofile(modpath.."/intllib.lua")
df_trees.register_all_stairs = function(name, override_def)
local mod = "df_trees"
local node_def = minetest.registered_nodes[mod..":"..name]
override_def = override_def or {}
-- Note that a circular table reference will result in a crash, TODO: guard against that.
-- Unlikely to be needed, though - it'd take a lot of work for users to get into this bit of trouble.
local function deep_copy(table_in)
local table_out = {}
for index, value in pairs(table_in) do
if type(value) == "table" then
table_out[index] = deep_copy(value)
else
table_out[index] = value
end
end
return table_out
end
local node_copy = deep_copy(node_def)
for index, value in pairs(override_def) do
node_copy[index] = value
end
if minetest.get_modpath("stairs") then
stairs.register_stair_and_slab(
name,
mod ..":" .. name,
node_copy.groups,
node_copy.tiles,
S("@1 Stair", node_copy.description),
S("@1 Slab", node_copy.description),
node_copy.sounds
)
end
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(mod, name, mod..":"..name, node_copy)
end
end
dofile(modpath.."/blood_thorn.lua")
dofile(modpath.."/fungiwood.lua")
dofile(modpath.."/tunnel_tube.lua")
dofile(modpath.."/spore_tree.lua")
dofile(modpath.."/black_cap.lua")
dofile(modpath.."/nether_cap.lua")
dofile(modpath.."/goblin_cap.lua")
dofile(modpath.."/tower_cap.lua")
dofile(modpath.."/torchspine.lua")