dfcaverns/df_trees/init.lua
2020-02-17 22:36:53 -07:00

76 lines
2.0 KiB
Lua

df_trees = {}
local modname = minetest.get_current_modname()
df_trees.S = minetest.get_translator(modname)
local modpath = minetest.get_modpath(modname)
df_trees.node_sound_tree_soft_fungus_defaults = function(table)
table = table or {}
table.footstep = table.footstep or
{name = "dfcaverns_fungus_footstep", gain = 0.3}
default.node_sound_wood_defaults(table)
return table
end
--load companion lua files
dofile(modpath.."/config.lua")
dofile(modpath.."/doc.lua")
dofile(modpath.."/aliases.lua")
local S = df_trees.S
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")
dofile(modpath.."/spindlestem.lua")