Move trees into their own mod.

Tell all versions of the mapgen never to place them, and only
ever use decoration placement system.
This commit is contained in:
Aaron Suen 2018-11-01 23:06:06 -04:00
parent 0cc6ecfebe
commit 5aab77a031
8 changed files with 56 additions and 55 deletions

View File

@ -1,22 +0,0 @@
local minetest = minetest
local modname = minetest.get_current_modname()
minetest.register_decoration({
deco_type = "schematic",
place_on = {modname .. ":dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = -0.008,
scale = 0.012,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"unknown"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath(modname) .. "/schematics/tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})

View File

@ -3,10 +3,4 @@ local modname = minetest.get_current_modname()
local path = minetest.get_modpath(modname)
dofile(path .. "/node.lua")
minetest.clear_registered_biomes()
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
dofile(path .. "/biome.lua")
dofile(path .. "/decor.lua")

View File

@ -60,9 +60,20 @@ regterrain({
},
})
minetest.register_alias("mapgen_snow", "air")
minetest.register_alias("mapgen_snowblock", "air")
minetest.register_alias("mapgen_junglegrass", "air")
for _, v in ipairs({
"snow",
"snowblock",
"junglegrass",
"tree",
"jungletree",
"pine_tree",
"leaves",
"apple",
"jungleleaves",
"pine_needles"
}) do
minetest.register_alias("mapgen_" .. v, "air")
end
regterrain({
description = "Dirt",
@ -109,30 +120,6 @@ regterrain({
"desert_sand"
},
})
regterrain({
description = "Tree",
tiles = {
modname .. "_tree_top.png",
modname .. "_tree_top.png",
modname .. "_tree_side.png"
},
mapgen = {
"tree",
"jungletree",
"pine_tree"
}
})
regterrain({
description = "Leaves",
drawtype = "allfaces_optional",
paramtype = "light",
mapgen = {
"leaves",
"apple",
"jungleleaves",
"pine_needles"
}
})
regliquid({
description = "Water",

42
mods/nc_tree/init.lua Normal file
View File

@ -0,0 +1,42 @@
local minetest = minetest
local modname = minetest.get_current_modname()
minetest.register_node(modname .. ":tree", {
description = "Tree",
tiles = {
modname .. "_tree_top.png",
modname .. "_tree_top.png",
modname .. "_tree_side.png"
}
})
minetest.register_node(modname .. ":leaves", {
description = "Leaves",
drawtype = "allfaces_optional",
paramtype = "light",
tiles = { modname .. "_leaves.png" }
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"nc_terrain:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = -0.008,
scale = 0.012,
spread = {x = 250, y = 250, z = 250},
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = {"unknown"},
y_min = 1,
y_max = 31000,
schematic = minetest.get_modpath(modname) .. "/schematics/tree.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
replacements = {
["nc_terrain:tree"] = modname .. ":tree",
["nc_terrain:leaves"] = modname .. ":leaves",
}
})

View File

Before

Width:  |  Height:  |  Size: 677 B

After

Width:  |  Height:  |  Size: 677 B

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 670 B