From dfeffc85224fe8055fa47e94b3422245ee2636cf Mon Sep 17 00:00:00 2001 From: kno10 Date: Thu, 31 Oct 2024 18:27:21 +0100 Subject: [PATCH] reorg terrain features with biomes --- mods/MAPGEN/mcl_mapgen_core/api.lua | 6 +- mods/MAPGEN/mcl_structures/init.lua | 23 -- mods/MAPGEN/mcl_structures/witch_hut.lua | 33 +- mods/MAPGEN/mcl_terrain_features/init.lua | 361 ------------------ mods/MAPGEN/mcl_terrain_features/mod.conf | 3 - mods/MAPGEN/vl_biomes/deco/boulder.lua | 59 +++ mods/MAPGEN/vl_biomes/deco/corals.lua | 21 +- mods/MAPGEN/vl_biomes/deco/fallentree.lua | 100 +++++ .../deco}/fossil.lua | 6 +- .../deco}/geode.lua | 6 +- mods/MAPGEN/vl_biomes/deco/lakes.lua | 142 +++++++ mods/MAPGEN/vl_biomes/init.lua | 5 + mods/MAPGEN/vl_biomes/nether/basaltdelta.lua | 143 +++++++ .../schematics/coral_cora.mts | Bin .../schematics/mcl_structures_boulder.mts | Bin .../mcl_structures_boulder_small.mts | Bin .../mcl_structures_coral_brain_1.mts | Bin .../mcl_structures_coral_brain_2.mts | Bin .../mcl_structures_coral_bubble_1.mts | Bin .../mcl_structures_coral_bubble_2.mts | Bin .../mcl_structures_coral_fire_1.mts | Bin .../mcl_structures_coral_fire_2.mts | Bin .../mcl_structures_coral_horn_1.mts | Bin .../mcl_structures_coral_horn_2.mts | Bin .../mcl_structures_coral_tube_1.mts | Bin .../mcl_structures_coral_tube_2.mts | Bin .../mcl_structures_fossil_skull_1.mts | Bin .../mcl_structures_fossil_skull_2.mts | Bin .../mcl_structures_fossil_skull_3.mts | Bin .../mcl_structures_fossil_skull_4.mts | Bin .../mcl_structures_fossil_spine_1.mts | Bin .../mcl_structures_fossil_spine_2.mts | Bin .../mcl_structures_fossil_spine_3.mts | Bin .../mcl_structures_fossil_spine_4.mts | Bin .../mcl_structures_ice_spike_large.mts | Bin .../mcl_structures_ice_spike_small.mts | Bin mods/MAPGEN/vl_biomes/snowy_plains_spikes.lua | 20 +- mods/MAPGEN/vl_biomes/taiga_old_pine.lua | 43 --- mods/MAPGEN/vl_biomes/taiga_old_spruce.lua | 43 --- .../vl_extra_structures/witches_circle.lua | 37 +- 40 files changed, 525 insertions(+), 526 deletions(-) delete mode 100644 mods/MAPGEN/mcl_terrain_features/init.lua delete mode 100644 mods/MAPGEN/mcl_terrain_features/mod.conf create mode 100644 mods/MAPGEN/vl_biomes/deco/boulder.lua create mode 100644 mods/MAPGEN/vl_biomes/deco/fallentree.lua rename mods/MAPGEN/{mcl_structures => vl_biomes/deco}/fossil.lua (81%) rename mods/MAPGEN/{mcl_structures => vl_biomes/deco}/geode.lua (95%) create mode 100644 mods/MAPGEN/vl_biomes/deco/lakes.lua rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/coral_cora.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_boulder.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_boulder_small.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_brain_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_brain_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_bubble_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_bubble_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_fire_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_fire_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_horn_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_horn_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_tube_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_coral_tube_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_skull_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_skull_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_skull_3.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_skull_4.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_spine_1.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_spine_2.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_spine_3.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_fossil_spine_4.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_ice_spike_large.mts (100%) rename mods/MAPGEN/{mcl_structures => vl_biomes}/schematics/mcl_structures_ice_spike_small.mts (100%) diff --git a/mods/MAPGEN/mcl_mapgen_core/api.lua b/mods/MAPGEN/mcl_mapgen_core/api.lua index 8ad5e6583..23875f45d 100644 --- a/mods/MAPGEN/mcl_mapgen_core/api.lua +++ b/mods/MAPGEN/mcl_mapgen_core/api.lua @@ -220,16 +220,16 @@ local function sort_decorations() for _, key in ipairs(keys) do local def = map[key] if def.name and minetest.get_decoration_id(def.name) then - minetest.log("warning", "Decoration ID not unique: "..def.name) + minetest.log("warning", "Decoration ID not unique: "..tostring(def.name or key)) end local deco_id = minetest.register_decoration(def) if not deco_id then - error("Failed to register decoration "..tostring(def.name).." - name not unique?") + error("Failed to register decoration "..tostring(def.name or key).." - name not unique or schematic not found?") end if def.name then deco_id = minetest.get_decoration_id(def.name) if not deco_id then - error("Failed to register decoration "..tostring(def.name).." - name not unique?") + error("Failed to register decoration "..tostring(def.name or key).." - name not unique?") end if def.gen_callback then minetest.set_gen_notify({decoration = true}, {deco_id}) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 9c323fac2..1209b920b 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -31,8 +31,6 @@ dofile(modpath.."/desert_temple.lua") dofile(modpath.."/desert_well.lua") dofile(modpath.."/end_city.lua") dofile(modpath.."/end_spawn.lua") -dofile(modpath.."/fossil.lua") -dofile(modpath.."/geode.lua") dofile(modpath.."/igloo.lua") dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") @@ -43,24 +41,3 @@ dofile(modpath.."/shipwrecks.lua") dofile(modpath.."/witch_hut.lua") dofile(modpath.."/woodland_mansion.lua") -vl_structures.register_structure("boulder",{ - -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct - filenames = { - -- small boulder 3x as likely - modpath.."/schematics/mcl_structures_boulder_small.mts", - modpath.."/schematics/mcl_structures_boulder_small.mts", - modpath.."/schematics/mcl_structures_boulder_small.mts", - modpath.."/schematics/mcl_structures_boulder.mts", - }, -}) - -vl_structures.register_structure("ice_spike_small",{ - -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct - filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" }, -}) - -vl_structures.register_structure("ice_spike_large",{ - -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct - filenames = { modpath.."/schematics/mcl_structures_ice_spike_large.mts" }, -}) - diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 611a75f31..abb97dd24 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -6,23 +6,21 @@ local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false) local function spawn_witch(p1,p2) local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"}) - if c then - local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"}) - local witch - if not peaceful then - witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity() - witch._home = c - witch.can_despawn = false - end - local catobject = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat") - if catobject and catobject:get_pos() then - local cat=catobject:get_luaentity() - cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) - cat.owner = "!witch!" --so it's not claimable by player - cat._home = c - cat.can_despawn = false - end - return + if not c then return end + local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"}) + local witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch") + if witchobj then + local witch = witchobj:get_luaentity() + witch._home = c + witch.can_despawn = false + end + local catobj = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat") + if catobj then + local cat=catobj:get_luaentity() + cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) + cat.owner = "!witch!" --so it's not claimable by player + cat._home = c + cat.can_despawn = false end end @@ -30,7 +28,6 @@ local function hut_placement_callback(pos,def,pr,p1,p2) -- p1.y is the bottom slice only, not a typo, we look for the hut legs local legs = minetest.find_nodes_in_area(p1,vector.new(p2.x,p1.y,p2.z), "mcl_core:tree") local tree = {} - -- TODO: port leg generation to VoxelManip? for _,leg in pairs(legs) do while true do local name = minetest.get_node(vector.offset(leg,0,-1,0)).name diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua deleted file mode 100644 index bc48c19eb..000000000 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ /dev/null @@ -1,361 +0,0 @@ -local adjacents = { - vector.new(1,0,0), - vector.new(1,0,1), - vector.new(1,0,-1), - vector.new(-1,0,0), - vector.new(-1,0,1), - vector.new(-1,0,-1), - vector.new(0,0,1), - vector.new(0,0,-1), - vector.new(0,-1,0) -} - -local function airtower(pos,tbl,h) - for i=1,h do - table.insert(tbl,vector.offset(pos,0,i,0)) - end -end - -local function makelake(pos,size,liquid,placein,border,pr,noair) - local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size) - local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size) - minetest.emerge_area(e1, e2, function(_, _, calls_remaining) - if calls_remaining ~= 0 then return end - local nn = minetest.find_nodes_in_area(p1,p2,placein) - if not nn[1] then return end - table.sort(nn,function(a, b) - return vector.distance(pos, a) < vector.distance(pos, b) - end) - local y = pos.y - 1 - local lq, air = {}, {} - local r = pr:next(1,#nn) - for i=1,r do - airtower(nn[i],air,20) - table.insert(lq,nn[i]) - end - minetest.bulk_swap_node(lq,{name=liquid}) - minetest.bulk_swap_node(air,{name="air"}) - air = {} - local br = {} - for k,v in pairs(lq) do - for kk,vv in pairs(adjacents) do - local pp = vector.add(v,vv) - local an = minetest.get_node(pp) - if not border then - if minetest.get_item_group(an.name,"solid") > 0 then - border = an.name - elseif minetest.get_item_group(minetest.get_node(nn[1]).name,"solid") > 0 then - border = minetest.get_node_or_nil(nn[1]).name - else - border = "mcl_core:stone" - end - if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end - end - if not noair and an.name ~= liquid then - table.insert(br,pp) - --[[ no need to have air above border: - local un = minetest.get_node(vector.offset(pp,0,1,0)) - if un.name ~= liquid then - airtower(pp,air,20) - end]]-- - end - end - end - minetest.bulk_swap_node(br,{name=border}) - minetest.bulk_swap_node(air,{name="air"}) - return true - end) - return true -end - -local mushrooms = {"mcl_mushrooms:mushroom_brown","mcl_mushrooms:mushroom_red"} - -local function place_fallen_tree(pos,def,pr) - local tree = minetest.find_node_near(pos,15,{"group:tree"}) - if not tree then return end - tree = minetest.get_node(tree).name - local minlen, maxlen = 3, 9 - local vrate, mrate = 120, 160 - local len = pr:next(minlen,maxlen) - local dir = pr:next(0,3) - local dx, dy, dz, param2, w1, w2 - if dir == 0 then - dx, dy, dz, param2, w1, w2 = 1, 0, 0, 12, 5, 4 - elseif dir == 1 then - dx, dy, dz, param2, w1, w2 = -1, 0, 0, 12, 4, 5 - elseif dir == 2 then - dx, dy, dz, param2, w1, w2 = 0, 0, 1, 6, 3, 2 - else -- if dir == 3 then - dx, dy, dz, param2, w1, w2 = 0, 0, -1, 6, 2, 3 - end - -- TODO: port this to voxel manipulators - -- ensure we have room for the tree - local minsupport, maxsupport = 99, 1 - for i = 1,len do - -- check below - local n = minetest.get_node(vector.offset(pos, dx * i, -1, dz * i)).name - local nd = minetest.registered_nodes[n] - if n ~= "air" and nd.groups and nd.groups.solid and i > 2 then - if i < minsupport then minsupport = i end - maxsupport = i - end - -- check space - local n = minetest.get_node(vector.offset(pos, dx * i, 0, dz * i)).name - local nd = minetest.registered_nodes[n] - if n ~= "air" and nd.groups and not nd.groups.plant then - if i < minlen or pr:next(1,maxsupport) == 1 then return end - len = i - break - end - end - if maxsupport - minsupport < minlen then return end - len = math.min(len, maxsupport - 1) - if len < minlen then return end - -- place the tree - minetest.swap_node(pos, {name = tree, param2 = 0}) - -- some are hollow: - if vl_hollow_logs.logs and pr:next(1,20) == 1 then - local nam = string.sub(tree, string.find(tree, ":") + 1) - nam = "vl_hollow_logs:"..nam.."_hollow" - if minetest.registered_nodes[nam] then tree = nam end - end - for i = 2,len do - minetest.swap_node(vector.offset(pos, dx * i, 0, dz * i), {name = tree, param2 = param2}) - if pr:next(0,255) < vrate then - local side = vector.offset(pos, dx * i + dz, 0, dz * i + dx) - local n = minetest.get_node(side).name - if n == "air" then - minetest.swap_node(side, {name="mcl_core:vine", param2=w1}) - end - end - if pr:next(0,255) < vrate then - local side = vector.offset(pos, dx * i - dz, 0, dz * i - dx) - local n = minetest.get_node(side).name - if n == "air" then - minetest.swap_node(side, {name="mcl_core:vine", param2=w2}) - end - end - if pr:next(0,255) < mrate then - local top = vector.offset(pos, dx * i, 1, dz * i) - local n = minetest.get_node(top).name - if n == "air" then - minetest.swap_node(top, {name = mushrooms[pr:next(1,#mushrooms)], param2 = 12}) - end - end - end -end - -vl_structures.register_structure("fallen_tree",{ - priority = 1100, -- after regular trees - place_on = {"group:grass_block"}, - terrain_feature = true, - noise_params = { - offset = 0.00018, - scale = 0.01011, - spread = {x = 250, y = 250, z = 250}, - seed = 24533, - octaves = 3, - persist = 0.66 - }, - flags = "place_center_x, place_center_z", - solid_ground = true, - y_max = mcl_vars.mg_overworld_max, - y_min = minetest.get_mapgen_setting("water_level"), - place_func = place_fallen_tree -}) - -vl_structures.register_structure("lavapool",{ - place_on = {"group:sand", "group:dirt", "group:stone"}, - terrain_feature = true, - noise_params = { - offset = 0, - scale = 0.0000022, - spread = {x = 250, y = 250, z = 250}, - seed = 78375213, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, - flags = "place_center_x, place_center_z, all_floors", - y_max = mcl_vars.mg_overworld_max, - y_min = minetest.get_mapgen_setting("water_level"), - place_func = function(pos, _, pr) - return makelake(pos,5,"mcl_core:lava_source",{"group:material_stone", "group:sand", "group:dirt"},"mcl_core:stone",pr) - end -}) - -vl_structures.register_structure("water_lake",{ - place_on = {"group:dirt","group:stone"}, - terrain_feature = true, - noise_params = { - offset = 0, - scale = 0.000032, - spread = {x = 250, y = 250, z = 250}, - seed = 756641353, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, - flags = "place_center_x, place_center_z, all_floors", - y_max = mcl_vars.mg_overworld_max, - y_min = minetest.get_mapgen_setting("water_level"), - place_func = function(pos, _, pr) - return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},"mcl_core:dirt_with_grass",pr) - end -}) - -vl_structures.register_structure("water_lake_mangrove_swamp",{ - place_on = {"mcl_mud:mud"}, - biomes = { "MangroveSwamp" }, - terrain_feature = true, - noise_params = { - offset = 0, - scale = 0.0032, - spread = {x = 250, y = 250, z = 250}, - seed = 6343241353, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, - flags = "place_center_x, place_center_z, all_floors", - y_max = mcl_vars.mg_overworld_max, - y_min = minetest.get_mapgen_setting("water_level"), - place_func = function(pos, _, pr) - return makelake(pos,3,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block","mcl_mud:mud"},"mcl_mud:mud",pr,true) - end -}) - -vl_structures.register_structure("basalt_column",{ - place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, - terrain_feature = true, - spawn_by = {"air"}, - num_spawn_by = 2, - noise_params = { - offset = 0, - scale = 0.003, - spread = {x = 250, y = 250, z = 250}, - seed = 72235213, - octaves = 5, - persist = 0.3, - flags = "absvalue", - }, - flags = "all_floors", - y_max = mcl_vars.mg_nether_max - 20, - y_min = mcl_vars.mg_lava_nether_max + 1, - biomes = { "BasaltDelta" }, - place_func = function(pos, _, pr) - local nn = minetest.find_nodes_in_area(vector.offset(pos,-5,-1,-5),vector.offset(pos,5,-1,5),{"air","mcl_blackstone:basalt","mcl_blackstone:blackstone"}) - table.sort(nn,function(a, b) - return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) - end) - if #nn < 1 then return false end - local basalt = {} - local magma = {} - for i=1,pr:next(1,#nn) do - if minetest.get_node(vector.offset(nn[i],0,-1,0)).name ~= "air" then - local dst=vector.distance(pos,nn[i]) - local r = pr:next(1,14)-dst - for ii=0,r do - if pr:next(1,25) == 1 then - table.insert(magma,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) - else - table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) - end - end - end - end - minetest.bulk_swap_node(magma,{name="mcl_nether:magma"}) - minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"}) - return true - end -}) -vl_structures.register_structure("basalt_pillar",{ - place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, - terrain_feature = true, - noise_params = { - offset = 0, - scale = 0.001, - spread = {x = 250, y = 250, z = 250}, - seed = 7113, - octaves = 5, - persist = 0.1, - flags = "absvalue", - }, - flags = "all_floors", - y_max = mcl_vars.mg_nether_max-40, - y_min = mcl_vars.mg_lava_nether_max + 1, - biomes = { "BasaltDelta" }, - place_func = function(pos, _, pr) - local nn = minetest.find_nodes_in_area(vector.offset(pos,-2,-1,-2),vector.offset(pos,2,-1,2),{"air","mcl_blackstone:basalt","mcl_blackstone:blackstone"}) - table.sort(nn,function(a, b) - return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) - end) - if #nn < 1 then return false end - local basalt = {} - local magma = {} - for i=1,pr:next(1,#nn) do - if minetest.get_node(vector.offset(nn[i],0,-1,0)).name ~= "air" then - local dst=vector.distance(pos,nn[i]) - for ii=0,pr:next(19,35)-dst do - if pr:next(1,20) == 1 then - table.insert(magma,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) - else - table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) - end - end - end - end - minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"}) - minetest.bulk_swap_node(magma,{name="mcl_nether:magma"}) - return true - end -}) - -vl_structures.register_structure("lavadelta",{ - place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, - spawn_by = {"mcl_blackstone:basalt","mcl_blackstone:blackstone"}, - num_spawn_by = 2, - terrain_feature = true, - noise_params = { - offset = 0, - scale = 0.005, - spread = {x = 250, y = 250, z = 250}, - seed = 78375213, - octaves = 5, - persist = 0.1, - flags = "absvalue", - }, - flags = "all_floors", - y_max = mcl_vars.mg_nether_max, - y_min = mcl_vars.mg_lava_nether_max + 1, - biomes = { "BasaltDelta" }, - place_func = function(pos, _, pr) - local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-10,-1,-10),vector.offset(pos,10,-2,10),{"mcl_blackstone:basalt","mcl_blackstone:blackstone","mcl_nether:netherrack"}) - table.sort(nn,function(a, b) - return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) - end) - if #nn < 1 then return false end - local lava = {} - for i=1,pr:next(1,#nn) do - table.insert(lava,nn[i]) - end - minetest.bulk_swap_node(lava,{name="mcl_nether:nether_lava_source"}) - local basalt = {} - local magma = {} - for _,v in pairs(lava) do - for _,vv in pairs(adjacents) do - local p = vector.add(v,vv) - if minetest.get_node(p).name ~= "mcl_nether:nether_lava_source" then - table.insert(basalt,p) - - end - end - if math.random(3) == 1 then - table.insert(magma,v) - end - end - minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"}) - minetest.bulk_swap_node(magma,{name="mcl_nether:magma"}) - return true - end -}) diff --git a/mods/MAPGEN/mcl_terrain_features/mod.conf b/mods/MAPGEN/mcl_terrain_features/mod.conf deleted file mode 100644 index 008e370cc..000000000 --- a/mods/MAPGEN/mcl_terrain_features/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mcl_terrain_features -author = cora -depends = mcl_init, mcl_structures diff --git a/mods/MAPGEN/vl_biomes/deco/boulder.lua b/mods/MAPGEN/vl_biomes/deco/boulder.lua new file mode 100644 index 000000000..59f2badfe --- /dev/null +++ b/mods/MAPGEN/vl_biomes/deco/boulder.lua @@ -0,0 +1,59 @@ +-- boulders, in MegaTaiga and MegaSpruceTaiga +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) + +-- Mossy cobblestone boulder (3x3) +mcl_mapgen_core.register_decoration({ + deco_type = "schematic", + place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, + terrain_feature = true, + sidelen = 80, + noise_params = { + offset = 0.00015, + scale = 0.001, + spread = vector.new(300, 300, 300), + seed = 775703, + octaves = 4, + persist = 0.63, + }, + biomes = { "MegaTaiga", "MegaSpruceTaiga" }, + y_min = 1, + y_max = vl_biomes.overworld_max, + schematic = modpath .. "/schematics/mcl_structures_boulder.mts", + flags = "place_center_x, place_center_z", + rotation = "random", +}) + +-- Small mossy cobblestone boulder (2x2) +mcl_mapgen_core.register_decoration({ + deco_type = "schematic", + place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, + terrain_feature = true, + sidelen = 80, + noise_params = { + offset = 0.001, + scale = 0.001, + spread = vector.new(300, 300, 300), + seed = 775704, + octaves = 4, + persist = 0.63, + }, + biomes = { "MegaTaiga", "MegaSpruceTaiga" }, + y_min = 1, + y_max = vl_biomes.overworld_max, + schematic = modpath .. "/schematics/mcl_structures_boulder_small.mts", + flags = "place_center_x, place_center_z", + rotation = "random", +}) + +vl_structures.register_structure("boulder", { + -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct + filenames = { + -- small boulder 3x as likely + modpath.."/schematics/mcl_structures_boulder_small.mts", + modpath.."/schematics/mcl_structures_boulder_small.mts", + modpath.."/schematics/mcl_structures_boulder_small.mts", + modpath.."/schematics/mcl_structures_boulder.mts", + }, +}) + diff --git a/mods/MAPGEN/vl_biomes/deco/corals.lua b/mods/MAPGEN/vl_biomes/deco/corals.lua index 21c58881d..60e965369 100644 --- a/mods/MAPGEN/vl_biomes/deco/corals.lua +++ b/mods/MAPGEN/vl_biomes/deco/corals.lua @@ -1,5 +1,7 @@ --- TODO: use priorities, and move this to the module where coral blocks are defined? -local mod_mcl_structures = minetest.get_modpath("mcl_structures") +-- TODO: move this to the mcl_ocean module? +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) + local coral_min = vl_biomes.OCEAN_MIN local coral_max = -10 local warm_oceans = table.copy(vl_biomes.by_water_temp.warm) @@ -21,12 +23,13 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do mcl_mapgen_core.register_decoration({ deco_type = "schematic", place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"}, + terrain_feature = true, sidelen = 80, noise_params = noise, biomes = warm_oceans, y_min = coral_min, y_max = coral_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_coral_" .. c .. "_1.mts", + schematic = modpath .. "/schematics/mcl_structures_coral_" .. c .. "_1.mts", rotation = "random", flags = "all_floors,force_placement", spawn_by = "mcl_core:water_source", @@ -36,12 +39,13 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do mcl_mapgen_core.register_decoration({ deco_type = "schematic", place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"}, + terrain_feature = true, noise_params = noise, sidelen = 80, biomes = warm_oceans, y_min = coral_min, y_max = coral_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_coral_" .. c .. "_2.mts", + schematic = modpath .. "/schematics/mcl_structures_coral_" .. c .. "_2.mts", rotation = "random", flags = "all_floors,force_placement", spawn_by = "mcl_core:water_source", @@ -52,6 +56,7 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"mcl_ocean:" .. c .. "_coral_block"}, + terrain_feature = true, sidelen = 16, fill_ratio = 3, y_min = coral_min, @@ -69,6 +74,7 @@ end mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"}, + terrain_feature = true, sidelen = 16, noise_params = { offset = -0.0085, @@ -93,6 +99,7 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"mcl_ocean:dead_brain_coral_block"}, + terrain_feature = true, sidelen = 16, fill_ratio = 3, y_min = coral_min, @@ -107,6 +114,7 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"mcl_ocean:dead_brain_coral_block"}, + terrain_feature = true, sidelen = 16, fill_ratio = 3, y_min = coral_min, @@ -121,6 +129,7 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"mcl_ocean:dead_brain_coral_block"}, + terrain_feature = true, sidelen = 16, fill_ratio = 2, y_min = coral_min, @@ -135,6 +144,7 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "simple", place_on = {"mcl_ocean:dead_brain_coral_block"}, + terrain_feature = true, sidelen = 16, fill_ratio = 2, y_min = coral_min, @@ -150,12 +160,13 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "schematic", place_on = {"group:sand", "mcl_core:gravel"}, + terrain_feature = true, fill_ratio = 0.0001, sidelen = 80, biomes = warm_oceans, y_min = coral_min, y_max = coral_max, - schematic = mod_mcl_structures .. "/schematics/coral_cora.mts", + schematic = modpath .. "/schematics/coral_cora.mts", rotation = "random", flags = "all_floors,force_placement", spawn_by = "mcl_core:water_source", diff --git a/mods/MAPGEN/vl_biomes/deco/fallentree.lua b/mods/MAPGEN/vl_biomes/deco/fallentree.lua new file mode 100644 index 000000000..c8aeec7e5 --- /dev/null +++ b/mods/MAPGEN/vl_biomes/deco/fallentree.lua @@ -0,0 +1,100 @@ +-- TODO: allow longer logs in MegaTaiga? +local mg_name = minetest.get_mapgen_setting("mg_name") + +local mushrooms = {"mcl_mushrooms:mushroom_brown","mcl_mushrooms:mushroom_red"} + +vl_structures.register_structure("fallen_tree",{ + priority = 1100, -- after regular trees + place_on = {"group:grass_block"}, + terrain_feature = true, + noise_params = { + offset = 0.00018, + scale = 0.01011, + spread = {x = 250, y = 250, z = 250}, + seed = 24533, + octaves = 3, + persist = 0.66 + }, + flags = "place_center_x, place_center_z", + solid_ground = true, + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos,def,pr) + local tree = minetest.find_node_near(pos,15,{"group:tree"}) + if not tree then return end + tree = minetest.get_node(tree).name + local minlen, maxlen = 3, 9 + local vrate, mrate = 120, 160 + local len = pr:next(minlen,maxlen) + local dir = pr:next(0,3) + local dx, dy, dz, param2, w1, w2 + if dir == 0 then + dx, dy, dz, param2, w1, w2 = 1, 0, 0, 12, 5, 4 + elseif dir == 1 then + dx, dy, dz, param2, w1, w2 = -1, 0, 0, 12, 4, 5 + elseif dir == 2 then + dx, dy, dz, param2, w1, w2 = 0, 0, 1, 6, 3, 2 + else -- if dir == 3 then + dx, dy, dz, param2, w1, w2 = 0, 0, -1, 6, 2, 3 + end + -- ensure we have room for the tree + local minsupport, maxsupport = 99, 1 + for i = 1,len do + -- check below + local n = minetest.get_node(vector.offset(pos, dx * i, -1, dz * i)).name + local nd = minetest.registered_nodes[n] + if n ~= "air" and nd.groups and nd.groups.solid and i > 2 then + if i < minsupport then minsupport = i end + maxsupport = i + end + -- check space + local n = minetest.get_node(vector.offset(pos, dx * i, 0, dz * i)).name + local nd = minetest.registered_nodes[n] + if n ~= "air" and nd.groups and not nd.groups.plant then + if i < minlen or pr:next(1, maxsupport) == 1 then return end + len = i + break + end + end + if maxsupport - minsupport < minlen then return end + -- get the foliage palette for vines: + local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] + if biome and biome._mcl_foliage_palette_index then + w1 = biome._mcl_foliage_palette_index * 8 + w1 + w2 = biome._mcl_foliage_palette_index * 8 + w2 + end + len = math.min(len, maxsupport - 1) + if len < minlen then return end + -- place the upright tree trunk + minetest.swap_node(pos, { name = tree, param2 = 0 }) + -- some are hollow: + if vl_hollow_logs.logs and pr:next(1,20) == 1 then + local nam = string.sub(tree, string.find(tree, ":") + 1) + nam = "vl_hollow_logs:"..nam.."_hollow" + if minetest.registered_nodes[nam] then tree = nam end + end + for i = 2,len do + minetest.swap_node(vector.offset(pos, dx * i, 0, dz * i), { name = tree, param2 = param2 }) + -- add some vines + if pr:next(0,255) < vrate then + local side = vector.offset(pos, dx * i + dz, 0, dz * i + dx) + if minetest.get_node(side).name == "air" then + minetest.swap_node(side, { name = "mcl_core:vine", param2 = w1 }) + end + end + if pr:next(0,255) < vrate then + local side = vector.offset(pos, dx * i - dz, 0, dz * i - dx) + if minetest.get_node(side).name == "air" then + minetest.swap_node(side, { name = "mcl_core:vine", param2 = w2 }) + end + end + -- add some mushrooms + if pr:next(0,255) < mrate then + local top = vector.offset(pos, dx * i, 1, dz * i) + if minetest.get_node(top).name == "air" then + minetest.swap_node(top, { name = mushrooms[pr:next(1,#mushrooms)], param2 = 12 }) + end + end + end + end +}) diff --git a/mods/MAPGEN/mcl_structures/fossil.lua b/mods/MAPGEN/vl_biomes/deco/fossil.lua similarity index 81% rename from mods/MAPGEN/mcl_structures/fossil.lua rename to mods/MAPGEN/vl_biomes/deco/fossil.lua index 620abe338..4a42dd970 100644 --- a/mods/MAPGEN/mcl_structures/fossil.lua +++ b/mods/MAPGEN/vl_biomes/deco/fossil.lua @@ -1,10 +1,12 @@ local modname = minetest.get_current_modname() local modpath = minetest.get_modpath(modname) -vl_structures.register_structure("fossil",{ - place_on = {"group:material_stone","group:sand"}, +vl_structures.register_structure("fossil", { + place_on = { "group:material_stone", "group:sand" }, flags = "place_center_x, place_center_z", prepare = false, + priority = 900, -- actually a terrain feature, + terrain_feature = false, -- but add them to /locate nevertheless chunk_probability = 15, -- was 25, FIXME: needs rebalancing y_offset = function(pr) return pr:next(-32,-16) end, y_max = 15, diff --git a/mods/MAPGEN/mcl_structures/geode.lua b/mods/MAPGEN/vl_biomes/deco/geode.lua similarity index 95% rename from mods/MAPGEN/mcl_structures/geode.lua rename to mods/MAPGEN/vl_biomes/deco/geode.lua index 65790099a..0e906f2e3 100644 --- a/mods/MAPGEN/mcl_structures/geode.lua +++ b/mods/MAPGEN/vl_biomes/deco/geode.lua @@ -75,12 +75,12 @@ local function makegeode(pos, _, pr) return true end -vl_structures.register_structure("geode",{ - place_on = {"group:material_stone"}, +vl_structures.register_structure("geode", { + place_on = { "group:material_stone" }, noise_params = { offset = 0, scale = 0.00022, - spread = {x = 250, y = 250, z = 250}, + spread = vector.new(250, 250, 250), seed = 7894353, octaves = 3, persist = 0.001, diff --git a/mods/MAPGEN/vl_biomes/deco/lakes.lua b/mods/MAPGEN/vl_biomes/deco/lakes.lua new file mode 100644 index 000000000..9ca0c782a --- /dev/null +++ b/mods/MAPGEN/vl_biomes/deco/lakes.lua @@ -0,0 +1,142 @@ +-- TODO: overall, these pools tend to be very circular, can we make them more interesting? +-- TODO: use the terraforming from vl_terraforming instead of the airtower? + +local mg_name = minetest.get_mapgen_setting("mg_name") + +local adjacents = { + vector.new(1,0,0), + vector.new(1,0,1), + vector.new(1,0,-1), + vector.new(-1,0,0), + vector.new(-1,0,1), + vector.new(-1,0,-1), + vector.new(0,0,1), + vector.new(0,0,-1), + vector.new(0,-1,0) +} + +local function makelake(pos, size, liquid, placein, border, pr, noair) + local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size) + local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size) + minetest.emerge_area(e1, e2, function(_, _, calls_remaining) + if calls_remaining ~= 0 then return end + local nn = minetest.find_nodes_in_area(p1, p2, placein) + if not nn[1] then return end + table.sort(nn, function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + local y = pos.y - 1 + local lq, air = {}, {} + local r = pr:next(1,#nn) + for i=1,r do + for j = 1, 20 do + table.insert(air, vector.offset(nn[i], 0, j, 0)) + end + table.insert(lq, nn[i]) + end + minetest.bulk_swap_node(lq, { name = liquid }) + minetest.bulk_swap_node(air, { name = "air" }) + air = {} + local br = {} + for k,v in pairs(lq) do + for kk,vv in pairs(adjacents) do + local pp = vector.add(v,vv) + local an = minetest.get_node(pp) + -- if not border and minetest.get_item_group(an.name, "solid") > 0 then border = an end + if not noair and an.name ~= liquid then + table.insert(br,pp) + end + end + end + --[[ unused: + if not border then + if minetest.get_item_group(minetest.get_node(nn[1]).name, "solid") > 0 then + border = minetest.get_node_or_nil(nn[1]) + else + border = { name = "mcl_core:stone" } + end + end + if border == nil or border.name == "mcl_core:dirt" then + local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(nn[1]).biome)] + local p2 = biome and biome._mcl_grass_palette_index and biome._mcl_grass_palette_index or nil + border = { name = "mcl_core:dirt_with_grass", param2 = p2 } + end ]] + if border.name == "mcl_core:dirt_with_grass" and not border.param2 then + local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(nn[1]).biome)] + local p2 = biome and biome._mcl_grass_palette_index and biome._mcl_grass_palette_index or nil + border = { name = "mcl_core:dirt_with_grass", param2 = p2 } + end + minetest.bulk_swap_node(br, border) + minetest.bulk_swap_node(air, { name = "air" }) + return true + end) + return true +end + +vl_structures.register_structure("lavapool", { + place_on = { "group:sand", "group:dirt", "group:stone" }, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.0000022, + spread = vector.new(250, 250, 250), + seed = 78375213, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, all_floors", + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos, _, pr) + return makelake(pos, 5, "mcl_core:lava_source", + { "group:material_stone", "group:sand", "group:dirt" }, + { name = "mcl_core:stone" }, pr) + end +}) + +vl_structures.register_structure("water_lake", { + place_on = { "group:dirt", "group:stone" }, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.000032, + spread = vector.new(250, 250, 250), + seed = 756641353, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, all_floors", + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos, _, pr) + return makelake(pos, 5, "mcl_core:water_source", + { "group:material_stone", "group:sand", "group:dirt", "group:grass_block"}, + { name = "mcl_core:dirt_with_grass" }, pr) + end +}) + +vl_structures.register_structure("water_lake_mangrove_swamp", { + place_on = { "mcl_mud:mud" }, + biomes = { "MangroveSwamp" }, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.0032, + spread = vector.new(250, 250, 250), + seed = 6343241353, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, all_floors", + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos, _, pr) + return makelake(pos, 3, "mcl_core:water_source", + { "group:material_stone", "group:sand", "group:dirt", "group:grass_block", "mcl_mud:mud"}, + { name = "mcl_mud:mud" }, pr, true) + end +}) + diff --git a/mods/MAPGEN/vl_biomes/init.lua b/mods/MAPGEN/vl_biomes/init.lua index 2b14d8669..1f4af780d 100644 --- a/mods/MAPGEN/vl_biomes/init.lua +++ b/mods/MAPGEN/vl_biomes/init.lua @@ -324,11 +324,16 @@ elseif mg_name ~= "v6" then -- Additional decorations dofile(modpath.."/deco/bamboo.lua") + dofile(modpath.."/deco/boulder.lua") dofile(modpath.."/deco/cacti.lua") dofile(modpath.."/deco/corals.lua") + dofile(modpath.."/deco/fallentree.lua") dofile(modpath.."/deco/fern.lua") dofile(modpath.."/deco/flowers.lua") + dofile(modpath.."/deco/fossil.lua") + dofile(modpath.."/deco/geode.lua") dofile(modpath.."/deco/kelp.lua") + dofile(modpath.."/deco/lakes.lua") dofile(modpath.."/deco/mushrooms.lua") dofile(modpath.."/deco/pumpkin.lua") dofile(modpath.."/deco/reeds.lua") diff --git a/mods/MAPGEN/vl_biomes/nether/basaltdelta.lua b/mods/MAPGEN/vl_biomes/nether/basaltdelta.lua index 39477e0c5..51c9ea891 100644 --- a/mods/MAPGEN/vl_biomes/nether/basaltdelta.lua +++ b/mods/MAPGEN/vl_biomes/nether/basaltdelta.lua @@ -133,3 +133,146 @@ mcl_mapgen_core.register_decoration({ y_max = vl_biomes.nether_max - 5, flags = "all_floors, force_placement", }) + +local adjacents = { + vector.new(1,0,0), + vector.new(1,0,1), + vector.new(1,0,-1), + vector.new(-1,0,0), + vector.new(-1,0,1), + vector.new(-1,0,-1), + vector.new(0,0,1), + vector.new(0,0,-1), + vector.new(0,-1,0) +} + +vl_structures.register_structure("basalt_column",{ + place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" }, + terrain_feature = true, + spawn_by = { "air" }, + num_spawn_by = 2, + noise_params = { + offset = 0, + scale = 0.003, + spread = vector.new(250, 250, 250), + seed = 72235213, + octaves = 5, + persist = 0.3, + flags = "absvalue", + }, + flags = "all_floors", + y_max = mcl_vars.mg_nether_max - 20, + y_min = mcl_vars.mg_lava_nether_max + 1, + biomes = { "BasaltDelta" }, + place_func = function(pos, _, pr) + local nn = minetest.find_nodes_in_area(vector.offset(pos,-5,-1,-5), vector.offset(pos,5,-1,5), + { "air", "mcl_blackstone:basalt", "mcl_blackstone:blackstone" }) + table.sort(nn, function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + if #nn < 1 then return false end + local basalt, magma = {}, {} + for i = 1, pr:next(1,#nn) do + if minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name ~= "air" then + local dst = vector.distance(pos, nn[i]) + for ii = 0, pr:next(1,14) - dst do + if pr:next(1,25) == 1 then + table.insert(magma, vector.offset(nn[i], 0, ii, 0)) + else + table.insert(basalt, vector.offset(nn[i], 0, ii, 0)) + end + end + end + end + minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" }) + minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" }) + return true + end +}) +vl_structures.register_structure("basalt_pillar",{ + place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" }, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.001, + spread = vector.new(250, 250, 250), + seed = 7113, + octaves = 5, + persist = 0.1, + flags = "absvalue", + }, + flags = "all_floors", + y_max = mcl_vars.mg_nether_max - 40, + y_min = mcl_vars.mg_lava_nether_max + 1, + biomes = { "BasaltDelta" }, + place_func = function(pos, _, pr) + local nn = minetest.find_nodes_in_area(vector.offset(pos,-2,-1,-2), vector.offset(pos,2,-1,2), + { "air", "mcl_blackstone:basalt", "mcl_blackstone:blackstone" }) + table.sort(nn, function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + if #nn < 1 then return false end + local basalt, magma = {}, {} + for i = 1, pr:next(1,#nn) do + if minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name ~= "air" then + local dst = vector.distance(pos, nn[i]) + for ii = 0, pr:next(19,35) - dst do + if pr:next(1,20) == 1 then + table.insert(magma, vector.offset(nn[i], 0, ii, 0)) + else + table.insert(basalt, vector.offset(nn[i], 0, ii, 0)) + end + end + end + end + minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" }) + minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" }) + return true + end +}) + +vl_structures.register_structure("lavadelta",{ + place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" }, + spawn_by = { "mcl_blackstone:basalt", "mcl_blackstone:blackstone" }, + num_spawn_by = 2, + terrain_feature = true, + noise_params = { + offset = 0, + scale = 0.005, + spread = vector.new(250, 250, 250), + seed = 78375213, + octaves = 5, + persist = 0.1, + flags = "absvalue", + }, + flags = "all_floors", + y_max = mcl_vars.mg_nether_max, + y_min = mcl_vars.mg_lava_nether_max + 1, + biomes = { "BasaltDelta" }, + place_func = function(pos, _, pr) + local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-10,-1,-10), vector.offset(pos,10,-2,10), + { "mcl_blackstone:basalt", "mcl_blackstone:blackstone", "mcl_nether:netherrack" }) + table.sort(nn, function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + if #nn < 1 then return false end + local lava = {} + for i=1, pr:next(1,#nn) do table.insert(lava,nn[i]) end + minetest.bulk_swap_node(lava, { name = "mcl_nether:nether_lava_source" }) + local basalt, magma = {}, {} + for _, v in pairs(lava) do + for _, vv in pairs(adjacents) do + local p = vector.add(v, vv) + if minetest.get_node(p).name ~= "mcl_nether:nether_lava_source" then + table.insert(basalt,p) + end + end + if math.random(3) == 1 then + table.insert(magma,v) + end + end + minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" }) + minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" }) + return true + end +}) diff --git a/mods/MAPGEN/mcl_structures/schematics/coral_cora.mts b/mods/MAPGEN/vl_biomes/schematics/coral_cora.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/coral_cora.mts rename to mods/MAPGEN/vl_biomes/schematics/coral_cora.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_boulder.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_boulder.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_boulder.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_boulder.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_boulder_small.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_boulder_small.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_boulder_small.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_boulder_small.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_brain_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_brain_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_brain_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_brain_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_brain_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_brain_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_brain_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_brain_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_bubble_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_bubble_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_bubble_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_bubble_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_bubble_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_bubble_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_bubble_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_bubble_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_fire_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_fire_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_fire_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_fire_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_fire_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_fire_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_fire_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_fire_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_horn_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_horn_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_horn_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_horn_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_horn_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_horn_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_horn_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_horn_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_tube_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_tube_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_tube_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_tube_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_tube_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_tube_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_coral_tube_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_coral_tube_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_3.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_3.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_3.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_3.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_4.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_4.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_skull_4.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_skull_4.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_1.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_1.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_1.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_1.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_2.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_2.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_2.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_2.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_3.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_3.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_3.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_3.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_4.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_4.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_fossil_spine_4.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_fossil_spine_4.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ice_spike_large.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_ice_spike_large.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_ice_spike_large.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_ice_spike_large.mts diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ice_spike_small.mts b/mods/MAPGEN/vl_biomes/schematics/mcl_structures_ice_spike_small.mts similarity index 100% rename from mods/MAPGEN/mcl_structures/schematics/mcl_structures_ice_spike_small.mts rename to mods/MAPGEN/vl_biomes/schematics/mcl_structures_ice_spike_small.mts diff --git a/mods/MAPGEN/vl_biomes/snowy_plains_spikes.lua b/mods/MAPGEN/vl_biomes/snowy_plains_spikes.lua index 61e2aa886..87b40f64a 100644 --- a/mods/MAPGEN/vl_biomes/snowy_plains_spikes.lua +++ b/mods/MAPGEN/vl_biomes/snowy_plains_spikes.lua @@ -1,4 +1,5 @@ -local mod_mcl_structures = minetest.get_modpath("mcl_structures") +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) -- Ice Plains Spikes (rare) aka Ice Spikes vl_biomes.register_biome({ @@ -36,6 +37,7 @@ vl_biomes.register_biome({ mcl_mapgen_core.register_decoration({ deco_type = "schematic", place_on = {"mcl_core:snowblock", "mcl_core:snow", "group:grass_block_snow"}, + terrain_feature = true, sidelen = 80, noise_params = { offset = 0.00040, @@ -48,7 +50,7 @@ mcl_mapgen_core.register_decoration({ biomes = {"IcePlainsSpikes"}, y_min = 4, y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_ice_spike_large.mts", + schematic = modpath .. "/schematics/mcl_structures_ice_spike_large.mts", rotation = "random", flags = "place_center_x, place_center_z", }) @@ -57,6 +59,7 @@ mcl_mapgen_core.register_decoration({ mcl_mapgen_core.register_decoration({ deco_type = "schematic", place_on = {"mcl_core:snowblock", "mcl_core:snow", "group:grass_block_snow"}, + terrain_feature = true, sidelen = 80, noise_params = { offset = 0.005, @@ -69,7 +72,18 @@ mcl_mapgen_core.register_decoration({ biomes = {"IcePlainsSpikes"}, y_min = 4, y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_ice_spike_small.mts", + schematic = modpath .. "/schematics/mcl_structures_ice_spike_small.mts", rotation = "random", flags = "place_center_x, place_center_z", }) + +vl_structures.register_structure("ice_spike_small", { + -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct + filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" }, +}) + +vl_structures.register_structure("ice_spike_large", { + -- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct + filenames = { modpath.."/schematics/mcl_structures_ice_spike_large.mts" }, +}) + diff --git a/mods/MAPGEN/vl_biomes/taiga_old_pine.lua b/mods/MAPGEN/vl_biomes/taiga_old_pine.lua index 94da2edbc..bb186d5c8 100644 --- a/mods/MAPGEN/vl_biomes/taiga_old_pine.lua +++ b/mods/MAPGEN/vl_biomes/taiga_old_pine.lua @@ -1,5 +1,3 @@ -local mod_mcl_structures = minetest.get_modpath("mcl_structures") - -- Mega Pine Taiga aka Old Growth Pine Taiga vl_biomes.register_biome({ name = "MegaTaiga", @@ -41,47 +39,6 @@ minetest.register_ore({ noise_params = {offset = 0, scale = 15, spread = vector.new(130, 130, 130), seed = 24, octaves = 3, persist = 0.70}, biomes = {"MegaTaiga"}, }) --- Mossy cobblestone boulder (3x3) -mcl_mapgen_core.register_decoration({ - deco_type = "schematic", - place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00015, - scale = 0.001, - spread = vector.new(300, 300, 300), - seed = 775703, - octaves = 4, - persist = 0.63, - }, - biomes = {"MegaTaiga"}, - y_min = 1, - y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder.mts", - flags = "place_center_x, place_center_z", - rotation = "random", -}) - --- Small mossy cobblestone boulder (2x2) -mcl_mapgen_core.register_decoration({ - deco_type = "schematic", - place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.001, - scale = 0.001, - spread = vector.new(300, 300, 300), - seed = 775704, - octaves = 4, - persist = 0.63, - }, - biomes = {"MegaTaiga"}, - y_min = 1, - y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder_small.mts", - flags = "place_center_x, place_center_z", - rotation = "random", -}) -- Huge spruce vl_biomes.register_spruce_decoration(3000, 0.0008, "mcl_core_spruce_huge_up_1.mts", {"MegaTaiga"}) diff --git a/mods/MAPGEN/vl_biomes/taiga_old_spruce.lua b/mods/MAPGEN/vl_biomes/taiga_old_spruce.lua index 3ff15de61..123b1238c 100644 --- a/mods/MAPGEN/vl_biomes/taiga_old_spruce.lua +++ b/mods/MAPGEN/vl_biomes/taiga_old_spruce.lua @@ -1,5 +1,3 @@ -local mod_mcl_structures = minetest.get_modpath("mcl_structures") - -- Mega Spruce Taiga aka Old Growth Spruce Taiga vl_biomes.register_biome({ name = "MegaSpruceTaiga", @@ -26,47 +24,6 @@ vl_biomes.register_biome({ depth_filler = 3, }, }) --- Mossy cobblestone boulder (3x3) -mcl_mapgen_core.register_decoration({ - deco_type = "schematic", - place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.00015, - scale = 0.001, - spread = vector.new(300, 300, 300), - seed = 775703, - octaves = 4, - persist = 0.63, - }, - biomes = {"MegaSpruceTaiga"}, - y_min = 1, - y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder.mts", - flags = "place_center_x, place_center_z", - rotation = "random", -}) - --- Small mossy cobblestone boulder (2x2) -mcl_mapgen_core.register_decoration({ - deco_type = "schematic", - place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"}, - sidelen = 80, - noise_params = { - offset = 0.001, - scale = 0.001, - spread = vector.new(300, 300, 300), - seed = 775704, - octaves = 4, - persist = 0.63, - }, - biomes = {"MegaSpruceTaiga"}, - y_min = 1, - y_max = vl_biomes.overworld_max, - schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder_small.mts", - flags = "place_center_x, place_center_z", - rotation = "random", -}) -- Huge spruce vl_biomes.register_spruce_decoration(3000, 0.0030, "mcl_core_spruce_huge_1.mts", {"MegaSpruceTaiga"}) diff --git a/mods/MAPGEN/vl_extra_structures/witches_circle.lua b/mods/MAPGEN/vl_extra_structures/witches_circle.lua index b074e73eb..c1d525fbb 100644 --- a/mods/MAPGEN/vl_extra_structures/witches_circle.lua +++ b/mods/MAPGEN/vl_extra_structures/witches_circle.lua @@ -6,31 +6,30 @@ local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false) local function spawn_witch(pos,def,pr,p1,p2) local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"}) - if c then - local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"group:stone"}) - local witch - if not peaceful then - witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity() - witch._home = c - witch.can_despawn = false - end - local catobject = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat") - if catobject and catobject:get_pos() then - local cat=catobject:get_luaentity() - cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) - cat.owner = "!witch!" --so it's not claimable by player - cat._home = c - cat.can_despawn = false - end - return + if not c then return end + local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"group:stone"}) + if #nn == 0 then return end + local witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch") + if witchobj then + local witch = witchobj:get_luaentity() + witch._home = c + witch.can_despawn = false + end + local catobj = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat") + if catobj then + local cat = catobj:get_luaentity() + cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) + cat.owner = "!witch!" --so it's not claimable by player + cat._home = c + cat.can_despawn = false end end vl_structures.register_structure("witches_circle",{ place_on = {"group:grass_block", "group:dirt", "mclx_core:river_water_source"}, flags = "place_center_x, place_center_z, all_surfaces", - chunk_probability = 14, - prepare = { tolerance=4, clear_bottom=1, clear_top=-1, padding=0, corners=3, foundation=-2 }, + chunk_probability = 20, + prepare = { tolerance = 3, clear_bottom = 1, clear_top = 0, padding = 0, corners = 1, foundation = -2 }, y_max = mcl_vars.mg_overworld_max, y_min = 1, y_offset = -1,