From 636ce285556f10dceab16359ab1d76c3ff007b91 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Mon, 19 Aug 2024 09:07:23 +0100 Subject: [PATCH] make registered decoration more readable --- decor.lua | 926 ++++++++++++++++++++++++------------------------------ 1 file changed, 409 insertions(+), 517 deletions(-) diff --git a/decor.lua b/decor.lua index 31a2c48..8278950 100644 --- a/decor.lua +++ b/decor.lua @@ -1,678 +1,600 @@ +-- register decoration helper + +local function register_decoration(enabled, def) + + if enabled ~= 1 then return end + + def.sidelen = def.sidelen or 80 -- some handy defaults + def.deco_type = "simple" + def.y_min = def.y_min or 1 + def.y_max = def.y_max or 100 + + minetest.register_decoration(def) +end + -- wild cotton added in 5.3.0 -if minetest.registered_nodes["farming:cotton_wild"] then - - minetest.register_decoration({ - name = "farming:cotton_wild", - deco_type = "simple", - place_on = {"default:dry_dirt_with_dry_grass"}, - sidelen = 16, - noise_params = { - offset = -0.1, - scale = 0.1, - spread = {x = 50, y = 50, z = 50}, - seed = 4242, - octaves = 3, - persist = 0.7 - }, - biomes = {"savanna"}, - y_max = 31000, - y_min = 1, - decoration = "farming:cotton_wild" - }) -end +register_decoration(1, { + name = "farming:cotton_wild", + place_on = {"default:dry_dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.1, scale = 0.1, spread = {x = 50, y = 50, z = 50}, + seed = 4242, octaves = 3, persist = 0.7 + }, + biomes = {"savanna"}, + decoration = "farming:cotton_wild"}) -- water pools in swamp areas -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dirt_with_grass"}, + sidelen = 4, place_offset_y = -1, - sidelen = 16, fill_ratio = 0.01, biomes = {"swamp"}, - y_max = 2, - y_min = 1, + y_min = 1, y_max = 2, flags = "force_placement", decoration = "default:water_source", - spawn_by = "default:dirt_with_grass", - num_spawn_by = 8 -}) + spawn_by = "default:dirt_with_grass", num_spawn_by = 8}) -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dirt_with_grass"}, + sidelen = 4, place_offset_y = -1, - sidelen = 16, fill_ratio = 0.1, biomes = {"swamp"}, - y_max = 2, - y_min = 1, + y_min = 1, y_max = 2, flags = "force_placement", decoration = "default:water_source", - spawn_by = {"default:dirt_with_grass", "default:water_source"}, - num_spawn_by = 8 -}) + spawn_by = {"default:dirt_with_grass", "default:water_source"}, num_spawn_by = 8}) -- dry dirt patches -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dry_dirt_with_dry_grass"}, sidelen = 4, noise_params = { - offset = -1.5, - scale = -1.5, - spread = {x = 200, y = 200, z = 200}, - seed = 329, - octaves = 4, - persist = 1.0 + offset = -1.5, scale = -1.5, spread = {x = 200, y = 200, z = 200}, + seed = 329, octaves = 4, persist = 1.0 }, biomes = {"savanna"}, - y_max = 31000, - y_min = 1, decoration = "default:dry_dirt", place_offset_y = -1, flags = "force_placement" }) --- helper string +-- firethorn shrub -local tmp - --- decoration helper function - -local function add_deco(a, b, c, d, e, f, g, h, i, j) - - if j ~= 1 then return end - - minetest.register_decoration({ - deco_type = "simple", - place_on = a, - sidelen = 80, - fill_ratio = b, - biomes = c, - y_min = d, - y_max = e, - decoration = f, - height_max = g, - spawn_by = h, - num_spawn_by = i - }) -end - ---firethorn shrub - -add_deco({"default:snowblock"}, 0.001, {"glacier"}, 1, 30, - {"ethereal:firethorn"}, nil, nil, nil, ethereal.glacier) +register_decoration(ethereal.glacier, { + place_on = "default:snowblock", + fill_ratio = 0.001, + biomes = {"glacier"}, + y_min = 1, y_max = 30, + decoration = "ethereal:firethorn"}) -- scorched tree -add_deco({"ethereal:dry_dirt"}, 0.006, {"plains"}, 1, 100, - {"ethereal:scorched_tree"}, 6, nil, nil, ethereal.plains) +register_decoration(ethereal.plains, { + place_on = "ethereal:dry_dirt", + fill_ratio = 0.006, + biomes = {"plains"}, + decoration = "ethereal:scorched_tree", height_max = 6}) -- dry shrub -add_deco({"ethereal:dry_dirt"}, 0.015, {"plains"}, 1, 100, - {"default:dry_shrub"}, nil, nil, nil, ethereal.plains) +register_decoration(ethereal.plains, { + place_on = {"ethereal:dry_dirt"}, + fill_ratio = 0.015, + biomes = {"plains"}, + decoration = "default:dry_shrub"}) -add_deco({"default:sand"}, 0.015, {"deciduous_forest_ocean"}, 1, 100, - {"default:dry_shrub"}, nil, nil, nil, ethereal.grassy) +register_decoration(ethereal.grassy, { + place_on = {"default:sand"}, + fill_ratio = 0.015, + biomes = {"deciduous_forest_ocean"}, + decoration = "default:dry_shrub"}) -add_deco({"default:desert_sand"}, 0.015, {"desert"}, 1, 100, - {"default:dry_shrub"}, nil, nil, nil, ethereal.desert) +register_decoration(ethereal.desert, { + place_on = {"default:desert_sand"}, + fill_ratio = 0.015, + biomes = {"desert"}, + decoration = "default:dry_shrub"}) -add_deco({"default:sandstone"}, 0.015, {"sandstone_desert"}, 1, 100, - {"default:dry_shrub"}, nil, nil, nil, ethereal.sandstone) +register_decoration(ethereal.sandstone, { + place_on = {"default:sandstone"}, + fill_ratio = 0.015, + biomes = {"sandstone_desert"}, + decoration = "default:dry_shrub"}) -add_deco({"bakedclay:red", "bakedclay:orange"}, 0.015, {"mesa"}, 1, 100, - {"default:dry_shrub"}, nil, nil, nil, ethereal.mesa) +register_decoration(ethereal.mesa, { + place_on = {"default:dirt_with_dry_grass"}, + fill_ratio = 0.015, + biomes = {"mesa"}, + decoration = "default:dry_shrub"}) -- dry grass -add_deco({"default:dry_dirt_with_dry_grass", - "default:dirt_with_dry_grass"}, 0.25, {"savanna"}, 1, 100, - {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", - "default:dry_grass_5"}, nil, nil, nil, ethereal.savanna) +register_decoration(ethereal.savanna, { + place_on = {"default:dry_dirt_with_dry_grass", "default:dirt_with_dry_grass"}, + fill_ratio = 0.25, + biomes = {"savanna"}, + decoration = {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", + "default:dry_grass_5"}}) -add_deco({"default:dirt_with_dry_grass"}, 0.10, {"mesa"}, 1, 100, - {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", - "default:dry_grass_5"}, nil, nil, nil, ethereal.mesa) +register_decoration(ethereal.mesa, { + place_on = {"default:dirt_with_dry_grass"}, + fill_ratio = 0.10, + biomes = {"mesa"}, + decoration = {"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4", + "default:dry_grass_5"}}) -add_deco({"default:desert_stone"}, 0.005, {"caves"}, 5, 40, - {"default:dry_grass_2", "default:dry_grass_3", "default:dry_shrub"}, - nil, nil, nil, ethereal.caves) +register_decoration(ethereal.caves, { + place_on = {"default:desert_stone"}, + fill_ratio = 0.005, + biomes = {"caves"}, + y_min = 5, y_max = 42, + decoration = {"default:dry_grass_2", "default:dry_grass_3", "default:dry_shrub"}}) -- flowers & strawberry -add_deco({"default:dirt_with_grass"}, 0.025, {"deciduous_forest"}, 1, 100, - {"flowers:dandelion_white", "flowers:dandelion_yellow", - "flowers:geranium", "flowers:rose", "flowers:tulip", - "flowers:viola", "ethereal:strawberry_7"}, nil, nil, nil, - ethereal.grassy) - -add_deco({"default:dirt_with_grass"}, 0.025, {"grassytwo"}, 1, 100, - {"flowers:dandelion_white", "flowers:dandelion_yellow", - "flowers:geranium", "flowers:rose", "flowers:tulip", - "flowers:viola", "ethereal:strawberry_7"}, nil, nil, nil, - ethereal.grassytwo) +register_decoration((ethereal.grassy or ethereal.grassytwo), { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.025, + biomes = {"deciduous_forest", "grassytwo"}, + decoration = {"flowers:dandelion_white", "flowers:dandelion_yellow", + "flowers:geranium", "flowers:rose", "flowers:tulip", + "flowers:viola", "ethereal:strawberry_7"}}) -- prairie flowers & strawberry -add_deco({"ethereal:prairie_dirt"}, 0.035, {"prairie"}, 1, 100, - {"flowers:dandelion_white", "flowers:dandelion_yellow", - "flowers:geranium", "flowers:rose", "flowers:tulip", - "flowers:viola", "ethereal:strawberry_7", - "flowers:chrysanthemum_green", "flowers:tulip_black"}, nil, nil, nil, - ethereal.prairie) +register_decoration(ethereal.prairie, { + place_on = {"ethereal:prairie_dirt"}, + fill_ratio = 0.035, + biomes = {"prairie"}, + decoration = {"flowers:dandelion_white", "flowers:dandelion_yellow", + "flowers:geranium", "flowers:rose", "flowers:tulip", + "flowers:viola", "ethereal:strawberry_7", "flowers:chrysanthemum_green", + "flowers:tulip_black"}}) --- crystal spike & crystal grass +-- crystal spike & grass -add_deco({"ethereal:crystal_dirt"}, 0.02, {"frost", "frost_floatland"}, 1, 1750, - {"ethereal:crystal_spike", "ethereal:crystalgrass"}, nil, nil, nil, - ethereal.frost) +register_decoration(ethereal.frost, { + place_on = {"ethereal:crystal_dirt"}, + fill_ratio = 0.02, + biomes = {"frost", "frost_floatland"}, + y_min = 1, y_max = 1750, + decoration = {"ethereal:crystal_spike", "ethereal:crystalgrass"}}) -- red shrub -add_deco({"ethereal:fiery_dirt"}, 0.10, {"fiery"}, 1, 100, - {"ethereal:dry_shrub"}, nil, nil, nil, ethereal.fiery) +register_decoration(ethereal.fiery, { + place_on = {"ethereal:fiery_dirt"}, + fill_ratio = 0.10, + biomes = {"fiery"}, + decoration = "ethereal:dry_shrub"}) -- snowy grass -add_deco({"ethereal:gray_dirt"}, 0.05, {"grayness"}, 1, 100, - {"ethereal:snowygrass"}, nil, nil, nil, ethereal.grayness) -add_deco({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, 0.05, - {"coniferous_forest"}, 1, 100, {"ethereal:snowygrass"}, nil, nil, nil, ethereal.snowy) +register_decoration((ethereal.grayness or ethereal.snowy), { + place_on = {"ethereal:gray_dirt", "ethereal:cold_dirt", + "default:dirt_with_coniferous_litter"}, + fill_ratio = 0.05, + biomes = {"grayness", "coniferous_forest"}, + decoration = "ethereal:snowygrass"}) -- cactus -add_deco({"default:sandstone"}, 0.002, {"sandstone_desert"}, 1, 100, - {"default:cactus"}, 3, nil, nil, ethereal.sandstone) +register_decoration(ethereal.sandstone, { + place_on = {"default:sandstone"}, + fill_ratio = 0.002, + biomes = {"sandstone_desert"}, + decoration = "default:cactus", height_max = 3}) -add_deco({"default:desert_sand"}, 0.005, {"desert"}, 1, 100, - {"default:cactus"}, 4, nil, nil, ethereal.desert) +register_decoration(ethereal.desert, { + place_on = {"default:desert_sand"}, + fill_ratio = 0.005, + biomes = {"desert"}, + decoration = "default:cactus", height_max = 4}) -- spore grass -add_deco({"ethereal:mushroom_dirt"}, 0.1, {"mushroom"}, 1, 100, - {"ethereal:spore_grass"}, nil, nil, nil, ethereal.mushroom) +register_decoration(ethereal.mushroom, { + place_on = {"ethereal:mushroom_dirt"}, + fill_ratio = 0.1, + biomes = {"mushroom"}, + decoration = "ethereal:spore_grass"}) --- red and brown mushrooms +-- red & brown mushroom -minetest.register_decoration({ - deco_type = "simple", - place_on = { - "default:dirt_with_rainforest_litter", "default:dirt_with_grass", - "ethereal:prairie_dirt", "ethereal:mushroom_dirt" - }, +register_decoration(1, { + place_on = {"default:dirt_with_rainforest_litter", "default:dirt_with_grass", + "ethereal:prairie_dirt", "ethereal:mushroom_dirt"}, sidelen = 16, fill_ratio = 0.01, - biomes = { - "junglee", "deciduous_forest", "grassytwo", "prairie", "swamp", "mushroom" - }, - y_min = 1, - y_max = 120, - decoration = {"flowers:mushroom_brown", "flowers:mushroom_red"} -}) + biomes = {"junglee", "deciduous_forest", "grassytwo", "prairie", "swamp", "mushroom"}, + decoration = {"flowers:mushroom_brown", "flowers:mushroom_red"}}) -- jungle grass -add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, - 0.10, {"junglee"}, 1, 100, {"default:junglegrass"}, nil, nil, nil, - ethereal.junglee) +register_decoration(ethereal.junglee, { + place_on = {"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, + fill_ratio = 0.1, + biomes = {"junglee"}, + decoration = "default:junglegrass"}) -add_deco({"default:dirt_with_grass"}, 0.15, {"jumble"}, 1, 100, - {"default:junglegrass"}, nil, nil, nil, ethereal.jumble) +register_decoration(ethereal.jumble, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.15, + biomes = {"jumble"}, + decoration = "default:junglegrass"}) -add_deco({"default:dirt_with_grass"}, 0.25, {"swamp"}, 1, 100, - {"default:junglegrass"}, nil, nil, nil, ethereal.swamp) +register_decoration(ethereal.swamp, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.25, + biomes = {"swamp"}, + decoration = "default:junglegrass"}) -- grass -add_deco({"default:dirt_with_grass"}, 0.35, {"deciduous_forest"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.grassy) +register_decoration(1, { + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter", + "ethereal:prairie_dirt", "ethereal:grove_dirt", "ethereal:bamboo_dirt"}, + fill_ratio = 0.35, + biomes = {"deciduous_forest", "grassytwo", "jumble", "junglee", "grove", "prairie", + "mediterranean", "bamboo", "sakura"}, + decoration = {"default:grass_2", "default:grass_3", "default:grass_4", + "default:grass_5"}}) -add_deco({"default:dirt_with_grass"}, 0.35, {"grassytwo"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.grassytwo) +register_decoration(1, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.35, + biomes = {"grassland", "swamp"}, + decoration = {"default:grass_3", "default:grass_4"}}) -add_deco({"default:dirt_with_grass"}, 0.35, {"jumble"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.jumble) +-- lilac -add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, - 0.35, {"junglee"}, 1, 100, {"default:grass_2", "default:grass_3", - "default:grass_4", "default:grass_5"}, nil, nil, nil, ethereal.junglee) - -add_deco({"ethereal:prairie_dirt"}, 0.35, {"prairie"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.prairie) - -add_deco({"ethereal:grove_dirt"}, 0.35, {"grove"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.grove) - -add_deco({"ethereal:grove_dirt"}, 0.35, {"mediterranean"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.mediterranean) - -add_deco({"ethereal:bamboo_dirt"}, 0.35, {"bamboo"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.bamboo) - -add_deco({"default:dirt_with_grass"}, 0.35, {"grassland", "swamp"}, - 1, 100, {"default:grass_3", "default:grass_4"}, nil, nil, nil, 1) - -add_deco({"ethereal:bamboo_dirt"}, 0.35, {"sakura"}, 1, 100, - {"default:grass_2", "default:grass_3", "default:grass_4", - "default:grass_5"}, nil, nil, nil, ethereal.sakura) - -add_deco({"ethereal:bamboo_dirt"}, 0.025, {"sakura"}, 1, 100, - {"ethereal:lilac"}, nil, nil, nil, ethereal.sakura) +register_decoration(ethereal.sakura, { + place_on = {"ethereal:bamboo_dirt"}, + fill_ratio = 0.25, + biomes = {"sakura"}, + decoration = "ethereal:lilac"}) -- marram grass -add_deco({"default:sand"}, 0.25, {"sandclay"}, 3, 4, {"default:marram_grass_1", - "default:marram_grass_2", "default:marram_grass_3"}, nil, nil, nil, - ethereal.sandclay) +register_decoration(ethereal.sandclay, { + place_on = {"default:sand"}, + fill_ratio = 0.25, + biomes = {"sandclay"}, + decoration = {"default:marram_grass_1", "default:marram_grass_2", + "default:marram_grass_3"}}) -- ferns -add_deco({"ethereal:grove_dirt"}, 0.2, {"grove"}, 1, 100, {"ethereal:fern"}, - nil, nil, nil, ethereal.grove) +register_decoration(ethereal.grove, { + place_on = {"ethereal:grove_dirt"}, + fill_ratio = 0.2, + biomes = {"grove"}, + decoration = "ethereal:fern"}) -add_deco({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 100, - {"ethereal:fern"}, nil, nil, nil, ethereal.swamp) +register_decoration(ethereal.swamp, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.1, + biomes = {"swamp"}, + decoration = "ethereal:fern"}) -add_deco({"ethereal:crystal_dirt"}, 0.001, {"frost_floatlands"}, 1025, 1750, - {"ethereal:fern"}, nil, nil, nil, ethereal.frost) +register_decoration(ethereal.frost, { -- chance of something edible so high up + place_on = {"ethereal:crystal_dirt"}, + fill_ratio = 0.001, + y_min = 1025, y_max = 1750, + biomes = {"frost_floatland"}, + decoration = "ethereal:fern"}) -- snow -add_deco({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, - 0.8, {"coniferous_forest"}, 20, 40, {"default:snow"}, nil, nil, nil, ethereal.snowy) +register_decoration(ethereal.snowy, { + place_on = {"default:dirt_with_coniferous_litter"}, + fill_ratio = 0.8, + y_min = 20, y_max = 40, + biomes = {"coniferous_forest"}, + decoration = "default:snow"}) -add_deco({"default:dirt_with_snow"}, 0.8, {"taiga"}, 40, 140, - {"default:snow"}, nil, nil, nil, ethereal.alpine) +register_decoration(ethereal.alpine, { + place_on = {"default:dirt_with_snow"}, + fill_ratio = 0.8, + y_min = 40, y_max = 140, + biomes = {"taiga"}, + decoration = "default:snow"}) --- Check onion setting +-- wild onion and setting local abundant = minetest.settings:get_bool("ethereal.abundant_onions") ~= false -local onion_rate = abundant and 0.025 or 0.005 --- wild onion - -add_deco({"default:dirt_with_grass", "ethereal:prairie_dirt"}, onion_rate, - {"deciduous_forest", "grassytwo", "jumble", "prairie"}, 1, 100, - {"ethereal:onion_4"}, nil, nil, nil, 1) +register_decoration(1, { + place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt"}, + fill_ratio = (abundant and 0.025 or 0.005), + biomes = {"deciduous_forest", "grassytwo", "jumble", "prairie"}, + decoration = "ethereal:onion_4"}) -- papyrus -add_deco({"default:dirt_with_grass"}, 0.1, {"deciduous_forest"}, 1, 1, - {"default:papyrus"}, 4, "default:water_source", 1, ethereal.grassy) - -add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, - 0.1, {"junglee"}, 1, 1, {"default:papyrus"}, 4, "default:water_source", - 1, ethereal.junglee) - -add_deco({"default:dirt_with_grass"}, 0.1, {"swamp"}, 1, 1, - {"default:papyrus"}, 4, "default:water_source", 1, ethereal.swamp) +register_decoration((ethereal.grassy or ethereal.junglee or ethereal.swamp), { + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + fill_ratio = 0.1, + y_min = 1, y_max = 1, + biomes = {"deciduous_forest", "junglee", "swamp"}, + decoration = "default:papyrus", height_max = 4, + spawn_by = "default:water_source", num_spawn_by = 1}) --= Farming Redo plants if farming and farming.mod and farming.mod == "redo" then -print ("[MOD] Ethereal - Farming Redo detected and in use") +print ("[MOD] Ethereal - Farming Redo detected") -- potato -add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, - 0.002, {"junglee"}, 1, 100, {"farming:potato_3"}, nil, nil, nil, - ethereal.junglee) +register_decoration(ethereal.junglee, { + place_on = {"default:dirt_with_rainforest_litter"}, + fill_ratio = 0.002, + biomes = {"junglee"}, + decoration = "farming:potato_3"}) -- carrot, cucumber, potato, tomato, corn, coffee, raspberry, rhubarb -add_deco({"default:dirt_with_grass"}, 0.002, {"grassytwo"}, 1, 100, - {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", - "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", - "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", - "farming:cabbage_6", "farming:lettuce_5", "farming:sunflower_8", - "farming:asparagus"}, nil, nil, nil, - ethereal.grassytwo) +register_decoration(ethereal.grassytwo, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.002, + biomes = {"grassytwo"}, + decoration = {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", + "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", + "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", + "farming:blueberry_4", "farming:cabbage_6", "farming:lettuce_5", + "farming:sunflower_8", "farming:asparagus_4"}}) -add_deco({"default:dirt_with_grass"}, 0.002, {"deciduous_forest"}, 1, 100, - {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", - "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", - "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", - "farming:beetroot_5", "farming:sunflower_8", - "farming:eggplant_3"}, nil, nil, nil, ethereal.grassy) +register_decoration(ethereal.grassy, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.002, + biomes = {"grassytwo"}, + decoration = {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", + "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", + "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", + "farming:blueberry_4", "farming:cabbage_6", "farming:lettuce_5", + "farming:sunflower_8", "farming:eggplant_3"}}) -add_deco({"default:dirt_with_grass"}, 0.002, {"jumble"}, 1, 100, - {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:vanilla_7", - "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", - "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", - "farming:cabbage_6", "farming:lettuce_5", - "farming:spinach_3"}, nil, nil, nil, ethereal.jumble) +register_decoration(ethereal.jumble, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.002, + biomes = {"jumble"}, + decoration = {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", + "farming:vanilla_7", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", + "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", + "farming:blueberry_4", "farming:cabbage_6", "farming:lettuce_5", + "farming:spinage_3"}}) -add_deco({"ethereal:prairie_dirt"}, 0.025, {"prairie"}, 1, 100, - {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", "farming:parsley_3", - "farming:tomato_7", "farming:corn_8", "farming:coffee_5", "farming:blackberry_4", - "farming:raspberry_4", "farming:rhubarb_3", "farming:blueberry_4", - "farming:pea_5", "farming:beetroot_5", "farming:sunflower_8"}, nil, nil, nil, - ethereal.prairie) +register_decoration(ethereal.prairie, { + place_on = {"ethereal:prairie_dirt"}, + fill_ratio = 0.025, + biomes = {"prairie"}, + decoration = {"farming:carrot_7", "farming:cucumber_4", "farming:potato_3", + "farming:parsley_3", "farming:tomato_7", "farming:corn_8", "farming:coffee_5", + "farming:blackberry_4", "farming:raspberry_4", "farming:rhubarb_3", + "farming:blueberry_4", "farming:pea_5", "farming:beetroot_5", + "farming:sunflower_8"}}) -add_deco({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 1, 100, - {"farming:parsley_3"}, nil, nil, nil, ethereal.mediterranean) +register_decoration(ethereal.mediterranean, { + place_on = {"ethereal:grove_dirt"}, + fill_ratio = 0.002, + biomes = {"mediterranean"}, + decoration = "farming:parsley_3"}) -- melon and pumpkin -add_deco({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, - 0.001, {"junglee"}, 1, 1, {"farming:melon_8", "farming:pumpkin_8"}, - nil, "default:water_source", 1, ethereal.junglee) - -add_deco({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 1, - {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", - 1, ethereal.grassy) - -add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 1, - {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", - 1, ethereal.grassytwo) - -add_deco({"default:dirt_with_grass"}, 0.001, {"jumble"}, 1, 1, - {"farming:melon_8", "farming:pumpkin_8"}, nil, "default:water_source", - 1, ethereal.jumble) +register_decoration(1, { + place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"}, + fill_ratio = 0.001, + y_min = 1, y_max = 1, + biomes = {"junglee", "deciduous_forest", "grassytwo", "jumble"}, + decoration = {"farming:melon_8", "farming:pumpkin_8"}, + spawn_by = "default:water_source", num_spawn_by = 1}) -- mint -add_deco({"default:dirt_with_grass", "default:dirt_with_coniferous_litter", - "ethereal:bamboo_dirt"}, 0.005, nil, 1, 75, "farming:mint_4", nil, - {"group:water", "group:sand"}, 1, 1) +register_decoration(1, { + place_on = {"default:dirt_with_grass", "default:dirt_with_coniferous_litter", + "ethereal:bamboo_dirt"}, + fill_ratio = 0.005, + y_min = 1, y_max = 75, + decoration = "farming:mint_4", + spawn_by = {"group:water", "group:sand"}, num_spawn_by = 1}) -- green beans -add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, - {"farming:beanbush"}, nil, nil, nil, ethereal.grassytwo) +register_decoration(ethereal.grassytwo, { + place_on = {"default:dirt_with_grass"}, + fill_ratio = 0.001, + biomes = {"grassytwo"}, + decoration = "farming:beanbush"}) -- grape bushel -add_deco({"default:dirt_with_grass"}, 0.001, {"grassytwo"}, 1, 100, - {"farming:grapebush"}, nil, nil, nil, ethereal.grassytwo) - -add_deco({"default:dirt_with_grass"}, 0.001, {"deciduous_forest"}, 1, 100, - {"farming:grapebush"}, nil, nil, nil, ethereal.grassy) - -add_deco({"ethereal:prairie_dirt"}, 0.001, {"prairie"}, 1, 100, - {"farming:grapebush"}, nil, nil, nil, ethereal.prairie) +register_decoration((ethereal.grassy or ethereal.grassytwo or ethereal.prairie), { + place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt"}, + fill_ratio = 0.001, + biomes = {"grassy", "grassytwo", "prairie"}, + decoration = "farming:grapebush"}) -- chili, garlic, pepper, onion, hemp, soy, ginger -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt", "default:dirt_with_rainforest_litter"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.002, - spread = {x = 100, y = 100, z = 100}, - seed = 760, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.002, spread = {x = 100, y = 100, z = 100}, + seed = 760, octaves = 3, persist = 0.6 }, - y_min = 5, - y_max = 35, + y_min = 5, y_max = 35, decoration = { "farming:chili_8", "farming:garlic_5", "farming:pepper_5", "farming:pepper_6", "farming:onion_5", "farming:hemp_7", "farming:pepper_7", "farming:soy_5", - "farming:ginger" - }, - spawn_by = "group:tree", - num_spawn_by = 1 -}) + "farming:ginger"}, + spawn_by = "group:tree", num_spawn_by = 1}) -- pineapple,soy -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dirt_with_dry_grass"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.002, - spread = {x = 100, y = 100, z = 100}, - seed = 917, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.002, spread = {x = 100, y = 100, z = 100}, + seed = 917, octaves = 3, persist = 0.6 }, - y_min = 18, - y_max = 30, - decoration = {"farming:pineapple_8", "farming:soy_5"} -}) + y_min = 18, y_max = 30, + decoration = {"farming:pineapple_8", "farming:soy_5"}}) -- artichoke -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"ethereal:grove_dirt"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.002, - spread = {x = 100, y = 100, z = 100}, - seed = 448, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.002, spread = {x = 100, y = 100, z = 100}, + seed = 448, octaves = 3, persist = 0.6 }, - y_min = 15, - y_max = 40, + y_min = 15, y_max = 40, decoration = {"farming:artichoke_5"}, - spawn_by = "group:tree", - num_spawn_by = 1 -}) -end + spawn_by = "group:tree", num_spawn_by = 1}) + +end -- end farming -- new flowers from baked clay mod if minetest.get_modpath("bakedclay") then -minetest.register_decoration({ - deco_type = "simple", - place_on = { - "ethereal:prairie_dirt", "default:dirt_with_grass", "ethereal:grove_dirt" - }, +register_decoration(1, { + place_on = {"ethereal:prairie_dirt", "default:dirt_with_grass", "ethereal:grove_dirt"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.004, - spread = {x = 100, y = 100, z = 100}, - seed = 7133, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.004, spread = {x = 100, y = 100, z = 100}, + seed = 7133, octaves = 3, persist = 0.6 }, - y_min = 10, - y_max = 90, - decoration = "bakedclay:delphinium" -}) + y_min = 10, y_max = 90, + decoration = "bakedclay:delphinium"}) -minetest.register_decoration({ - deco_type = "simple", - place_on = { - "ethereal:prairie_dirt", "default:dirt_with_grass", - "ethereal:grove_dirt", "ethereal:bamboo_dirt" - }, +register_decoration(1, { + place_on = {"ethereal:prairie_dirt", "default:dirt_with_grass", + "ethereal:grove_dirt", "ethereal:bamboo_dirt"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.004, - spread = {x = 100, y = 100, z = 100}, - seed = 7134, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.004, spread = {x = 100, y = 100, z = 100}, + seed = 7134, octaves = 3, persist = 0.6 }, - y_min = 15, - y_max = 90, - decoration = "bakedclay:thistle" -}) + y_min = 15, y_max = 90, + decoration = "bakedclay:thistle"}) -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.01, - spread = {x = 100, y = 100, z = 100}, - seed = 7135, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.01, spread = {x = 100, y = 100, z = 100}, + seed = 7135, octaves = 3, persist = 0.6 }, - y_min = 1, - y_max = 90, + y_min = 1, y_max = 90, decoration = "bakedclay:lazarus", - spawn_by = "default:jungletree", - num_spawn_by = 1 -}) + spawn_by = "default:jungletree", num_spawn_by = 1}) -minetest.register_decoration({ - deco_type = "simple", +register_decoration(1, { place_on = {"default:dirt_with_grass", "default:sand"}, sidelen = 16, noise_params = { - offset = 0, - scale = 0.009, - spread = {x = 100, y = 100, z = 100}, - seed = 7136, - octaves = 3, - persist = 0.6 + offset = 0, scale = 0.009, spread = {x = 100, y = 100, z = 100}, + seed = 7136, octaves = 3, persist = 0.6 }, - y_min = 1, - y_max = 15, + y_min = 1, y_max = 15, decoration = "bakedclay:mannagrass", - spawn_by = "group:water", - num_spawn_by = 1 -}) + spawn_by = "group:water", num_spawn_by = 1}) end -- blue agave from wine mod -if ethereal.desert == 1 and minetest.get_modpath("wine") then +if minetest.get_modpath("wine") then - minetest.register_decoration({ - deco_type = "simple", + register_decoration(ethereal.desert, { place_on = {"default:desert_sand"}, sidelen = 16, fill_ratio = 0.001, biomes = {"desert"}, - decoration = {"wine:blue_agave"} - }) + decoration = {"wine:blue_agave"}}) end +-- ferns -if ethereal.snowy == 1 then +local function register_fern_decoration(seed, length) - local function register_fern_decoration(seed, length) - - minetest.register_decoration({ - name = "default:fern_" .. length, - deco_type = "simple", - place_on = { - "ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, - sidelen = 16, - noise_params = { - offset = 0, - scale = 0.2, - spread = {x = 100, y = 100, z = 100}, - seed = seed, - octaves = 3, - persist = 0.7 - }, - y_max = 31000, - y_min = 6, - decoration = "default:fern_" .. length - }) - end - - register_fern_decoration(14936, 3) - register_fern_decoration(801, 2) - register_fern_decoration(5, 1) -end - --- Tundra moss and stones - -if ethereal.tundra == 1 then - - -- Tundra moss - - minetest.register_decoration({ - deco_type = "simple", - place_on = {"default:permafrost_with_stones"}, - sidelen = 4, + register_decoration(ethereal.snowy, { + name = "default:fern_" .. length, + place_on = {"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"}, + sidelen = 16, noise_params = { - offset = -0.8, - scale = 2.0, - spread = {x = 100, y = 100, z = 100}, - seed = 53995, - octaves = 3, - persist = 1.0 + offset = 0, scale = 0.2, spread = {x = 100, y = 100, z = 100}, + seed = seed, octaves = 3, persist = 0.7 }, - biomes = {"tundra"}, - y_max = 50, - y_min = 2, - decoration = "default:permafrost_with_moss", - place_offset_y = -1, - flags = "force_placement" - }) - - -- Tundra patchy snow - - minetest.register_decoration({ - deco_type = "simple", - place_on = { - "default:permafrost_with_moss", - "default:permafrost_with_stones", - "default:stone", - "default:gravel" - }, - sidelen = 4, - noise_params = { - offset = 0, - scale = 1.0, - spread = {x = 100, y = 100, z = 100}, - seed = 172555, - octaves = 3, - persist = 1.0 - }, - biomes = {"tundra", "tundra_beach"}, - y_max = 50, - y_min = 1, - decoration = "default:snow" - }) + y_min = 6, y_max = 100, + decoration = "default:fern_" .. length}) end +register_fern_decoration(14936, 3) +register_fern_decoration(801, 2) +register_fern_decoration(5, 1) + +-- Tundra moss + +register_decoration(ethereal.tundra, { + place_on = {"default:permafrost_with_stones"}, + sidelen = 4, + noise_params = { + offset = -0.8, scale = 2.0, spread = {x = 100, y = 100, z = 100}, + seed = 53995, octaves = 3, persist = 1.0 + }, + biomes = {"tundra"}, + y_min = 2, y_max = 50, + decoration = "default:permafrost_with_moss", + place_offset_y = -1, + flags = "force_placement"}) + +-- Tundra patchy snow + +register_decoration(ethereal.tundra, { + place_on = {"default:permafrost_with_moss", "default:permafrost_with_stones", + "default:stone", "default:gravel"}, + sidelen = 4, + noise_params = { + offset = 0, scale = 1.0, spread = {x = 100, y = 100, z = 100}, + seed = 172555, octaves = 3, persist = 1.0 + }, + biomes = {"tundra", "tundra_beach"}, + y_min = 1, y_max = 50, + decoration = "default:snow"}) + -- butterflies mod if minetest.get_modpath("butterflies") then - minetest.register_decoration({ + register_decoration(1, { name = "butterflies:butterfly", - deco_type = "simple", place_on = {"default:dirt_with_grass", "ethereal:prairie_dirt"}, place_offset_y = 2, - sidelen = 80, fill_ratio = 0.005, biomes = {"deciduous_forest", "grassytwo", "prairie", "jumble"}, - y_max = 31000, - y_min = 1, + y_min = 1, y_max = 200, decoration = { "butterflies:butterfly_white", "butterflies:butterfly_red", "butterflies:butterfly_violet" }, - spawn_by = "group:flower", - num_spawn_by = 1 - }) + spawn_by = "group:flower", num_spawn_by = 1}) -- restart butterfly timers minetest.register_lbm({ @@ -691,25 +613,17 @@ end if minetest.get_modpath("fireflies") then - minetest.register_decoration({ + register_decoration(1, { name = "fireflies:firefly_low", - deco_type = "simple", - place_on = { - "default:dirt_with_grass", - "default:dirt_with_coniferous_litter", - "default:dirt_with_rainforest_litter", - "default:dirt", - "ethereal:cold_dirt", "prairie" - }, + place_on = {"default:dirt_with_grass", "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", "default:dirt", + "ethereal:cold_dirt", "prairie"}, place_offset_y = 2, - sidelen = 80, fill_ratio = 0.0005, - biomes = { - "deciduous_forest", "grassytwo", "coniferous_forest", "junglee", "swamp"}, - y_max = 31000, - y_min = -1, - decoration = "fireflies:hidden_firefly" - }) + biomes = {"deciduous_forest", "grassytwo", "coniferous_forest", "junglee", + "swamp"}, + y_min = -1, y_max = 200, + decoration = "fireflies:hidden_firefly"}) -- restart firefly timers minetest.register_lbm({ @@ -723,71 +637,49 @@ end -- Coral Reef -minetest.register_decoration({ +register_decoration(1, { name = "default:corals", - deco_type = "simple", place_on = {"default:sand"}, place_offset_y = -1, sidelen = 4, noise_params = { - offset = -4, - scale = 4, - spread = {x = 50, y = 50, z = 50}, - seed = 7013, - octaves = 3, - persist = 0.7, + offset = -4, scale = 4, spread = {x = 50, y = 50, z = 50}, + seed = 7013, octaves = 3, persist = 0.7, }, biomes = {"desert_ocean", "savanna_ocean", "junglee_ocean"}, - y_max = -2, - y_min = -8, + y_min = -8, y_max = -2, flags = "force_placement", - decoration = { - "default:coral_green", "default:coral_pink", - "default:coral_cyan", "default:coral_brown", - "default:coral_orange", "default:coral_skeleton" - } -}) + decoration = {"default:coral_green", "default:coral_pink", "default:coral_cyan", + "default:coral_brown", "default:coral_orange", "default:coral_skeleton"}}) -- Kelp -minetest.register_decoration({ +register_decoration(1, { name = "default:kelp", - deco_type = "simple", place_on = {"default:sand"}, place_offset_y = -1, sidelen = 16, noise_params = { - offset = -0.04, - scale = 0.1, - spread = {x = 200, y = 200, z = 200}, - seed = 87112, - octaves = 3, - persist = 0.7 + offset = -0.04, scale = 0.1, spread = {x = 200, y = 200, z = 200}, + seed = 87112, octaves = 3, persist = 0.7 }, - biomes = { - "frost_ocean", "deciduous_forest_ocean", "sandstone_ocean", "swamp_ocean"}, - y_max = -5, - y_min = -10, + biomes = {"frost_ocean", "deciduous_forest_ocean", "sandstone_ocean", "swamp_ocean"}, + y_min = -10, y_max = -5, flags = "force_placement", decoration = "default:sand_with_kelp", - param2 = 48, - param2_max = 96 -}) + param2 = 48, param2_max = 96}) -- illumishrooms using underground decoration placement local function add_illumishroom(low, high, nodename) - minetest.register_decoration({ - deco_type = "simple", + register_decoration(1, { place_on = {"default:stone_with_coal"}, sidelen = 16, fill_ratio = 0.5, - y_max = high, - y_min = low, + y_min = low, y_max = high, flags = "force_placement, all_floors", - decoration = nodename - }) + decoration = nodename}) end add_illumishroom(-1000, -30, "ethereal:illumishroom")