From 5aab77a0313f90728c27834610889a80f11543de Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Thu, 1 Nov 2018 23:06:06 -0400 Subject: [PATCH] Move trees into their own mod. Tell all versions of the mapgen never to place them, and only ever use decoration placement system. --- mods/nc_terrain/decor.lua | 22 --------- mods/nc_terrain/init.lua | 6 --- mods/nc_terrain/node.lua | 41 ++++++----------- mods/nc_tree/init.lua | 42 ++++++++++++++++++ .../schematics/tree.mts | Bin .../textures/nc_tree_leaves.png} | Bin .../textures/nc_tree_tree_side.png} | Bin .../textures/nc_tree_tree_top.png} | Bin 8 files changed, 56 insertions(+), 55 deletions(-) delete mode 100644 mods/nc_terrain/decor.lua create mode 100644 mods/nc_tree/init.lua rename mods/{nc_terrain => nc_tree}/schematics/tree.mts (100%) rename mods/{nc_terrain/textures/nc_terrain_leaves.png => nc_tree/textures/nc_tree_leaves.png} (100%) rename mods/{nc_terrain/textures/nc_terrain_tree_side.png => nc_tree/textures/nc_tree_tree_side.png} (100%) rename mods/{nc_terrain/textures/nc_terrain_tree_top.png => nc_tree/textures/nc_tree_tree_top.png} (100%) diff --git a/mods/nc_terrain/decor.lua b/mods/nc_terrain/decor.lua deleted file mode 100644 index 2d9d5848..00000000 --- a/mods/nc_terrain/decor.lua +++ /dev/null @@ -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", - }) \ No newline at end of file diff --git a/mods/nc_terrain/init.lua b/mods/nc_terrain/init.lua index 5332604f..71af8c29 100644 --- a/mods/nc_terrain/init.lua +++ b/mods/nc_terrain/init.lua @@ -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") diff --git a/mods/nc_terrain/node.lua b/mods/nc_terrain/node.lua index 17954ee5..153321cd 100644 --- a/mods/nc_terrain/node.lua +++ b/mods/nc_terrain/node.lua @@ -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", diff --git a/mods/nc_tree/init.lua b/mods/nc_tree/init.lua new file mode 100644 index 00000000..b67074f6 --- /dev/null +++ b/mods/nc_tree/init.lua @@ -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", + } + }) \ No newline at end of file diff --git a/mods/nc_terrain/schematics/tree.mts b/mods/nc_tree/schematics/tree.mts similarity index 100% rename from mods/nc_terrain/schematics/tree.mts rename to mods/nc_tree/schematics/tree.mts diff --git a/mods/nc_terrain/textures/nc_terrain_leaves.png b/mods/nc_tree/textures/nc_tree_leaves.png similarity index 100% rename from mods/nc_terrain/textures/nc_terrain_leaves.png rename to mods/nc_tree/textures/nc_tree_leaves.png diff --git a/mods/nc_terrain/textures/nc_terrain_tree_side.png b/mods/nc_tree/textures/nc_tree_tree_side.png similarity index 100% rename from mods/nc_terrain/textures/nc_terrain_tree_side.png rename to mods/nc_tree/textures/nc_tree_tree_side.png diff --git a/mods/nc_terrain/textures/nc_terrain_tree_top.png b/mods/nc_tree/textures/nc_tree_tree_top.png similarity index 100% rename from mods/nc_terrain/textures/nc_terrain_tree_top.png rename to mods/nc_tree/textures/nc_tree_tree_top.png