mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-07-13 05:50:29 +02:00
Modpack refactor (#4)
Split this mod into a set of sub-mods in a modpack, and in the process did a whole bunch of renovations. * updated Subterrane's API to allow for more patterned placement of things * added "warrens" * clean separation of flooded and non-flooded caverns * rearranged biomes to make cavern layers more distinct * added oil layer * added underworld layer
This commit is contained in:
66
df_trees/init.lua
Normal file
66
df_trees/init.lua
Normal file
@ -0,0 +1,66 @@
|
||||
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")
|
||||
|
||||
|
Reference in New Issue
Block a user