From f86898b2f432bc63e8654bad0ee277bed19f5400 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 7 Aug 2022 00:44:02 +0200 Subject: [PATCH 1/7] make ruined portals rarer --- mods/MAPGEN/mcl_structures/ruined_portal.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_structures/ruined_portal.lua b/mods/MAPGEN/mcl_structures/ruined_portal.lua index 002195f76..618cc407b 100644 --- a/mods/MAPGEN/mcl_structures/ruined_portal.lua +++ b/mods/MAPGEN/mcl_structures/ruined_portal.lua @@ -16,7 +16,7 @@ local def = { flags = "place_center_x, place_center_z, all_floors", solid_ground = true, make_foundation = true, - chunk_probability = 400, + chunk_probability = 800, y_max = mcl_vars.mg_overworld_max, y_min = 1, sidelen = 10, From cef559c57304ae9b5294916f3111a22bae3dcb5c Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 7 Aug 2022 01:03:54 +0200 Subject: [PATCH 2/7] Fix ruined portals y offset --- mods/MAPGEN/mcl_structures/ruined_portal.lua | 2 +- .../mcl_structures_ruined_portal_1.mts | Bin 524 -> 537 bytes .../mcl_structures_ruined_portal_2.mts | Bin 521 -> 563 bytes .../mcl_structures_ruined_portal_99.mts | Bin 521 -> 555 bytes 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_structures/ruined_portal.lua b/mods/MAPGEN/mcl_structures/ruined_portal.lua index 618cc407b..00d2d682c 100644 --- a/mods/MAPGEN/mcl_structures/ruined_portal.lua +++ b/mods/MAPGEN/mcl_structures/ruined_portal.lua @@ -20,7 +20,7 @@ local def = { y_max = mcl_vars.mg_overworld_max, y_min = 1, sidelen = 10, - y_offset = -4, + y_offset = -5, filenames = { modpath.."/schematics/mcl_structures_ruined_portal_1.mts", modpath.."/schematics/mcl_structures_ruined_portal_2.mts", diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ruined_portal_1.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_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gdVF0^$`p3*Wsm}_ z1WZ2^cfwk!cf+Kg(wTjbdTvE0BU*nZP|Y>wV{Q-mDMv-gpw!5E0i2D!S=Rw~uS4xYy0JYBVi!ohkgCJ@*?m7qwD&Z(N$umK{x8|k4*%c#VFFfb zoQA)zohF0Q0G_i~0?-_&}s zm3L|<9<#lYtYi6f#m`j-^q9hyOY+Pyo8KsWrQ+~G(4Zt^-iQmDZFdbFX&4N5Ax64^ycf1iux$G`0LN-&YK%=^*-i6+0pCo&zD|3Z@E-P z+IHt>tv%89=fsQ;NgCa-dTp!zvBdZ7yp+;g2AEha`{yb%uvQpvA2&1CypS8VqREvk!UY-BTd=I1B HZAEPWe!{39 From f1c70fe19da3f1d0a48b92aecb6a91dc91b54cf3 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 7 Aug 2022 01:30:49 +0200 Subject: [PATCH 3/7] grass border for water lake --- mods/MAPGEN/mcl_terrain_features/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 18f242e36..052f99c8d 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -205,7 +205,7 @@ mcl_structures.register_structure("water_lake",{ y_max = mcl_vars.mg_overworld_max, y_min = minetest.get_mapgen_setting("water_level"), place_func = function(pos,def,pr) - return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},nil,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 }) From 4f96b38fa3a96668da35b5ba4ed0de54811e4603 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 1 Aug 2022 01:43:23 +0200 Subject: [PATCH 4/7] Make foundations less cubic --- mods/MAPGEN/mcl_structures/api.lua | 90 ++++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index af08caf07..6850255b3 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -38,6 +38,73 @@ function mcl_structures.find_highest_y(pp) return y end +local function smooth_cube(nn,pos,plane,amnt) + local r = {} + local amnt = amnt or 9 + table.sort(nn,function(a, b) + if false or plane then + return vector.distance(vector.new(pos.x,0,pos.z), vector.new(a.x,0,a.z)) < vector.distance(vector.new(pos.x,0,pos.z), vector.new(b.x,0,b.z)) + else + return vector.distance(pos, a) < vector.distance(pos, b) + end + end) + for i=1,math.max(1,#nn-amnt) do table.insert(r,nn[i]) end + return r +end + +local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) + local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant"} + local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),replace),vector.offset(pos,0,-30,0),true,sidelen * 64) + local stone = {} + local filler = {} + local top = {} + local dust = {} + for l,v in pairs(nn) do + if v.y == ground_p1.y - 1 then + table.insert(filler,v) + table.insert(top,vector.offset(v,0,1,0)) + table.insert(dust,vector.offset(v,0,2,0)) + elseif v.y < ground_p1.y -1 and v.y > ground_p2.y -4 then table.insert(filler,v) + elseif v.y < ground_p2.y - 3 and v.y > ground_p2.y -5 then + if math.random(3) == 1 then + table.insert(filler,v) + else + table.insert(stone,v) + end + else + table.insert(stone,v) + end + end + return stone,filler,top,dust +end + +local function foundation(ground_p1,ground_p2,pos,sidelen) + local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) + local node_stone = "mcl_core:stone" + local node_filler = "mcl_core:dirt" + local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name + local node_dust = nil + + if minetest.get_mapgen_setting("mg_name") ~= "v6" then + local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] + --minetest.log(dump(b.node_top)) + if b then + if b.node_top then node_top = b.node_top end + if b.node_filler then node_filler = b.node_filler end + if b.node_stone then node_stone = b.node_stone end + if b.node_dust then node_dust = b.node_dust end + end + end + + minetest.bulk_set_node(top,{name=node_top}) + + if node_dust then + minetest.bulk_set_node(dust,{name=node_dust}) + end + minetest.bulk_set_node(filler,{name=node_filler}) + minetest.bulk_set_node(stone,{name=node_stone}) +end + function mcl_structures.place_structure(pos, def, pr, blockseed) if not def then return end local logging = not def.terrain_feature @@ -55,28 +122,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed) local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"}) if #solid < ( def.sidelen * def.sidelen ) then if def.make_foundation then - local node_stone = "mcl_core:stone" - local node_filler = "mcl_core:dirt" - local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name - local node_dust = nil - - if minetest.get_mapgen_setting("mg_name") ~= "v6" then - local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] - --minetest.log(dump(b.node_top)) - if b then - if b.node_top then node_top = b.node_top end - if b.node_filler then node_filler = b.node_filler end - if b.node_stone then node_stone = b.node_stone end - if b.node_dust then node_dust = b.node_dust end - end - end - local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves"} - minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,replace),{name=node_top}) - if node_dust then - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,1,0),vector.offset(ground_p2,0,1,0),{"air"}),{name=node_dust}) - end - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),replace),{name=node_filler}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),replace),{name=node_stone}) + foundation(vector.offset(pos,-def.sidelen/2 - 3,-1,-def.sidelen/2 - 3),vector.offset(pos,def.sidelen/2 + 3,-1,def.sidelen/2 + 3),pos,def.sidelen) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.") From b7f26e2ddca9b7e88c89210332a4b41e8d589505 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 9 Aug 2022 19:28:30 +0200 Subject: [PATCH 5/7] Add setting to selectively disable strucutres --- mods/MAPGEN/mcl_structures/api.lua | 8 ++++++++ settingtypes.txt | 3 +++ 2 files changed, 11 insertions(+) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 6850255b3..c883c4d7a 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,5 +1,12 @@ mcl_structures.registered_structures = {} +local disabled_structures = minetest.settings:get("mcl_disabled_structures") +if disabled_structures then disabled_structures = disabled_structures:split(",") +else disabled_structures = {} end + +function mcl_structures.is_disabled(structname) + if table.indexof(disabled_structures,structname) ~= -1 then return true end +end function mcl_structures.fill_chests(p1,p2,loot,pr) for it,lt in pairs(loot) do @@ -168,6 +175,7 @@ function mcl_structures.place_structure(pos, def, pr, blockseed) end function mcl_structures.register_structure(name,def,nospawn) --nospawn means it will be placed by another (non-nospawn) structure that contains it's structblock i.e. it will not be placed by mapgen directly + if mcl_structures.is_disabled(name) then return end local structblock = "mcl_structures:structblock_"..name local flags = "place_center_x, place_center_z, force_placement" local y_offset = 0 diff --git a/settingtypes.txt b/settingtypes.txt index 35db8bde7..7c8bc651e 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -39,6 +39,9 @@ mcl_doTileDrops (Blocks have drops) bool true # If enabled, TNT explosions destroy blocks. mcl_tnt_griefing (TNT destroys blocks) bool true +# Comma separated list of disabled structure names +mcl_disabled_structures (Disabled structures) string + [Players] # If enabled, players respawn at the bed they last lay on instead of normal # spawn. From 0bcbea4ce3de2a826a14707724645393795aef50 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 13:52:19 +0200 Subject: [PATCH 6/7] Add lots of water lakes to mangrove swamps --- mods/MAPGEN/mcl_terrain_features/init.lua | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 052f99c8d..eab33e78e 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -29,7 +29,7 @@ local function airtower(pos,tbl,h) end end -local function makelake(pos,size,liquid,placein,border,pr) +local function makelake(pos,size,liquid,placein,border,pr,noair) local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) local p1 = vector.offset(pos,-size,-1,-size) local p2 = vector.offset(pos,size,-1,size) @@ -70,7 +70,7 @@ local function makelake(pos,size,liquid,placein,border,pr) end if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end end - if an.name ~= liquid then + if not noair and an.name ~= liquid then table.insert(br,pp) if un.name ~= liquid then airtower(pp,air,55) @@ -209,6 +209,27 @@ mcl_structures.register_structure("water_lake",{ end }) +mcl_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, force_placement", + y_max = mcl_vars.mg_overworld_max, + y_min = minetest.get_mapgen_setting("water_level"), + place_func = function(pos,def,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 +}) + local pool_adjacents = { vector.new(1,0,0), vector.new(-1,0,0), From 79ce9f89d34ea20121d1e2063ce7d94be6fbbb1d Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 10 Aug 2022 15:14:51 +0200 Subject: [PATCH 7/7] More adaptive foundation height --- mods/MAPGEN/mcl_structures/api.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index c883c4d7a..e57d4f6be 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -59,9 +59,24 @@ local function smooth_cube(nn,pos,plane,amnt) return r end -local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) - local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant"} - local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),replace),vector.offset(pos,0,-30,0),true,sidelen * 64) +local function find_ground(pos,nn,gn) + local r = 0 + for _,v in pairs(nn) do + local p=vector.new(v) + repeat + local n = minetest.get_node(p).name + p = vector.offset(p,0,-1,0) + until not n or n == "mcl_core:bedrock" or n == "ignore" or n == gn + --minetest.log(tostring(pos.y - p.y)) + if pos.y - p.y > r then r = pos.y - p.y end + end + return r +end + +local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen,node_stone) + local replace = {"air","group:liquid","mcl_core:snow","group:tree","group:leaves","group:plant","grass_block","group:dirt"} + local depth = find_ground(pos,minetest.find_nodes_in_area(ground_p1,ground_p2,replace),node_stone) + local nn = smooth_cube(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-depth,0),replace),vector.offset(pos,0,-depth,0),true,sidelen * 64) local stone = {} local filler = {} local top = {} @@ -86,7 +101,6 @@ local function get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) end local function foundation(ground_p1,ground_p2,pos,sidelen) - local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen) local node_stone = "mcl_core:stone" local node_filler = "mcl_core:dirt" local node_top = "mcl_core:dirt_with_grass" or minetest.get_node(ground_p1).name @@ -103,7 +117,8 @@ local function foundation(ground_p1,ground_p2,pos,sidelen) end end - minetest.bulk_set_node(top,{name=node_top}) + local stone,filler,top,dust = get_foundation_nodes(ground_p1,ground_p2,pos,sidelen,node_stone) + minetest.bulk_set_node(top,{name=node_top},node_stone) if node_dust then minetest.bulk_set_node(dust,{name=node_dust})