From 69dac8ded478d2ca29666fd603f4d8b1ea5810d1 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 22 Jun 2022 13:14:53 +0200 Subject: [PATCH 01/29] fix surface pools y offset --- 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 4375e869d..f1388a42f 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -38,7 +38,7 @@ local function makelake(pos,size,liquid,placein,border,pr) return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) end) if not nn[1] then return end - local y = pos.y + 1 + local y = pos.y - 1 local lq = {} for i=1,pr:next(1,#nn) do if nn[i].y == y then From eb8db0dc0bef45b92808062f295ae71a29a16c75 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 22 Jun 2022 13:31:43 +0200 Subject: [PATCH 02/29] optimize terrain features --- mods/MAPGEN/mcl_terrain_features/init.lua | 39 +++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index f1388a42f..34f29e38d 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -23,9 +23,9 @@ local function set_node_no_bedrock(pos,node) return minetest.set_node(pos,node) end -local function airtower(pos) - for i=0,55 do - set_node_no_bedrock(vector.offset(pos,0,i,0),{name="air"}) +local function airtower(pos,tbl,h) + for i=0,h do + table.insert(tbl,vector.offset(pos,0,i,0)) end end @@ -40,14 +40,16 @@ local function makelake(pos,size,liquid,placein,border,pr) if not nn[1] then return end local y = pos.y - 1 local lq = {} + local air = {} for i=1,pr:next(1,#nn) do if nn[i].y == y then - set_node_no_bedrock(nn[i],{name=liquid}) - airtower(vector.offset(nn[i],0,1,0)) + airtower(vector.offset(nn[i],0,1,0),air,55) table.insert(lq,nn[i]) end end - + minetest.bulk_set_node(lq,{name=liquid}) + local air = {} + local br = {} for k,v in pairs(lq) do for kk,vv in pairs(adjacents) do local pp = vector.add(v,vv) @@ -64,13 +66,15 @@ local function makelake(pos,size,liquid,placein,border,pr) if border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end end if an.name ~= liquid then - set_node_no_bedrock(pp,{name=border}) + table.insert(br,pp) if un.name ~= liquid then - airtower(vector.offset(pp,0,1,0)) + airtower(vector.offset(pp,0,1,0),air,55) end end end end + minetest.bulk_set_node(air,{name="air"}) + minetest.bulk_set_node(br,{name=border}) return true end @@ -136,14 +140,16 @@ mcl_structures.register_structure("basalt_column",{ 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 = {} 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(2,14)-dst do - set_node_no_bedrock(vector.new(nn[i].x,nn[i].y + ii,nn[i].z),{name="mcl_blackstone:basalt"}) + table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) end end end + minetest.bulk_set_node(basalt,{name="mcl_blackstone:basalt"}) return true end }) @@ -168,14 +174,16 @@ mcl_structures.register_structure("basalt_pillar",{ 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 = {} 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,34)-dst do - set_node_no_bedrock(vector.new(nn[i].x,nn[i].y + ii,nn[i].z),{name="mcl_blackstone:basalt"}) + table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) end end end + minetest.bulk_set_node(basalt,{name="mcl_blackstone:basalt"}) return true end }) @@ -205,20 +213,25 @@ mcl_structures.register_structure("lavadelta",{ if #nn < 1 then return false end local lava = {} for i=1,pr:next(1,#nn) do - set_node_no_bedrock(nn[i],{name="mcl_nether:nether_lava_source"}) table.insert(lava,nn[i]) end + minetest.bulk_set_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 - set_node_no_bedrock(p,{name="mcl_blackstone:basalt"}) + table.insert(basalt,p) + end end if math.random(3) == 1 then - set_node_no_bedrock(v,{name="mcl_nether:magma"}) + table.insert(magma,v) end end + minetest.bulk_set_node(basalt,{name="mcl_blackstone:basalt"}) + minetest.bulk_set_node(magma,{name="mcl_nether:magma"}) return true end }) From fed81932e258c6e95f94f0ad8c0d4a2d3fd10a80 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 22 Jun 2022 15:56:51 +0200 Subject: [PATCH 03/29] structs: use mcl_register_generator, cave decos --- mods/MAPGEN/mcl_biomes/init.lua | 23 +++++ mods/MAPGEN/mcl_mapgen_core/init.lua | 136 +++++++++++++++------------ mods/MAPGEN/mcl_structures/api.lua | 13 +-- 3 files changed, 99 insertions(+), 73 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 023cd3de9..f2fb33184 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3356,6 +3356,29 @@ local function register_decorations() rotation = "0", }) + --Mushrooms in caves + minetest.register_decoration({ + deco_type = "simple", + place_on = {"group:material_stone"}, + sidelen = 80, + fill_ratio = 0.009, + noise_threshold = 2.0, + flags = "all_floors", + y_min = mcl_vars.mg_overworld_min, + y_max = mcl_vars.mg_overworld_max, + decoration = "mcl_mushrooms:mushroom_red", + }) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"group:material_stone"}, + sidelen = 80, + fill_ratio = 0.009, + noise_threshold = 2.0, + y_min = mcl_vars.mg_overworld_min, + y_max = mcl_vars.mg_overworld_max, + decoration = "mcl_mushrooms:mushroom_brown", + }) + -- Mossy cobblestone boulder (3×3) minetest.register_decoration({ deco_type = "schematic", diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 2bbcab1cf..a5a6d7a52 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1720,7 +1720,7 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar end -- Generate mushrooms in caves manually. --- Minetest's API does not support decorations in caves yet. :-( +-- only v6. minetest supports cave decos via "all_floors" flag now local function generate_underground_mushrooms(minp, maxp, seed) local pr_shroom = PseudoRandom(seed-24359) -- Generate rare underground mushrooms @@ -1756,67 +1756,65 @@ end -- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart -- (only v6) local function generate_nether_decorations(minp, maxp, seed) - if mg_name == "v6" then - local pr_nether = PseudoRandom(seed+667) + local pr_nether = PseudoRandom(seed+667) - if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then - return - end - - minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp)) - - -- TODO: Generate everything based on Perlin noise instead of PseudoRandom - - local bpos - local rack = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:netherrack"}) - local magma = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:magma"}) - local ssand = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:soul_sand"}) - - -- Helper function to spawn “fake” decoration - local function special_deco(nodes, spawn_func) - for n = 1, #nodes do - bpos = {x = nodes[n].x, y = nodes[n].y + 1, z = nodes[n].z } - - spawn_func(bpos) - end - end - -- Eternal fire on netherrack - special_deco(rack, function(bpos) - -- Eternal fire on netherrack - if pr_nether:next(1,100) <= 3 then - minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"}) - end - end) - - -- Eternal fire on magma cubes - special_deco(magma, function(bpos) - if pr_nether:next(1,150) == 1 then - minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"}) - end - end) - - -- Mushrooms on netherrack - -- Note: Spawned *after* the fire because of light level checks - special_deco(rack, function(bpos) - local l = minetest.get_node_light(bpos, 0.5) - if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then - -- TODO: Make mushrooms appear in groups, use Perlin noise - if pr_nether:next(1,2) == 1 then - minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"}) - else - minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"}) - end - end - end) - - -- Nether wart on soul sand - -- TODO: Spawn in Nether fortresses - special_deco(ssand, function(bpos) - if pr_nether:next(1, nether_wart_chance) == 1 then - minetest.set_node(bpos, {name = "mcl_nether:nether_wart"}) - end - end) + if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then + return end + + minetest.log("action", "[mcl_mapgen_core] Nether decorations " .. minetest.pos_to_string(minp) .. " ... " .. minetest.pos_to_string(maxp)) + + -- TODO: Generate everything based on Perlin noise instead of PseudoRandom + + local bpos + local rack = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:netherrack"}) + local magma = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:magma"}) + local ssand = minetest.find_nodes_in_area_under_air(minp, maxp, {"mcl_nether:soul_sand"}) + + -- Helper function to spawn “fake” decoration + local function special_deco(nodes, spawn_func) + for n = 1, #nodes do + bpos = {x = nodes[n].x, y = nodes[n].y + 1, z = nodes[n].z } + + spawn_func(bpos) + end + end + -- Eternal fire on netherrack + special_deco(rack, function(bpos) + -- Eternal fire on netherrack + if pr_nether:next(1,100) <= 3 then + minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"}) + end + end) + + -- Eternal fire on magma cubes + special_deco(magma, function(bpos) + if pr_nether:next(1,150) == 1 then + minetest.set_node(bpos, {name = "mcl_fire:eternal_fire"}) + end + end) + + -- Mushrooms on netherrack + -- Note: Spawned *after* the fire because of light level checks + special_deco(rack, function(bpos) + local l = minetest.get_node_light(bpos, 0.5) + if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then + -- TODO: Make mushrooms appear in groups, use Perlin noise + if pr_nether:next(1,2) == 1 then + minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"}) + else + minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"}) + end + end + end) + + -- Nether wart on soul sand + -- TODO: Spawn in Nether fortresses + special_deco(ssand, function(bpos) + if pr_nether:next(1, nether_wart_chance) == 1 then + minetest.set_node(bpos, {name = "mcl_nether:nether_wart"}) + end + end) end minetest.register_on_generated(function(minp, maxp, blockseed) @@ -2200,10 +2198,24 @@ end local function basic_node(minp, maxp, blockseed) if mg_name ~= "singlenode" then -- Generate special decorations - generate_underground_mushrooms(minp, maxp, blockseed) - generate_nether_decorations(minp, maxp, blockseed) + if mg_name == "v6" then + generate_underground_mushrooms(minp, maxp, blockseed) + generate_nether_decorations(minp, maxp, blockseed) + end generate_structures(minp, maxp, blockseed, minetest.get_mapgen_object("biomemap")) end end mcl_mapgen_core.register_generator("main", basic, basic_node, 1, true) + +mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed) + local gennotify = minetest.get_mapgen_object("gennotify") + local pr = PseudoRandom(blockseed + 42) + for _,struct in pairs(mcl_structures.registered_structures) do + for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do + local realpos = vector.offset(pos,0,-1,0) + minetest.remove_node(realpos) + mcl_structures.place_structure(realpos,struct,pr) + end + end +end, 100, true) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 3a3a84b92..ed589e75c 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -53,17 +53,8 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - local deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) - minetest.set_gen_notify({decoration=true}, { deco_id }) - minetest.register_on_generated(function(minp, maxp, blockseed) - local gennotify = minetest.get_mapgen_object("gennotify") - local pr = PseudoRandom(blockseed + 42) - for _, pos in pairs(gennotify["decoration#"..deco_id] or {}) do - local realpos = vector.offset(pos,0,-1,0) - minetest.remove_node(realpos) - mcl_structures.place_structure(realpos,def,pr) - end - end) + def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) + minetest.set_gen_notify({decoration=true}, { def.deco_id }) end minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock From 8e976d919196fd10f6cf394bf72ecf302ad33876 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 22 Jun 2022 16:37:44 +0200 Subject: [PATCH 04/29] Do not log generation of terrain features this leads to excessive io otherwise --- mods/MAPGEN/mcl_structures/api.lua | 17 +++++++++++++---- mods/MAPGEN/mcl_terrain_features/init.lua | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index ed589e75c..5bcee086a 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -2,6 +2,7 @@ mcl_structures.registered_structures = {} function mcl_structures.place_structure(pos, def, pr) if not def then return end + local logging = not def.terrain_feature local y_offset = 0 if type(def.y_offset) == "function" then y_offset = def.y_offset(pr) @@ -9,22 +10,30 @@ function mcl_structures.place_structure(pos, def, pr) y_offset = def.y_offset end if def.on_place and not def.on_place(pos,def,pr) then - minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.") + if logging then + minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.") + end return false end if def.filenames then local file = def.filenames[pr:next(1,#def.filenames)] local pp = vector.offset(pos,0,y_offset,0) mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",def.after_place,pr,{pos,def}) - minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + if logging then + minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + end return true elseif def.place_func and def.place_func(pos,def,pr) then if not def.after_place or ( def.after_place and def.after_place(pos,def,pr) ) then - minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + if logging then + minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + end return true end end - minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos)) + if logging then + minetest.log("warning","[mcl_structures] placing "..def.name.." failed at "..minetest.pos_to_string(pos)) + end 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 diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 34f29e38d..60555f0ff 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -80,6 +80,7 @@ end mcl_structures.register_structure("lavapool",{ place_on = {"group:sand", "group:dirt", "group:stone"}, + terrain_feature = true, noise_params = { offset = 0, scale = 0.0000022, @@ -99,6 +100,7 @@ mcl_structures.register_structure("lavapool",{ mcl_structures.register_structure("water_lake",{ place_on = {"group:dirt","group:stone"}, + terrain_feature = true, noise_params = { offset = 0, scale = 0.000032, @@ -119,6 +121,7 @@ mcl_structures.register_structure("water_lake",{ mcl_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 = { @@ -155,6 +158,7 @@ mcl_structures.register_structure("basalt_column",{ }) mcl_structures.register_structure("basalt_pillar",{ place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, + terrain_feature = true, noise_params = { offset = 0, scale = 0.001, @@ -192,6 +196,7 @@ mcl_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.01, From 0b3a4c18d713faefaedd3d54d14e65448c9232f8 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 22 Jun 2022 16:47:43 +0200 Subject: [PATCH 05/29] structure-api: add check for solid ground --- mods/MAPGEN/mcl_nether_fortresses/init.lua | 12 ++---------- mods/MAPGEN/mcl_structures/api.lua | 13 +++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_nether_fortresses/init.lua b/mods/MAPGEN/mcl_nether_fortresses/init.lua index 8910669cd..a82d3f4c7 100644 --- a/mods/MAPGEN/mcl_nether_fortresses/init.lua +++ b/mods/MAPGEN/mcl_nether_fortresses/init.lua @@ -14,16 +14,8 @@ mcl_structures.register_structure("nether_outpost",{ }, flags = "all_floors", biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"}, - on_place = function(pos,def,pr) - local sidelen = 15 - local node = minetest.get_node(vector.offset(pos,1,1,0)) - local solid = minetest.find_nodes_in_area(vector.offset(pos,-sidelen/2,-1,-sidelen/2),vector.offset(pos,sidelen/2,-1,sidelen/2),{"group:solid"}) - local air = minetest.find_nodes_in_area(vector.offset(pos,-sidelen/2,1,-sidelen/2),vector.offset(pos,sidelen/2,4,sidelen/2),{"air"}) - if #solid < ( sidelen * sidelen ) or - #air < (sidelen * sidelen ) then return false end - minetest.bulk_set_node(solid,node) - return true - end, + sidelen = 15, + solid_ground = true, y_min = mcl_vars.mg_lava_nether_max, y_max = mcl_vars.mg_nether_max - 30, filenames = { modpath.."/schematics/nether_outpost.mts" }, diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 5bcee086a..5153e85f9 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -9,6 +9,19 @@ function mcl_structures.place_structure(pos, def, pr) elseif def.y_offset then y_offset = def.y_offset end + if def.solid_ground and def.sidelen then + local node = minetest.get_node(vector.offset(pos,1,1,0)) + local solid = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,-1,def.sidelen/2),{"group:solid"}) + local air = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,4,def.sidelen/2),{"air"}) + if #solid < ( def.sidelen * def.sidelen ) or + #air < (def.sidelen * def.sidelen ) then + if logging then + minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") + end + return false + end + --minetest.bulk_set_node(solid,node) + end if def.on_place and not def.on_place(pos,def,pr) then if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.") From d8697cb59cae2d2803efd6f6e8cbab9bddeed53b Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 23 Jun 2022 01:42:20 +0200 Subject: [PATCH 06/29] Tweak basalt delta code --- mods/MAPGEN/mcl_biomes/init.lua | 66 ++++++++++++++++++++++ mods/MAPGEN/mcl_nether_fortresses/init.lua | 2 +- mods/MAPGEN/mcl_terrain_features/init.lua | 40 +++++++++---- 3 files changed, 97 insertions(+), 11 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index f2fb33184..f538d97aa 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -4574,6 +4574,72 @@ local function register_dimension_decorations() size = {x = 5, y = 8, z = 5}, rotation = "random", }) + --BASALT DELTA + minetest.register_decoration({ + deco_type = "simple", + decoration = "mcl_blackstone:basalt", + place_on = {"mcl_blackstone:basalt","mcl_nether:netherrack","mcl_blackstone:blackstone"}, + sidelen = 80, + height_max = 55, + noise_params={ + offset = -0.0085, + scale = 0.002, + spread = {x = 25, y = 120, z = 25}, + seed = 2325, + octaves = 5, + persist = 2, + lacunarity = 3.5, + flags = "absvalue" + }, + biomes = {"BasaltDelta"}, + y_min = mcl_vars.mg_lava_nether_max + 1, + flags = "all_floors, all ceilings", + }) + minetest.register_decoration({ + deco_type = "simple", + decoration = "mcl_blackstone:basalt", + place_on = {"mcl_blackstone:basalt","mcl_nether:netherrack","mcl_blackstone:blackstone"}, + sidelen = 80, + height_max = 15, + noise_params={ + offset = -0.0085, + scale = 0.004, + spread = {x = 25, y = 120, z = 25}, + seed = 235, + octaves = 5, + persist = 2.5, + lacunarity = 3.5, + flags = "absvalue" + }, + biomes = {"BasaltDelta"}, + y_min = mcl_vars.mg_lava_nether_max + 1, + flags = "all_floors, all ceilings", + }) + minetest.register_decoration({ + deco_type = "simple", + decoration = "mcl_nether:magma", + place_on = {"mcl_blackstone:basalt","mcl_nether:netherrack","mcl_blackstone:blackstone"}, + sidelen = 80, + fill_ratio = 0.082323, + biomes = {"BasaltDelta"}, + place_offset_y = -1, + y_min = mcl_vars.mg_lava_nether_max + 1, + flags = "all_floors, all ceilings", + }) + minetest.register_decoration({ + deco_type = "simple", + decoration = "mcl_nether:nether_lava_source", + place_on = {"mcl_blackstone:basalt","mcl_nether:netherrack","mcl_blackstone:blackstone"}, + spawn_by = {"mcl_blackstone:basalt","mcl_blackstone:blackstone"}, + num_spawn_by = 14, + sidelen = 80, + fill_ratio = 4, + biomes = {"BasaltDelta"}, + place_offset_y = -1, + y_min = mcl_vars.mg_lava_nether_max + 1, + y_max = mcl_vars.mg_nether_max - 5, + flags = "all_floors, force_placement", + }) --[[ THE END ]] diff --git a/mods/MAPGEN/mcl_nether_fortresses/init.lua b/mods/MAPGEN/mcl_nether_fortresses/init.lua index a82d3f4c7..16fd11fb1 100644 --- a/mods/MAPGEN/mcl_nether_fortresses/init.lua +++ b/mods/MAPGEN/mcl_nether_fortresses/init.lua @@ -16,7 +16,7 @@ mcl_structures.register_structure("nether_outpost",{ biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"}, sidelen = 15, solid_ground = true, - y_min = mcl_vars.mg_lava_nether_max, + y_min = mcl_vars.mg_lava_nether_max - 1, y_max = mcl_vars.mg_nether_max - 30, filenames = { modpath.."/schematics/nether_outpost.mts" }, y_offset = 0, diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 60555f0ff..623e518b3 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -118,6 +118,13 @@ mcl_structures.register_structure("water_lake",{ end }) +local pool_adjacents = { + vector.new(1,0,0), + vector.new(-1,0,0), + vector.new(0,-1,0), + vector.new(0,0,1), + vector.new(0,0,-1), +} mcl_structures.register_structure("basalt_column",{ place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"}, @@ -126,15 +133,15 @@ mcl_structures.register_structure("basalt_column",{ num_spawn_by = 2, noise_params = { offset = 0, - scale = 0.02, + scale = 0.003, spread = {x = 250, y = 250, z = 250}, - seed = 7225213, + seed = 72235213, octaves = 5, - persist = 0.1, + persist = 0.3, flags = "absvalue", }, flags = "all_floors", - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_max - 20, y_min = mcl_vars.mg_lava_nether_max + 1, biomes = { "BasaltDelta" }, place_func = function(pos,def,pr) @@ -144,14 +151,21 @@ mcl_structures.register_structure("basalt_column",{ 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(2,14)-dst do - table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) + 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_set_node(magma,{name="mcl_nether:magma"}) minetest.bulk_set_node(basalt,{name="mcl_blackstone:basalt"}) return true end @@ -163,13 +177,13 @@ mcl_structures.register_structure("basalt_pillar",{ offset = 0, scale = 0.001, spread = {x = 250, y = 250, z = 250}, - seed = 783213, + seed = 7113, octaves = 5, persist = 0.1, flags = "absvalue", }, flags = "all_floors", - y_max = mcl_vars.mg_nether_max, + y_max = mcl_vars.mg_nether_max-40, y_min = mcl_vars.mg_lava_nether_max + 1, biomes = { "BasaltDelta" }, place_func = function(pos,def,pr) @@ -179,15 +193,21 @@ mcl_structures.register_structure("basalt_pillar",{ 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,34)-dst do - table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z)) + 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_set_node(basalt,{name="mcl_blackstone:basalt"}) + minetest.bulk_set_node(magma,{name="mcl_nether:magma"}) return true end }) From e37358d220efaeece70833694f81d95090596dcc Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 23 Jun 2022 20:22:36 +0200 Subject: [PATCH 07/29] Add make_foundation option test by /spawnstruct nether_outpost without being on complete (covering the sidelen) solid ground --- mods/MAPGEN/mcl_nether_fortresses/init.lua | 1 + mods/MAPGEN/mcl_structures/api.lua | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_nether_fortresses/init.lua b/mods/MAPGEN/mcl_nether_fortresses/init.lua index 16fd11fb1..8a5d97244 100644 --- a/mods/MAPGEN/mcl_nether_fortresses/init.lua +++ b/mods/MAPGEN/mcl_nether_fortresses/init.lua @@ -16,6 +16,7 @@ mcl_structures.register_structure("nether_outpost",{ biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"}, sidelen = 15, solid_ground = true, + make_foundation = true, y_min = mcl_vars.mg_lava_nether_max - 1, y_max = mcl_vars.mg_nether_max - 30, filenames = { modpath.."/schematics/nether_outpost.mts" }, diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 5153e85f9..c0167060b 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -11,16 +11,21 @@ function mcl_structures.place_structure(pos, def, pr) end if def.solid_ground and def.sidelen then local node = minetest.get_node(vector.offset(pos,1,1,0)) - local solid = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,-1,def.sidelen/2),{"group:solid"}) + local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) + local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) + local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"}) local air = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,4,def.sidelen/2),{"air"}) if #solid < ( def.sidelen * def.sidelen ) or #air < (def.sidelen * def.sidelen ) then - if logging then - minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") + if def.make_foundation then + minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,vector.offset(ground_p2,0,-30,0),{"air"}),node) + else + if logging then + minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") + end + return false end - return false end - --minetest.bulk_set_node(solid,node) end if def.on_place and not def.on_place(pos,def,pr) then if logging then From 9381657f5d0266d5a9c62dec27c86e1b90869f7f Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 02:11:24 +0200 Subject: [PATCH 08/29] use new struct api for desert well and temples --- mods/MAPGEN/mcl_mapgen_core/init.lua | 39 ++---- mods/MAPGEN/mcl_structures/api.lua | 68 +++++---- mods/MAPGEN/mcl_structures/desert_temple.lua | 107 ++++++++++++++ mods/MAPGEN/mcl_structures/init.lua | 131 ++++-------------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 70 ++++++++++ mods/MAPGEN/mcl_structures/mod.conf | 2 +- .../mcl_structures_jungle_temple.mts | Bin 0 -> 2586 bytes .../mcl_structures_jungle_temple_nice.mts | Bin 0 -> 3997 bytes 8 files changed, 255 insertions(+), 162 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/desert_temple.lua create mode 100644 mods/MAPGEN/mcl_structures/jungle_temple.lua create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple_nice.mts diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index a5a6d7a52..117d8ee09 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1262,8 +1262,6 @@ end -- TODO: Try to use more efficient structure generating code local function generate_structures(minp, maxp, blockseed, biomemap) - local chunk_has_desert_well = false - local chunk_has_desert_temple = false local chunk_has_igloo = false local struct_min, struct_max = -3, 111 --64 @@ -1301,32 +1299,8 @@ local function generate_structures(minp, maxp, blockseed, biomemap) local nn0 = minetest.get_node(p).name -- Check if the node can be replaced if minetest.registered_nodes[nn0] and minetest.registered_nodes[nn0].buildable_to then - -- Desert temples and desert wells - if nn == "mcl_core:sand" or (nn == "mcl_core:sandstone") then - if not chunk_has_desert_temple and not chunk_has_desert_well and ground_y > 3 then - -- Spawn desert temple - -- TODO: Check surface - if pr:next(1,12000) == 1 then - mcl_structures.call_struct(p, "desert_temple", nil, pr) - chunk_has_desert_temple = true - end - end - if not chunk_has_desert_temple and not chunk_has_desert_well and ground_y > 3 then - local desert_well_prob = minecraft_chunk_probability(1000, minp, maxp) - - -- Spawn desert well - if pr:next(1, desert_well_prob) == 1 then - -- Check surface - local surface = minetest.find_nodes_in_area({x=p.x,y=p.y-1,z=p.z}, {x=p.x+5, y=p.y-1, z=p.z+5}, "mcl_core:sand") - if #surface >= 25 then - mcl_structures.call_struct(p, "desert_well", nil, pr) - chunk_has_desert_well = true - end - end - end - -- Igloos - elseif not chunk_has_igloo and (nn == "mcl_core:snowblock" or nn == "mcl_core:snow" or (minetest.get_item_group(nn, "grass_block_snow") == 1)) then + if not chunk_has_igloo and (nn == "mcl_core:snowblock" or nn == "mcl_core:snow" or (minetest.get_item_group(nn, "grass_block_snow") == 1)) then if pr:next(1, 4400) == 1 then -- Check surface local floor = {x=p.x+9, y=p.y-1, z=p.z+9} @@ -2211,11 +2185,18 @@ mcl_mapgen_core.register_generator("main", basic, basic_node, 1, true) mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blockseed) local gennotify = minetest.get_mapgen_object("gennotify") local pr = PseudoRandom(blockseed + 42) + local has_struct = {} + local poshash = minetest.hash_node_position(minp) for _,struct in pairs(mcl_structures.registered_structures) do + local has = false + if has_struct[struct.name] == nil then has_struct[struct.name] = {} end for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do - local realpos = vector.offset(pos,0,-1,0) + local realpos = vector.offset(pos,0,1,0) minetest.remove_node(realpos) - mcl_structures.place_structure(realpos,struct,pr) + if struct.chunk_probability ~= nil and not has and pr:next(1,struct.chunk_probability) ~= 1 then + mcl_structures.place_structure(realpos,struct,pr) + has=true + end end end end, 100, true) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index c0167060b..e2daef96b 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -9,16 +9,18 @@ function mcl_structures.place_structure(pos, def, pr) elseif def.y_offset then y_offset = def.y_offset end + local pp = vector.offset(pos,0,y_offset,0) if def.solid_ground and def.sidelen then - local node = minetest.get_node(vector.offset(pos,1,1,0)) + local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) + local node_top = minetest.registered_biomes[bn].node_top + local node_fill = minetest.registered_biomes[bn].node_filler local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"}) - local air = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,4,def.sidelen/2),{"air"}) - if #solid < ( def.sidelen * def.sidelen ) or - #air < (def.sidelen * def.sidelen ) then + if #solid < ( def.sidelen * def.sidelen ) then if def.make_foundation then - minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,vector.offset(ground_p2,0,-30,0),{"air"}),node) + minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_fill}) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") @@ -34,13 +36,18 @@ function mcl_structures.place_structure(pos, def, pr) return false end if def.filenames then - local file = def.filenames[pr:next(1,#def.filenames)] - local pp = vector.offset(pos,0,y_offset,0) - mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",def.after_place,pr,{pos,def}) - if logging then - minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + table.shuffle(def.filenames) + local file = def.filenames[1] + if file then + local ap = function(pos,def,pr) end + if def.after_place then ap = def.after_place end + + mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",function(p) return ap(pos,def,pr) end,pr) + if logging then + minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + end + return true end - return true elseif def.place_func and def.place_func(pos,def,pr) then if not def.after_place or ( def.after_place and def.after_place(pos,def,pr) ) then if logging then @@ -65,23 +72,26 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it sbgroups.structblock = nil sbgroups.structblock_lbm = 1 else - def.deco = minetest.register_decoration({ - name = "mcl_structures:deco_"..name, - decoration = structblock, - deco_type = "simple", - place_on = def.place_on, - spawn_by = def.spawn_by, - num_spawn_by = def.num_spawn_by, - sidelen = 80, - fill_ratio = def.fill_ratio, - noise_params = def.noise_params, - flags = flags, - biomes = def.biomes, - y_max = def.y_max, - y_min = def.y_min - }) - def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) - minetest.set_gen_notify({decoration=true}, { def.deco_id }) + minetest.register_on_mods_loaded(function() --make sure all previous decorations and biomes have been registered + def.deco = minetest.register_decoration({ + name = "mcl_structures:deco_"..name, + decoration = structblock, + deco_type = "simple", + place_on = def.place_on, + spawn_by = def.spawn_by, + num_spawn_by = def.num_spawn_by, + sidelen = 80, + fill_ratio = def.fill_ratio, + noise_params = def.noise_params, + flags = flags, + biomes = def.biomes, + y_max = def.y_max, + y_min = def.y_min + }) + def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) + minetest.set_gen_notify({decoration=true}, { def.deco_id }) + --catching of gennotify happens in mcl_mapgen_core + end) end minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock @@ -94,10 +104,10 @@ minetest.register_lbm({ run_at_every_load = true, nodenames = {"group:structblock_lbm"}, action = function(pos, node) + minetest.remove_node(pos) local name = node.name:gsub("mcl_structures:structblock_","") local def = mcl_structures.registered_structures[name] if not def then return end - minetest.remove_node(pos) mcl_structures.place_structure(pos) end }) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua new file mode 100644 index 000000000..9398e6062 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -0,0 +1,107 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +local function temple_placement_callback(p1, p2, pr) + -- Delete cacti leftovers: + local cactus_nodes = minetest.find_nodes_in_area_under_air(p1, p2, "mcl_core:cactus") + if cactus_nodes and #cactus_nodes > 0 then + for _, pos in pairs(cactus_nodes) do + local node_below = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + if node_below and node_below.name == "mcl_core:sandstone" then + minetest.swap_node(pos, {name="air"}) + end + end + end + + -- Find chests. + -- FIXME: Searching this large area just for the chets is not efficient. Need a better way to find the chests; + -- probably let's just infer it from newpos because the schematic always the same. + local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest") + + -- Add desert temple loot into chests + for c=1, #chests do + local lootitems = mcl_loot.get_multi_loot({ + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 }, + { itemstring = "mcl_books:book", weight = 20, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_mobitems:saddle", weight = 20, }, + { itemstring = "mcl_core:apple_gold", weight = 20, }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 3 }, + { itemstring = "", weight = 15, }, + { itemstring = "mcl_mobitems:iron_horse_armor", weight = 15, }, + { itemstring = "mcl_mobitems:gold_horse_armor", weight = 10, }, + { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, }, + { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }, + { + stacks_min = 4, + stacks_max = 4, + items = { + { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_core:sand", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 }, + } + }}, pr) + mcl_structures.init_node_construct(chests[c]) + local meta = minetest.get_meta(chests[c]) + local inv = meta:get_inventory() + mcl_loot.fill_inventory(inv, "main", lootitems, pr) + end + + -- Initialize pressure plates and randomly remove up to 5 plates + local pplates = minetest.find_nodes_in_area(p1, p2, "mesecons_pressureplates:pressure_plate_stone_off") + local pplates_remove = 5 + for p=1, #pplates do + if pplates_remove > 0 and pr:next(1, 100) >= 50 then + -- Remove plate + minetest.remove_node(pplates[p]) + pplates_remove = pplates_remove - 1 + else + -- Initialize plate + minetest.registered_nodes["mesecons_pressureplates:pressure_plate_stone_off"].on_construct(pplates[p]) + end + end +end + +mcl_structures.register_structure("desert_temple",{ + place_on = {"group:sand"}, + noise_params = { + offset = 0, + scale = 0.0000822, + spread = {x = 250, y = 250, z = 250}, + seed = 34115, + octaves = 3, + persist = -0.4, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z", + solid_ground = true, + make_foundation = true, + sidelen = 18, + y_offset = -12, + chunk_probability = 256, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + biomes = { "Desert" }, + after_place = function(pos,def,pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + temple_placement_callback(p1, p2, pr) + end, + filenames = { modpath.."/schematics/mcl_structures_desert_temple.mts" }, +}) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index ffc25d40c..f15072165 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -67,6 +67,7 @@ local function init_node_construct(pos) end return false end +mcl_structures.init_node_construct = init_node_construct -- The call of Struct function mcl_structures.call_struct(pos, struct_style, rotation, pr) @@ -74,11 +75,7 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr) if not rotation then rotation = "random" end - if struct_style == "desert_temple" then - return mcl_structures.generate_desert_temple(pos, rotation, pr) - elseif struct_style == "desert_well" then - return mcl_structures.generate_desert_well(pos, rotation) - elseif struct_style == "igloo" then + if struct_style == "igloo" then return mcl_structures.generate_igloo(pos, rotation, pr) elseif struct_style == "witch_hut" then return mcl_structures.generate_witch_hut(pos, rotation) @@ -101,12 +98,6 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr) end end -function mcl_structures.generate_desert_well(pos, rot) - local newpos = {x=pos.x,y=pos.y-2,z=pos.z} - local path = modpath.."/schematics/mcl_structures_desert_well.mts" - return mcl_structures.place_schematic(newpos, path, rot or "0", nil, true) -end - function mcl_structures.generate_igloo(pos, rotation, pr) -- Place igloo local success, rotation = mcl_structures.generate_igloo_top(pos, pr) @@ -443,93 +434,6 @@ function mcl_structures.generate_end_portal_shrine(pos, rotation, pr) mcl_structures.place_schematic(newpos, path, rotation or "0", nil, true, nil, shrine_placement_callback, pr) end -local function temple_placement_callback(p1, p2, size, rotation, pr) - - -- Delete cacti leftovers: - local cactus_nodes = minetest.find_nodes_in_area_under_air(p1, p2, "mcl_core:cactus") - if cactus_nodes and #cactus_nodes > 0 then - for _, pos in pairs(cactus_nodes) do - local node_below = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) - if node_below and node_below.name == "mcl_core:sandstone" then - minetest.swap_node(pos, {name="air"}) - end - end - end - - -- Find chests. - -- FIXME: Searching this large area just for the chets is not efficient. Need a better way to find the chests; - -- probably let's just infer it from newpos because the schematic always the same. - local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest") - - -- Add desert temple loot into chests - for c=1, #chests do - local lootitems = mcl_loot.get_multi_loot({ - { - stacks_min = 2, - stacks_max = 4, - items = { - { itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 }, - { itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 }, - { itemstring = "mcl_books:book", weight = 20, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_mobitems:saddle", weight = 20, }, - { itemstring = "mcl_core:apple_gold", weight = 20, }, - { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, - { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 3 }, - { itemstring = "", weight = 15, }, - { itemstring = "mcl_mobitems:iron_horse_armor", weight = 15, }, - { itemstring = "mcl_mobitems:gold_horse_armor", weight = 10, }, - { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, }, - { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, - } - }, - { - stacks_min = 4, - stacks_max = 4, - items = { - { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_core:sand", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 }, - } - }}, pr) - init_node_construct(chests[c]) - local meta = minetest.get_meta(chests[c]) - local inv = meta:get_inventory() - mcl_loot.fill_inventory(inv, "main", lootitems, pr) - end - - -- Initialize pressure plates and randomly remove up to 5 plates - local pplates = minetest.find_nodes_in_area(p1, p2, "mesecons_pressureplates:pressure_plate_stone_off") - local pplates_remove = 5 - for p=1, #pplates do - if pplates_remove > 0 and pr:next(1, 100) >= 50 then - -- Remove plate - minetest.remove_node(pplates[p]) - pplates_remove = pplates_remove - 1 - else - -- Initialize plate - minetest.registered_nodes["mesecons_pressureplates:pressure_plate_stone_off"].on_construct(pplates[p]) - end - end -end - -function mcl_structures.generate_desert_temple(pos, rotation, pr) - -- No Generating for the temple ... Why using it ? No Change - local path = modpath.."/schematics/mcl_structures_desert_temple.mts" - local newpos = {x=pos.x,y=pos.y-12,z=pos.z} - --local size = {x=22, y=24, z=22} - if newpos == nil then - return - end - mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true, nil, temple_placement_callback, pr) -end - local structure_data = {} --[[ Returns a table of structure of the specified type. @@ -572,6 +476,31 @@ local function dir_to_rotation(dir) end dofile(modpath.."/api.lua") +dofile(modpath.."/desert_temple.lua") +dofile(modpath.."/jungle_temple.lua") + +mcl_structures.register_structure("desert_well",{ + place_on = {"group:sand"}, + noise_params = { + offset = 0, + scale = 0.00012, + spread = {x = 250, y = 250, z = 250}, + seed = 233, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z", + not_near = { "desert_temple_new" }, + solid_ground = true, + sidelen = 4, + chunk_probability = 64, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + y_offset = -2, + biomes = { "Desert" }, + filenames = { modpath.."/schematics/mcl_structures_desert_well.mts" }, +}) -- Debug command minetest.register_chatcommand("spawnstruct", { @@ -589,11 +518,7 @@ minetest.register_chatcommand("spawnstruct", { local pr = PseudoRandom(pos.x+pos.y+pos.z) local errord = false local message = S("Structure placed.") - if param == "desert_temple" then - mcl_structures.generate_desert_temple(pos, rot, pr) - elseif param == "desert_well" then - mcl_structures.generate_desert_well(pos, rot) - elseif param == "igloo" then + if param == "igloo" then mcl_structures.generate_igloo(pos, rot, pr) elseif param == "witch_hut" then mcl_structures.generate_witch_hut(pos, rot, pr) diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua new file mode 100644 index 000000000..1dc89b787 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -0,0 +1,70 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +local function temple_placement_callback(p1, p2, pr) + --dont remove foliage - looks kind of nice for a jt + local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:trapped_chest_small") + -- Add jungle temple loot into chests + for c=1, #chests do + local lootitems = mcl_loot.get_multi_loot({ + { + stacks_min = 2, + stacks_max = 6, + items = { + { itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 16, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + --{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_mobitems:saddle", weight = 3, }, + { itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }}, pr) + mcl_structures.init_node_construct(chests[c]) + local meta = minetest.get_meta(chests[c]) + local inv = meta:get_inventory() + mcl_loot.fill_inventory(inv, "main", lootitems, pr) + end + -- TODO: initialize traps +end + +mcl_structures.register_structure("jungle_temple",{ + place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, + noise_params = { + offset = 0, + scale = 0.0000812, + spread = {x = 250, y = 250, z = 250}, + seed = 31585, + octaves = 3, + persist = -0.2, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z", + solid_ground = true, + make_foundation = true, + y_offset = -5, + chunk_probability = 256, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + biomes = { "Jungle" }, + sidelen = 18, + filenames = { + modpath.."/schematics/mcl_structures_jungle_temple.mts", + modpath.."/schematics/mcl_structures_jungle_temple_nice.mts", + }, + after_place = function(pos,def,pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + temple_placement_callback(p1, p2, pr) + end, +}) diff --git a/mods/MAPGEN/mcl_structures/mod.conf b/mods/MAPGEN/mcl_structures/mod.conf index c19113ad4..823714aad 100644 --- a/mods/MAPGEN/mcl_structures/mod.conf +++ b/mods/MAPGEN/mcl_structures/mod.conf @@ -1,4 +1,4 @@ name = mcl_structures author = Wuzzy, cora description = Structure placement for MCL2 -depends = mcl_loot +depends = mcl_init, mcl_loot diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple.mts new file mode 100644 index 0000000000000000000000000000000000000000..ec98a83ea359fafabc55ec0df882634a601a9790 GIT binary patch literal 2586 zcmZ{geK?f)8poe8%`?M1F(@-ec+gl@=84SiYG&)$S z-OzYxSFW+W;cPX=U|QPhq$0FxwHuo*wX(F*xw7qEd(PSO`{#TAzMuPhU)O!_3Jcu@ zECW^m#(-(ge>{Kypt*4pU_~Nd#O5bUgtWxu)YL=#WFAi>1Wf*PKNvPkMyxP3EtQrg z;flpV0ek7oPEF*BL;&f}Kx$fYl8`5f<0mW)1c>iRY8p3Al1f_=_J@(=zlrcATz-O3 z09gJV<4Q7w0>Ca&m@4EaC#A9vaz!GMFheMzy|36yB|AAL2C(_FMIaP$4+$l-5Bi?6 z-2w6+oOUoyB4kskRCg+sN?pqSH(MefnEf9)wm9znnyIwkm7SUv$4@x4l&Ac^o^%hTYFbK* zQ85lKXqVGB_0r`?m{d?jLPX$cX$6XBz_d=3U z#KV1509YShJr;)@b%xVLW5M9Oxt7P(%y>Fw3~3sun(f|eC*cVb0bb(d;m)~0^nB}n z$4)iZxykSe(HoS%Yu$@4`vKb+Y@wzdZEnf0!j|Q$_o~0-a{+pWdez71Eodt=zH1Dn zfbI;#kr>4CGx=@#m55E5h3AA$TfZK?R{q9$sUjOKPjNOQPe*u z;nrIQqJukly3iJSh_CMToCKTR=Q#5Ub0S9l8J0k_?>6pcbU1ouChw{$ zf3SF!x9+lox{>G$M!euM;`ei1*y;y2#w-1sp#?|*$#0|PD+_X0Zd2t8xKp%+34_WO zT)j<%k6wB=fU!uwXg*y}l+g$KmiJG0MH_ee6&Ri?*H&Vym0FX^FV(&7DNjK(I%O)< zLPa(VA@h>AA%Xb=Y-OfU1@H9qknRh_osk~7bxZmc#7G)?e5Je$6%x(b_YmH-s(^PeqdFRM*VgoVw2PulV{E=Kj&#A+(|Ot3KjF zB3bagx>n}yRHPmgUDxuo`>=DxkLEtfr&6GndMyC{fp_?qjp-bgLafhLgt_M%G7USa#{9 zF1|3uMjtLaB!b!=ZW>{F4E7NnL052m#z2C0{RO6A80%YRpq=RoacH%;&?vq`TVGm$ zGV3Lr$!B^uJMvsMkn~{9EMD@^pmjc_0dxczBag3`dF0*DA$>Hv{_ zfD}sWWB@-svq%$5t6?qNcR*FG9I)VXfRi|i@*5W0#LWNY9v>z}iC8oji6?KEI&8V^ zWRm~x-Ortm3Td`GH=0|!;;!OMSoS^0Tk$;GWY%?arRKYQoZYdvSX7<1-e&Jg{Z*<7 zAD@@C`r}1^)X9kKw>iNIP1*x~$#J@^E8%+Wj~K}Pc^q+D8^V_%Z3BD;wv1jdx{kmS zz09?nJ=1i=t4WLTd8!R@+hJHpd3&!b@9CEKhg(0Hr>5&?Irsydc|Up^9LP{D7scUD zw=SNYw@k?DB)e*!QQV@$jdt;c_?SamqkIi^3!Y_JYA{E$vwikG>Lk0yeyi?wTWd{N z^I-bf`J$l`D*ohSWY&M#yDog9y3aK4wRn{Jy5qcNf%JL}GWA(tFvHV_A5`5N;EISGrkzns~%qASTJ#+TRBNS_ZmZjrz& zrEkZ+W8HO*7=lfRYirrZE$Gt`Ja~gGYeUo`pQg6)SNvue)4DT#c^=SGV0hFlH!2RT>_S>0gOg?poutm|OmZ(?c$1 z&3z9GS9#QPKaAmJ6B0aymKdxMcxRD<+s7M2vh3X238#8e&RH3|cvm%5-Fv1?I2UGH z+fiN|)P0i^3E%~92( PMR$B;S^$V<9U%W35Sd5n literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple_nice.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_jungle_temple_nice.mts new file mode 100644 index 0000000000000000000000000000000000000000..8a9babb9bfc2206450f07356bc2166847c6a2e99 GIT binary patch literal 3997 zcmaJTEmbceda8{PTRC=l#6j&+ECY5yYhX%TwzAKSfKz&zY{VtcWjp?t7MXG9|VDg?~#m5u}qZ_^uY*!m2~(MibN%r zY?Gz{_6R9fb zSNk3n`T!2U;Xyevl~l-Lv3yu87V87|zp)RK&U!bF6Na9TC6 zkA-ksa}mxD`x>u4BkZ_oaMTCn&-5^Bqd4X*>Cm zS-vb^mJgK|;pUhmG7C6E^w*E#tbD8@!ZO7htPV;LUlv-wbWzARk`hRB1(0=(1Co?r zhOBvy%U0MoHsBD*$MILe4Oaod{v-o{a5VmG@s0N&pen;r!Z(hp>aq3gJ99&?PBlt9 zz7r_()rQ2_qDS!;Pn{+)bKi6y`kL)tQ~(o9uoFD7!&jYS7E2IEdjZ#Pl#PWASs)1I z;n1x|(c5-U`>}jQr?WQg?CS$o7595i;ja}BO%Q=+cHKt@*nxz{p#jES!^)^D$@IB%w1^Y+koM>=k|a@Rn@llAaS9auHU2C>!Tc&D?p$Z#8*J zW|=}srH;mxH61}G#wA;EV}jV@PB^Q|H$NHOKtp)UVxVV%GeXzXYcBRnMRvGrEH(vc z6k;*1lngITUM2Iy8mD0fp^m}?r_K@tkyJS)A}!IrSO0RZ zZqekZcQpPi?y>joNmx>lq+{c(_;e_@=2Rcv&OYAwos~Vv1i2xaLp7!-cbcgky3~(c zz0(x8$QjX8##yoHbI-vA#`U&tPf+4D`mlsOMI)PT4Rt;MqP{A>anT{?99zf1J`0VY zmMIUS`R#B-TwDF8dTNLr;^iysI4>be{Uk+UvsF_JaF>RBuFGD`T@bQNbebRYg?aNf zPF#TJdG-^=d4G5HLFP*3B{vHabqP0JDDggJe6n#$>fAWdi_KwzQ%i#z1d%3yfH4iQ zX<&$Q3uq8RQ8c)04T`d>n-P`pwjdErYNv27-9{Ps+83s)A%iNLoWleCYBz&8b6B>6zObNimzv{cN`lMopH{m;K8BNo!vxAnP%&h8z6z z!Te(_(IMdYdJ_&YFF?yD*#knF%Q4LN%N=8DH8sT#1qo&4c=swYS^2r^VNwm5M2dOR zdam#+ZLODG+(YNRN2@Jr9cW_k?3IJ@T41*mf%vMi-HN!~IIV6BZ|q&aHcUf483Dn3 z;Yj{L-2=n`4QgF8e&43SA?Yidp;}`1Q`hiB-BY~PVppG4p)r4ltQS$(OGF)ka1XP& zQ|(0mId|8jX0+9s_ocRQv~fuq5`Jqh{j>pt*%KBBzv&W|enxzu0-t5!xnR`8RUBwn zU%jv3I4tLlR9j7NzLAL7;C%c9Y<<0EQ$O;{-UGK!}a^iD>xIJ-aX=_ zxRbY{al@rRk54F~^$7!kIQfNRyA<@;H+`qC&R@;js=&_OuYJI~Xu8U0f=j@0e>BE= z(?r++o!QuKT%rBzQp;!8)Vn)T%Z{TX)24mQLoTq*%%Tf=ZHuG#rNk@CPD@%UzA-jQyJAl#TlvAj05F1qDqWucm-J9w5^cuw zQB^PMxxK!M(( zXY$04FpJ+R`z)KDvs*Q*yc&*iFJ&tCNBaV|DQzmkr|mUz@=hkY#!)n;H;n+k$!`0j zJCm!?UiZY_u0AUd@4P!Q7sV9>zE&2uTO37uVs*0?b}N>BKc)+$f!$978dkE?D3+B= zXp>GG-tr*W`cu?1QBz}A`}eT9*6NmHT*?W?iVB20I;<0Y>zUd_dPusAyF^?dqP83| zvvbV->W>IVndF@fe8nOcclpklVw{Z7KHoc1T`)8XC9qQ^Kb%0B&LApbJuRqO6XH() z&o`VpdVxoeN`rXk)t9bQ)7evoFWiiqJFcrq>4kH|hbw~8mSUQ}MPAGQ%m-@=cx2(y z`Mgb%X#Hw8FH+5xO>%Nw6U~6$o^jYXZp8$rKDSS^#yMsN<3bCvI8c=vvNjrNhz!vz zLh>vd%3TE2DD`b`o>xjYK_~}i_KL;^cIVz>m1v|iLkQ1uUH}dR>H^uEqF5G-21I!@ z+zaj>i=7+s0$%PQ_+7th*?13$8VCHtzq{I zfrcT+mcK{bCPkoz{Du%W)66jx_>4%s-6s3y&FS8S@CGg8Z__Q2pCboaoK5Bnk#N+8 z8&SkG#Dg?qXcxB?QxDqKSjJT}Rl|}45MQ80;ykVQ@o>VnzxWJEtha>K&uEh=#qIu> z^$%!2eKjANco3WjL&olb3EsR5mHVFUlPiPKw34gpcQHU!aWQ|-FMA<`nHyZ`Hrp>^ z|FAGiWB=ttcKwhQA8anMTuCGZ^%r!pRXoi#wzY7IhF;KvVh>$n%jX{3@Re!sc!yNh z&wa#SD!kX+TETeUA*&pQw7bY&&B_Kra@WEgy!lAm&)&Uz?&CsStai;gb>?q*najH1 zaJRK}Q|B)9O^8;|esXr`OR!ouRM*@`shV*+uaR{SdnQ<5!q;!!of!7tSn(2z&3Mkq zKU-{{7Lzly@8~4;`DnZ25<~z%v6+FO#tV`BJ;u?qeMgwFtIbEeW5O;{x@<+V%nHs7 zd*lk6I)Thm=8`6N+*FLf6==P0mrogZ|B**XlCeGEPht1RHLe}tO*94d1y zp2r?xjUIdDY%rd8JyQ|>qT>JuUx}T`ty~){zqzGirB`+|3tOGP?DTij+8{w`40&C} z(teUCzc=pgy?bL#^jP8;YvFBMY`BdG2|TczNiY~ole=v%(i%B%$88c4N3DfYNEUNp zKuzAW;*BVGk;SPi>eo0@4MddS?C8(1MKq!TQN`>rTHq%im9;^315z?HZCT8?c#Q=2 z&#>p!qjJZM^7L?NA7+U#7<#F;hGo5?zmTyyB#Nw@OFuopp zgDv6CTF1pmX6RwHXujj&)gUOhWOT6)>7mS$sgH7B*{vk>9AU=79cpjrcxU^i=pn*u zU{R>rvbh%)c=+HmG-B_8m0y2rgt!@Sy60Co{g32>`hXYVm1y@?mIkxDVH(k%qj@0MTC4N9Z!zdSvdT--g=c%QLM9Vb$SMow{7aS}_wj|$IERDfA_k*$Jawwaga5MN z^1GW^u*)!C{N@Ys32S|QVn8S_!0lT$U(fP@ZZl?6qTT$cfeS~T)Cn}?`SH^@d9|KV z%sS9rIO5H#@6RH|R)?wVOWRHGa`e5Tcu-!YFUJZjlw-VA`r#2ES`UpDR!8WnFl~rr zy!@3ESx8>6CxH5b-#={e2316&E48SPDcpvC+*qY#F78`)wqz?1MtCZDiUW^G3L@)t zqN-W*v^1H}K^o*n$(8X+r|&F6Vs#}2B?WEj(_{K_(>4xX5gy`F#|r<^`{RYaqR?LJ pHN?S1`DLzI;o0hlyw)Nz;u}M77ZpGdE5m~ZjggK3Z{<4eKLH|kbT0q^ literal 0 HcmV?d00001 From b396a3c6ee19481e8f50830a91dbe98e5e35be93 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 02:18:57 +0200 Subject: [PATCH 09/29] update API.md --- mods/MAPGEN/mcl_structures/API.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/API.md b/mods/MAPGEN/mcl_structures/API.md index 23d93c712..ea051603f 100644 --- a/mods/MAPGEN/mcl_structures/API.md +++ b/mods/MAPGEN/mcl_structures/API.md @@ -12,13 +12,19 @@ If nospawn is truthy the structure will not be placed by mapgen and the decorati y_max =, place_on = {}, spawn_by = {}, - num_spawn_by = + num_spawn_by =, flags = (default: "place_center_x, place_center_z, force_placement") (same as decoration def) - y_offset =, --can be a number or a function returning a number + y_offset =, --can be a number or a function returning a number filenames = {} OR place_func = function(pos,def,pr) - -- filenames can be a list of any schematics accepted by mcl_structures.place_schematic / minetest.place_schematic + -- filenames can be a list of any schematics accepted by mcl_structures.place_schematic / minetest.place_schematic + on_place = function(pos,def,pr) end, + -- called before placement. denies placement when returning falsy. after_place = function(pos,def,pr) + -- executed after successful placement + sidelen = int, --length of one side of the structure. used for foundations. + solid_ground = bool, -- structure requires solid ground + make_foundation = bool, -- a foundation is automatically built for the structure. needs the sidelen param } ## mcl_structures.registered_structures Table of the registered structure defintions indexed by name. From 47eca3f7747b13231c85a5e50d2f9c42b4a30ac3 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 03:08:52 +0200 Subject: [PATCH 10/29] fix callbacks --- mods/MAPGEN/mcl_structures/desert_temple.lua | 12 +++++------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 9398e6062..fed97f047 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -2,7 +2,10 @@ local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local modpath = minetest.get_modpath(modname) -local function temple_placement_callback(p1, p2, pr) +local function temple_placement_callback(pos,def, pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) -- Delete cacti leftovers: local cactus_nodes = minetest.find_nodes_in_area_under_air(p1, p2, "mcl_core:cactus") if cactus_nodes and #cactus_nodes > 0 then @@ -97,11 +100,6 @@ mcl_structures.register_structure("desert_temple",{ y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Desert" }, - after_place = function(pos,def,pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - temple_placement_callback(p1, p2, pr) - end, filenames = { modpath.."/schematics/mcl_structures_desert_temple.mts" }, + after_place = temple_placement_callback }) diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1dc89b787..a8d93ca5d 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -2,7 +2,10 @@ local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local modpath = minetest.get_modpath(modname) -local function temple_placement_callback(p1, p2, pr) +local function temple_placement_callback(pos,def, pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) --dont remove foliage - looks kind of nice for a jt local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:trapped_chest_small") -- Add jungle temple loot into chests @@ -61,10 +64,5 @@ mcl_structures.register_structure("jungle_temple",{ modpath.."/schematics/mcl_structures_jungle_temple.mts", modpath.."/schematics/mcl_structures_jungle_temple_nice.mts", }, - after_place = function(pos,def,pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - temple_placement_callback(p1, p2, pr) - end, + after_place = temple_placement_callback }) From 065767cc77870c2b1c2c6f5de7ed4e62d2719082 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 03:09:50 +0200 Subject: [PATCH 11/29] Add Ocean Ruins - schematics by PrarieWind --- mods/MAPGEN/mcl_structures/init.lua | 1 + mods/MAPGEN/mcl_structures/ocean_ruins.lua | 104 ++++++++++++++++++ .../mcl_structures_ocean_ruins_cold_1.mts | Bin 0 -> 333 bytes .../mcl_structures_ocean_ruins_cold_2.mts | Bin 0 -> 396 bytes .../mcl_structures_ocean_ruins_cold_3.mts | Bin 0 -> 697 bytes 5 files changed, 105 insertions(+) create mode 100644 mods/MAPGEN/mcl_structures/ocean_ruins.lua create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_1.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_2.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_3.mts diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index f15072165..176c09acd 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -478,6 +478,7 @@ end dofile(modpath.."/api.lua") dofile(modpath.."/desert_temple.lua") dofile(modpath.."/jungle_temple.lua") +dofile(modpath.."/ocean_ruins.lua") mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua new file mode 100644 index 000000000..53115d38f --- /dev/null +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -0,0 +1,104 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) +local cold_oceans = { + "RoofedForest_ocean", + "BirchForestM_ocean", + "BirchForest_ocean", + "IcePlains_deep_ocean", + "ExtremeHillsM_deep_ocean", + "SunflowerPlains_ocean", + "MegaSpruceTaiga_deep_ocean", + "ExtremeHillsM_ocean", + "SunflowerPlains_deep_ocean", + "BirchForest_deep_ocean", + "IcePlainsSpikes_ocean", + "StoneBeach_ocean", + "ColdTaiga_deep_ocean", + "Forest_deep_ocean", + "FlowerForest_deep_ocean", + "MegaTaiga_ocean", + "StoneBeach_deep_ocean", + "IcePlainsSpikes_deep_ocean", + "ColdTaiga_ocean", + "ExtremeHills+_deep_ocean", + "ExtremeHills_ocean", + "Forest_ocean", + "MegaTaiga_deep_ocean", + "MegaSpruceTaiga_ocean", + "ExtremeHills+_ocean", + "RoofedForest_deep_ocean", + "IcePlains_ocean", + "FlowerForest_ocean", + "ExtremeHills_deep_ocean", + "Taiga_ocean", + "BirchForestM_deep_ocean", + "Taiga_deep_ocean", +} +local function ruins_placement_callback(pos, def, pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest_small") + for c=1, #chests do + local lootitems = mcl_loot.get_multi_loot({ + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_core:coal_lump", weight = 25, amount_min = 1, amount_max=4 }, + { itemstring = "mcl_farming:wheat_item", weight = 25, amount_min = 2, amount_max=3 }, + { itemstring = "mcl_core:gold_nugget", weight = 25, amount_min = 1, amount_max=3 }, + --{ itemstring = "mcl_maps:treasure_map", weight = 20, }, --FIXME Treasure map + + { itemstring = "mcl_books:book", weight = 10, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_fishing:fishing_rod_enchanted", weight = 20, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_armor:chestplate_leather", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:apple_gold", weight = 20, }, + { itemstring = "mcl_armor:helmet_gold", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }}, pr) + mcl_structures.init_node_construct(chests[c]) + local meta = minetest.get_meta(chests[c]) + local inv = meta:get_inventory() + mcl_loot.fill_inventory(inv, "main", lootitems, pr) + end +end + +mcl_structures.register_structure("cold_ocean_ruins",{ + place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, + spawn_by = {"mcl_core:water_source"}, + num_spawn_by = 2, + noise_params = { + offset = 0, + scale = 0.0000812, + spread = {x = 250, y = 250, z = 250}, + seed = 146315, + octaves = 3, + persist = -0.2, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, force_placement", + solid_ground = true, + make_foundation = true, + y_offset = 0, + y_min = mcl_vars.mg_overworld_min, + y_max = 1, + biomes = cold_oceans, + chunk_probability = 64, + sidelen = 4, + filenames = { + modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", + modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts", + modpath.."/schematics/mcl_structures_ocean_ruins_cold_3.mts", + }, + after_place = ruins_placement_callback +}) diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_1.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_1.mts new file mode 100644 index 0000000000000000000000000000000000000000..1b2c8d1f3e4acae6e17dab9dbaaa4f285b4bae0e GIT binary patch literal 333 zcmeYb3HD`RVPI!qWnilZ0R|2R=ETe*2L9aSocQGYqExHo{G_CuR0d(VKygWaUTRWN zW^y)z1Qx;E{NmzD1`)Unm=85X6eOCToSK+tRh*g_pOctZl3J9YJ?B67WNk=I`{uGNB}1j7t9znkKzSLLte>z-qg<}YK8Ilc bzMbU-H(a0F2i7-;XYAK}|Bfb0|qVz=ETe*29ez4ocQGYqExHg{Nm!uCM6w~PG%r0TwLCvR zg+UCgEhDwKq}U2f#TVx$=HwtLE-ol4O$IBjnDaCsQ0%Y*M|0QfvaI!XJOPih_kXjl z31|^Wa&`GUMfOwoN|W->FHfdCFf1s&!~f*+?E6x$xV{uVepzrdB{NE6aaGQ$lQ(W& zxSmp(E8SC+_Aqv-`Lnd=CGP{oWb*ePy~h^*D0@ldfy9}$f4EBcP0>eL@pMETLu8FR6-VeJk9FG<#ZjU(J%Bj{h>CWS(e2IrO$5WU0wB@6)RK(UBCFiQ^xQ;bdkcz6 zlT*v{^HUgj;hKvR^HLbZz}$?~;*w%3Fcn{%o0x;_=B(1Z^c;v@NrYawN0JkZ%2HD* z=DeNOUDm9?)L*PrcrTWLJJFv0t@#A);s@2Ttps+CrWmuqmQHPT=-qo5-$TjefZgs*#>9^ajY(83T ze`oU@=|-DxV#Q8{e}Y}vMfxOPsrtJuI3w2?7PTk4Dkx>+8m+RrSpi=5KXF{1hSYvfCO- ziTh(tcBKBZ>A$&UpYM&#SG8NVGFAWFYc7|w+uV7ZVa+wKTg8{Wetdp?t#ny2hv@6` z_dXn7aIwfa{oPut{cf(GS7saOH>oRD`<(fF;av5lsMtMXho}AW@c!2+f?u@bjC=SHb@>>vrA_-CKU-Y4YByyH{)v-V*gI_QL(trs=QC zfBrfbyd!Jv>*vbC4qgA1)8sb)U$A%gKNa7t|Binu{(E*AbNTJvhK1U8e>1LKuM~E$ lwx1uuf0SkBzvWktC+%IGre`-nu Date: Fri, 24 Jun 2022 03:36:21 +0200 Subject: [PATCH 12/29] Add loot generation to api --- mods/MAPGEN/mcl_structures/API.md | 3 + mods/MAPGEN/mcl_structures/api.lua | 25 +++++- mods/MAPGEN/mcl_structures/desert_temple.lua | 87 +++++++++----------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 62 ++++++-------- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 66 +++++++-------- 5 files changed, 114 insertions(+), 129 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/API.md b/mods/MAPGEN/mcl_structures/API.md index ea051603f..074810186 100644 --- a/mods/MAPGEN/mcl_structures/API.md +++ b/mods/MAPGEN/mcl_structures/API.md @@ -25,6 +25,9 @@ If nospawn is truthy the structure will not be placed by mapgen and the decorati sidelen = int, --length of one side of the structure. used for foundations. solid_ground = bool, -- structure requires solid ground make_foundation = bool, -- a foundation is automatically built for the structure. needs the sidelen param + loot = , + --a table of loot tables for mcl_loot indexed by node names + -- e.g. { ["mcl_chests:chest_small"] = {loot},... } } ## mcl_structures.registered_structures Table of the registered structure defintions indexed by name. diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index e2daef96b..ebdfdfbea 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,5 +1,21 @@ mcl_structures.registered_structures = {} +local function generate_loot(pos, def, pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + for it,lt in pairs(def.loot) do + local nodes = minetest.find_nodes_in_area(p1, p2, it) + for _,p in pairs(nodes) do + local lootitems = mcl_loot.get_multi_loot( lt, pr) + mcl_structures.init_node_construct(p) + local meta = minetest.get_meta(p) + local inv = meta:get_inventory() + mcl_loot.fill_inventory(inv, "main", lootitems, pr) + end + end +end + function mcl_structures.place_structure(pos, def, pr) if not def then return end local logging = not def.terrain_feature @@ -42,7 +58,10 @@ function mcl_structures.place_structure(pos, def, pr) local ap = function(pos,def,pr) end if def.after_place then ap = def.after_place end - mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",function(p) return ap(pos,def,pr) end,pr) + mcl_structures.place_schematic(pp, file, "random", nil, true, "place_center_x,place_center_z",function(p) + if def.loot then generate_loot(pos,def,pr) end + return ap(pos,def,pr) + end,pr) if logging then minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) end @@ -88,13 +107,13 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) + minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) + def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) --catching of gennotify happens in mcl_mapgen_core end) end - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) - def.structblock = structblock mcl_structures.registered_structures[name] = def end diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index fed97f047..27e5ddfb9 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -17,54 +17,6 @@ local function temple_placement_callback(pos,def, pr) end end - -- Find chests. - -- FIXME: Searching this large area just for the chets is not efficient. Need a better way to find the chests; - -- probably let's just infer it from newpos because the schematic always the same. - local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest") - - -- Add desert temple loot into chests - for c=1, #chests do - local lootitems = mcl_loot.get_multi_loot({ - { - stacks_min = 2, - stacks_max = 4, - items = { - { itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 }, - { itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 }, - { itemstring = "mcl_books:book", weight = 20, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_mobitems:saddle", weight = 20, }, - { itemstring = "mcl_core:apple_gold", weight = 20, }, - { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, - { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 3 }, - { itemstring = "", weight = 15, }, - { itemstring = "mcl_mobitems:iron_horse_armor", weight = 15, }, - { itemstring = "mcl_mobitems:gold_horse_armor", weight = 10, }, - { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, }, - { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, - } - }, - { - stacks_min = 4, - stacks_max = 4, - items = { - { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_core:sand", weight = 10, amount_min = 1, amount_max = 8 }, - { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 }, - } - }}, pr) - mcl_structures.init_node_construct(chests[c]) - local meta = minetest.get_meta(chests[c]) - local inv = meta:get_inventory() - mcl_loot.fill_inventory(inv, "main", lootitems, pr) - end - -- Initialize pressure plates and randomly remove up to 5 plates local pplates = minetest.find_nodes_in_area(p1, p2, "mesecons_pressureplates:pressure_plate_stone_off") local pplates_remove = 5 @@ -101,5 +53,42 @@ mcl_structures.register_structure("desert_temple",{ y_min = 1, biomes = { "Desert" }, filenames = { modpath.."/schematics/mcl_structures_desert_temple.mts" }, - after_place = temple_placement_callback + after_place = temple_placement_callback, + loot = { + ["mcl_chests:chest_small" ] ={ + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_mobitems:bone", weight = 25, amount_min = 4, amount_max=6 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 25, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_mobitems:spider_eye", weight = 25, amount_min = 1, amount_max=3 }, + { itemstring = "mcl_books:book", weight = 20, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_mobitems:saddle", weight = 20, }, + { itemstring = "mcl_core:apple_gold", weight = 20, }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 3 }, + { itemstring = "", weight = 15, }, + { itemstring = "mcl_mobitems:iron_horse_armor", weight = 15, }, + { itemstring = "mcl_mobitems:gold_horse_armor", weight = 10, }, + { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 5, }, + { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }, + { + stacks_min = 4, + stacks_max = 4, + items = { + { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_core:sand", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 }, + } + }} + } }) diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index a8d93ca5d..1a7a620fe 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -2,44 +2,6 @@ local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local modpath = minetest.get_modpath(modname) -local function temple_placement_callback(pos,def, pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - --dont remove foliage - looks kind of nice for a jt - local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:trapped_chest_small") - -- Add jungle temple loot into chests - for c=1, #chests do - local lootitems = mcl_loot.get_multi_loot({ - { - stacks_min = 2, - stacks_max = 6, - items = { - { itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 16, amount_min = 3, amount_max=7 }, - { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, - --{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO - { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_mobitems:saddle", weight = 3, }, - { itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, }, - { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, - { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, - { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, - } - }}, pr) - mcl_structures.init_node_construct(chests[c]) - local meta = minetest.get_meta(chests[c]) - local inv = meta:get_inventory() - mcl_loot.fill_inventory(inv, "main", lootitems, pr) - end - -- TODO: initialize traps -end - mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, noise_params = { @@ -64,5 +26,27 @@ mcl_structures.register_structure("jungle_temple",{ modpath.."/schematics/mcl_structures_jungle_temple.mts", modpath.."/schematics/mcl_structures_jungle_temple_nice.mts", }, - after_place = temple_placement_callback + loot = { + ["mcl_chests:chest_small" ] ={{ + stacks_min = 2, + stacks_max = 6, + items = { + { itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 16, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + --{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_mobitems:saddle", weight = 3, }, + { itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }} + } }) diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index 53115d38f..1e477c3c2 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -35,43 +35,6 @@ local cold_oceans = { "BirchForestM_deep_ocean", "Taiga_deep_ocean", } -local function ruins_placement_callback(pos, def, pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - local chests = minetest.find_nodes_in_area(p1, p2, "mcl_chests:chest_small") - for c=1, #chests do - local lootitems = mcl_loot.get_multi_loot({ - { - stacks_min = 2, - stacks_max = 4, - items = { - { itemstring = "mcl_core:coal_lump", weight = 25, amount_min = 1, amount_max=4 }, - { itemstring = "mcl_farming:wheat_item", weight = 25, amount_min = 2, amount_max=3 }, - { itemstring = "mcl_core:gold_nugget", weight = 25, amount_min = 1, amount_max=3 }, - --{ itemstring = "mcl_maps:treasure_map", weight = 20, }, --FIXME Treasure map - - { itemstring = "mcl_books:book", weight = 10, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_fishing:fishing_rod_enchanted", weight = 20, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 1 }, - { itemstring = "mcl_armor:chestplate_leather", weight = 15, amount_min = 1, amount_max = 1 }, - { itemstring = "mcl_core:apple_gold", weight = 20, }, - { itemstring = "mcl_armor:helmet_gold", weight = 15, amount_min = 1, amount_max = 1 }, - { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, - { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, - } - }}, pr) - mcl_structures.init_node_construct(chests[c]) - local meta = minetest.get_meta(chests[c]) - local inv = meta:get_inventory() - mcl_loot.fill_inventory(inv, "main", lootitems, pr) - end -end mcl_structures.register_structure("cold_ocean_ruins",{ place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, @@ -100,5 +63,32 @@ mcl_structures.register_structure("cold_ocean_ruins",{ modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts", modpath.."/schematics/mcl_structures_ocean_ruins_cold_3.mts", }, - after_place = ruins_placement_callback + loot = { + ["mcl_chests:chest_small" ] = { + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_core:coal_lump", weight = 25, amount_min = 1, amount_max=4 }, + { itemstring = "mcl_farming:wheat_item", weight = 25, amount_min = 2, amount_max=3 }, + { itemstring = "mcl_core:gold_nugget", weight = 25, amount_min = 1, amount_max=3 }, + --{ itemstring = "mcl_maps:treasure_map", weight = 20, }, --FIXME Treasure map + + { itemstring = "mcl_books:book", weight = 10, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_fishing:fishing_rod_enchanted", weight = 20, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_core:emerald", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_armor:chestplate_leather", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:apple_gold", weight = 20, }, + { itemstring = "mcl_armor:helmet_gold", weight = 15, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + } + } + }, }) From befe493ff047b2c76f3b9d6a57999d65272c7d1a Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 04:02:36 +0200 Subject: [PATCH 13/29] Add warm ocean ruins --- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 54 ++++++++++++++++-- .../mcl_structures_ocean_ruins_warm_1.mts | Bin 0 -> 311 bytes .../mcl_structures_ocean_ruins_warm_2.mts | Bin 0 -> 331 bytes .../mcl_structures_ocean_ruins_warm_3.mts | Bin 0 -> 536 bytes .../mcl_structures_ocean_ruins_warm_4.mts | Bin 0 -> 390 bytes 5 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_1.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_2.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_3.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_4.mts diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index 1e477c3c2..1452de64b 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -1,6 +1,7 @@ local modname = minetest.get_current_modname() local S = minetest.get_translator(modname) local modpath = minetest.get_modpath(modname) + local cold_oceans = { "RoofedForest_ocean", "BirchForestM_ocean", @@ -36,7 +37,40 @@ local cold_oceans = { "Taiga_deep_ocean", } -mcl_structures.register_structure("cold_ocean_ruins",{ +local warm_oceans = { + "JungleEdgeM_ocean", + "Jungle_deep_ocean", + "Savanna_ocean", + "MesaPlateauF_ocean", + "Swampland_ocean", + "Mesa_ocean", + "Plains_ocean", + "MesaPlateauFM_ocean", + "MushroomIsland_ocean", + "SavannaM_ocean", + "JungleEdge_ocean", + "MesaBryce_ocean", + "Jungle_ocean", + "Desert_ocean", + "JungleM_ocean", + "JungleEdgeM_deep_ocean", + "Jungle_deep_ocean", + "Savanna_deep_ocean", + "MesaPlateauF_deep_ocean", + "Swampland_deep_ocean", + "Mesa_deep_ocean", + "Plains_deep_ocean", + "MesaPlateauFM_deep_ocean", + "MushroomIsland_deep_ocean", + "SavannaM_deep_ocean", + "JungleEdge_deep_ocean", + "MesaBryce_deep_ocean", + "Jungle_deep_ocean", + "Desert_deep_ocean", + "JungleM_deep_ocean", +} + +local cold = { place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, spawn_by = {"mcl_core:water_source"}, num_spawn_by = 2, @@ -52,9 +86,9 @@ mcl_structures.register_structure("cold_ocean_ruins",{ flags = "place_center_x, place_center_z, force_placement", solid_ground = true, make_foundation = true, - y_offset = 0, + y_offset = -1, y_min = mcl_vars.mg_overworld_min, - y_max = 1, + y_max = -2, biomes = cold_oceans, chunk_probability = 64, sidelen = 4, @@ -91,4 +125,16 @@ mcl_structures.register_structure("cold_ocean_ruins",{ } } }, -}) +} + +local warm = table.copy(cold) +warm.biomes = warm_oceans +warm.filenames = { + modpath.."/schematics/mcl_structures_ocean_ruins_warm_1.mts", + modpath.."/schematics/mcl_structures_ocean_ruins_warm_2.mts", + modpath.."/schematics/mcl_structures_ocean_ruins_warm_3.mts", + modpath.."/schematics/mcl_structures_ocean_ruins_warm_4.mts", +} + +mcl_structures.register_structure("cold_ocean_ruins",cold) +mcl_structures.register_structure("warm_ocean_ruins",warm) diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_1.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_1.mts new file mode 100644 index 0000000000000000000000000000000000000000..072931b1397bc77811ea13295866eabd012adc99 GIT binary patch literal 311 zcmeYb3HD`RVPIuoVc@8*udip|U|>$nEMnlzP0oo=&M!)}Do)HxVGu&$7MJAbr7}oh ziX|r&m8GUIh{I*lixTrPOH$*DbMx~{GO%fZ%7}rrWTY0C6kCC*_~P8eoE!!Lka%8d zNk(dsRc>N>Zeqopr4u6g8Web3+JnB{*t@HQcgGQa@2rH1xq*x((NQgSQLFo(T{y8N zOnde9ywz&TKU#~oO`l)fVw-0nu~$)fs)b%%$;ZQI^^13E$lVdU_x`?P*(J+kzv7Kb z&y{((d}_SWc_UJEht8%f;pdOnonQ{X%&|`BdXK@G>m34r)_?2$vqE^+Ma};JVl08C literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_2.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_2.mts new file mode 100644 index 0000000000000000000000000000000000000000..9834226fafaa66bc4406239dd6858cc2b8d5a381 GIT binary patch literal 331 zcmeYb3HD`RVPIomW#Fg>0R~P6=ETe*2HxD{ocQGYqExHm#Jm&+2^4N|Nq$~xa$-?g zY6^oWNG3lyH8IbsI5jaoCo!)iwI~mphT`1({E`d?0g#5g)RK(UBCFiQ^xQ-SAxy&= z#NlG;MTvQtC8_aH?P6ewjMUPxo0y)P$RGh%3es6zlAo6fRf|O?IkBiLHHAS4QxAg}SS%y8 zxTM$$OvM-HCg$WYh=RoPlT#D(tcp_;<8u=8N>YpRD(1Wmj}&WG;99#h8IceA{s$`6U1{;To&b>PD2_l+;5gBQM)4VF2-ns+AujKJ)) z&#AS+m(<+*_xHZmUbrqT#xiEpyUq8wR^{|Om?YA6wY2uq?{k`Unwvw!&%QIPeYZr4 z?+nA&ogzmMX59SCzJdLB-9#hn(gphN!f9g9$`zhZXX^j(=jyYU9dqJezGgb_eW1YM z{>{q=6n`@(Pe0vqCHL2~?yqMz?g+X3`Sp=Ea{ul6yN>?av6eCWvEd&1OMGu$UJuXv zx@SX1ik<2QHt9_fHk+uvuq+&asv$ zK6d^wcX2tE2fsbbO6zTBJo~3r8$17a`;+b;g}Y`vnp~6eIjG+D?)jgSehHN(yO|s+ avr4#iQ?8`%Rj&o_ zxY`r)RnlmwwQljpwJnJUFTUfO`-N-$wCZ;c-)8d~9CA5*`~XL`__k9fPIdl|dX@)Y z-#_(snh@YSKlQGE?BYF_Lf=;V{fRS{^S3(%0JD#tbN~PV literal 0 HcmV?d00001 From 063e17bc0a8aee242f594bae36666dd86efb0340 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 04:10:21 +0200 Subject: [PATCH 14/29] make schematic selection deterministic --- mods/MAPGEN/mcl_structures/api.lua | 5 +++-- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index ebdfdfbea..14dda38f8 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -52,8 +52,9 @@ function mcl_structures.place_structure(pos, def, pr) return false end if def.filenames then - table.shuffle(def.filenames) - local file = def.filenames[1] + if #def.filenames <= 0 then return false end + local r = pr:next(1,#def.filenames) + local file = def.filenames[r] if file then local ap = function(pos,def,pr) end if def.after_place then ap = def.after_place end diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index 1452de64b..256d4bb8d 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -91,7 +91,7 @@ local cold = { y_max = -2, biomes = cold_oceans, chunk_probability = 64, - sidelen = 4, + sidelen = 8, filenames = { modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts", From dfbb832f963602caac8943941242aeaca9363991 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 14:02:29 +0200 Subject: [PATCH 15/29] Terrain feature fixes --- mods/MAPGEN/mcl_mapgen_core/init.lua | 2 +- mods/MAPGEN/mcl_structures/api.lua | 16 ++++++++++++++++ mods/MAPGEN/mcl_terrain_features/init.lua | 16 ++++++++-------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 117d8ee09..9b5502bbf 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -2193,7 +2193,7 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do local realpos = vector.offset(pos,0,1,0) minetest.remove_node(realpos) - if struct.chunk_probability ~= nil and not has and pr:next(1,struct.chunk_probability) ~= 1 then + if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then mcl_structures.place_structure(realpos,struct,pr) has=true end diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 14dda38f8..5c27fbb8e 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -16,6 +16,22 @@ local function generate_loot(pos, def, pr) end end +function mcl_structures.find_lowest_y(pp) + local y = 31000 + for _,p in pairs(pp) do + if p.y < y then y = p.y end + end + return y +end + +function mcl_structures.find_highest_y(pp) + local y = -31000 + for _,p in pairs(pp) do + if p.y > y then y = p.y end + end + return y +end + function mcl_structures.place_structure(pos, def, pr) if not def then return end local logging = not def.terrain_feature diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 623e518b3..bf3a846a2 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -30,7 +30,7 @@ local function airtower(pos,tbl,h) end local function makelake(pos,size,liquid,placein,border,pr) - local node_under = minetest.get_node(vector.offset(pos,0,1,0)) + local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) local p1 = vector.offset(pos,-size,-size,-size) local p2 = vector.offset(pos,size,size,size) local nn = minetest.find_nodes_in_area(p1,p2,placein) @@ -38,7 +38,7 @@ local function makelake(pos,size,liquid,placein,border,pr) return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) end) if not nn[1] then return end - local y = pos.y - 1 + local y = mcl_structures.find_highest_y(nn) local lq = {} local air = {} for i=1,pr:next(1,#nn) do @@ -59,11 +59,11 @@ local function makelake(pos,size,liquid,placein,border,pr) 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(nn[1]).name + border = minetest.get_node_or_nil(nn[1]).name else border = "mcl_core:stone" end - if border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end + if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end end if an.name ~= liquid then table.insert(br,pp) @@ -94,7 +94,7 @@ mcl_structures.register_structure("lavapool",{ 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:lava_source","mcl_core:stone",{"group:material_stone", "group:sand", "group:dirt"},pr) + return makelake(pos,5,"mcl_core:lava_source",{"group:material_stone", "group:sand", "group:dirt"},"mcl_core:stone",pr) end }) @@ -114,7 +114,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"},nil,pr) + return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},nil,pr) end }) @@ -219,7 +219,7 @@ mcl_structures.register_structure("lavadelta",{ terrain_feature = true, noise_params = { offset = 0, - scale = 0.01, + scale = 0.005, spread = {x = 250, y = 250, z = 250}, seed = 78375213, octaves = 5, @@ -231,7 +231,7 @@ mcl_structures.register_structure("lavadelta",{ y_min = mcl_vars.mg_lava_nether_max + 1, biomes = { "BasaltDelta" }, place_func = function(pos,def,pr) - local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-10,-1,-10),vector.offset(pos,10,-1,10),{"mcl_blackstone:basalt","mcl_blackstone:blackstone"}) + 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) From 14cd3602149cba27cbd1e8bed8e5a2f569428abc Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 17:54:34 +0200 Subject: [PATCH 16/29] witch hut, boulders, ice-spikes -> new api --- mods/MAPGEN/mcl_biomes/init.lua | 2 + mods/MAPGEN/mcl_mapgen_core/init.lua | 51 +++++------ mods/MAPGEN/mcl_structures/init.lua | 122 ++++++++++++++------------- 3 files changed, 86 insertions(+), 89 deletions(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index f538d97aa..e4b6bb85b 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -3397,6 +3397,7 @@ local function register_decorations() y_max = mcl_vars.mg_overworld_max, schematic = mod_mcl_structures.."/schematics/mcl_structures_boulder.mts", flags = "place_center_x, place_center_z", + rotation = "random", }) -- Small mossy cobblestone boulder (2×2) @@ -3417,6 +3418,7 @@ local function register_decorations() y_max = mcl_vars.mg_overworld_max, schematic = mod_mcl_structures.."/schematics/mcl_structures_boulder_small.mts", flags = "place_center_x, place_center_z", + rotation = "random", }) -- Cacti diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 9b5502bbf..b064c6d73 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1331,7 +1331,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) end end - -- Witch hut + -- Witch hut (v6) if ground_y <= 0 and nn == "mcl_core:dirt" then local prob = minecraft_chunk_probability(48, minp, maxp) if pr:next(1, prob) == 1 then @@ -1339,23 +1339,14 @@ local function generate_structures(minp, maxp, blockseed, biomemap) local swampland = minetest.get_biome_id("Swampland") local swampland_shore = minetest.get_biome_id("Swampland_shore") - -- Where do witches live? - - local here_be_witches = false - if mg_name == "v6" then - -- v6: In Normal biome - if biomeinfo.get_v6_biome(p) == "Normal" then - here_be_witches = true - end - else - -- Other mapgens: In swampland biome - local bi = xz_to_biomemap_index(p.x, p.z, minp, maxp) - if biomemap[bi] == swampland or biomemap[bi] == swampland_shore then - here_be_witches = true - end + -- Where do witches live? + -- v6: In Normal biome + if biomeinfo.get_v6_biome(p) == "Normal" then + here_be_witches = true end + local here_be_witches = false + if mg_name == "v6" and here_be_witches then - if here_be_witches then local r = tostring(pr:next(0, 3) * 90) -- "0", "90", "180" or 270" local p1 = {x=p.x-1, y=WITCH_HUT_HEIGHT+2, z=p.z-1} local size @@ -1375,9 +1366,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- FIXME: For some mysterious reason (black magic?) this -- function does sometimes NOT spawn the witch hut. One can only see the -- oak wood nodes in the water, but no hut. :-/ - mcl_structures.call_struct(place, "witch_hut", r, pr) - - -- TODO: Spawn witch in or around hut when the mob sucks less. + mcl_structures.place_structure(place,mcl_structures.registered_structures["witch_hut"],pr) local function place_tree_if_free(pos, prev_result) local nn = minetest.get_node(pos).name @@ -1436,7 +1425,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- Ice spikes in v6 -- In other mapgens, ice spikes are generated as decorations. - if mg_name == "v6" and not chunk_has_igloo and nn == "mcl_core:snowblock" then + if mg_name == "v6" and nn == "mcl_core:snowblock" then local spike = pr:next(1,58000) if spike < 3 then -- Check surface @@ -1446,7 +1435,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) local spruce_collisions = minetest.find_nodes_in_area({x=p.x+1,y=p.y+2,z=p.z+1}, {x=p.x+4, y=p.y+6, z=p.z+4}, {"mcl_core:sprucetree", "mcl_core:spruceleaves"}) if #surface >= 9 and #spruce_collisions == 0 then - mcl_structures.call_struct(p, "ice_spike_large", nil, pr) + mcl_structures.place_structure(p,mcl_structures.registered_structures["ice_spike_large"],pr) end elseif spike < 100 then -- Check surface @@ -1457,7 +1446,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) local spruce_collisions = minetest.find_nodes_in_area({x=p.x+1,y=p.y+1,z=p.z+1}, {x=p.x+6, y=p.y+6, z=p.z+6}, {"mcl_core:sprucetree", "mcl_core:spruceleaves"}) if #surface >= 25 and #spruce_collisions == 0 then - mcl_structures.call_struct(p, "ice_spike_small", nil, pr) + mcl_structures.place_structure(p,mcl_structures.registered_structures["ice_spike_small"],pr) end end end @@ -2188,14 +2177,16 @@ mcl_mapgen_core.register_generator("structures",nil, function(minp, maxp, blocks local has_struct = {} local poshash = minetest.hash_node_position(minp) for _,struct in pairs(mcl_structures.registered_structures) do - local has = false - if has_struct[struct.name] == nil then has_struct[struct.name] = {} end - for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do - local realpos = vector.offset(pos,0,1,0) - minetest.remove_node(realpos) - if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then - mcl_structures.place_structure(realpos,struct,pr) - has=true + if struct.deco_id then + local has = false + if has_struct[struct.name] == nil then has_struct[struct.name] = {} end + for _, pos in pairs(gennotify["decoration#"..struct.deco_id] or {}) do + local realpos = vector.offset(pos,0,1,0) + minetest.remove_node(realpos) + if struct.chunk_probability == nil or (not has and pr:next(1,struct.chunk_probability) == 1 ) then + mcl_structures.place_structure(realpos,struct,pr) + has=true + end end end end diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 176c09acd..12b9fc248 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -77,14 +77,6 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr) end if struct_style == "igloo" then return mcl_structures.generate_igloo(pos, rotation, pr) - elseif struct_style == "witch_hut" then - return mcl_structures.generate_witch_hut(pos, rotation) - elseif struct_style == "ice_spike_small" then - return mcl_structures.generate_ice_spike_small(pos, rotation) - elseif struct_style == "ice_spike_large" then - return mcl_structures.generate_ice_spike_large(pos, rotation) - elseif struct_style == "boulder" then - return mcl_structures.generate_boulder(pos, rotation, pr) elseif struct_style == "fossil" then return mcl_structures.generate_fossil(pos, rotation, pr) elseif struct_style == "end_exit_portal" then @@ -256,21 +248,6 @@ function mcl_structures.generate_igloo_basement(pos, orientation, pr) mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, igloo_placement_callback, pr) end -function mcl_structures.generate_boulder(pos, rotation, pr) - -- Choose between 2 boulder sizes (2×2×2 or 3×3×3) - local r = pr:next(1, 10) - local path - if r <= 3 then - path = modpath.."/schematics/mcl_structures_boulder_small.mts" - else - path = modpath.."/schematics/mcl_structures_boulder.mts" - end - - local newpos = {x=pos.x,y=pos.y-1,z=pos.z} - - return minetest.place_schematic(newpos, path, rotation) -- don't serialize schematics for registered biome decorations, for MT 5.4.0, https://github.com/minetest/minetest/issues/10995 -end - local function spawn_witch(p1,p2) local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"}) if c then @@ -287,33 +264,6 @@ local function spawn_witch(p1,p2) end end -local function hut_placement_callback(p1, p2, size, orientation, pr) - if not p1 or not p2 then return end - local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") - for i = 1, #legs do - while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do - legs[i].y = legs[i].y - 1 - minetest.swap_node(legs[i], {name = "mcl_core:tree", param2 = 2}) - end - end - spawn_witch(p1,p2) -end - -function mcl_structures.generate_witch_hut(pos, rotation, pr) - local path = modpath.."/schematics/mcl_structures_witch_hut.mts" - mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, hut_placement_callback, pr) -end - -function mcl_structures.generate_ice_spike_small(pos, rotation) - local path = modpath.."/schematics/mcl_structures_ice_spike_small.mts" - return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0 -end - -function mcl_structures.generate_ice_spike_large(pos, rotation) - local path = modpath.."/schematics/mcl_structures_ice_spike_large.mts" - return minetest.place_schematic(pos, path, rotation or "random", nil, false) -- don't serialize schematics for registered biome decorations, for MT 5.4.0 -end - function mcl_structures.generate_fossil(pos, rotation, pr) -- Generates one out of 8 possible fossil pieces local newpos = {x=pos.x,y=pos.y-1,z=pos.z} @@ -480,6 +430,45 @@ dofile(modpath.."/desert_temple.lua") dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") +local function hut_placement_callback(pos,def,pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + if not p1 or not p2 then return end + local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") + local tree = {} + for i = 1, #legs do + while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do + legs[i].y = legs[i].y - 1 + table.insert(tree,legs[i]) + end + end + minetest.bulk_set_node(tree, {name = "mcl_core:tree", param2 = 2}) + spawn_witch(p1,p2) +end + +mcl_structures.register_structure("witch_hut",{ + place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, + noise_params = { + offset = 0, + scale = 0.0012, + spread = {x = 250, y = 250, z = 250}, + seed = 233, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + flags = "place_center_x, place_center_z, liquid_surface, force_placement", + sidelen = 5, + chunk_probability = 64, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + --y_offset = function(pr) return pr:next(-4,1) end, + y_offset = 0, + biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" }, + filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" }, + after_place = hut_placement_callback, +}) mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, noise_params = { @@ -503,9 +492,32 @@ mcl_structures.register_structure("desert_well",{ filenames = { modpath.."/schematics/mcl_structures_desert_well.mts" }, }) +mcl_structures.register_structure("boulder",{ + flags = "place_center_x, place_center_z", + sidelen = 4, + filenames = { + 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", + }, +},true) --is spawned as a normal decoration. this is just for /spawnstruct +mcl_structures.register_structure("ice_spike_small",{ + sidelen = 3, + filenames = { + modpath.."/schematics/mcl_structures_ice_spike_small.mts" + }, +},true) --is spawned as a normal decoration. this is just for /spawnstruct +mcl_structures.register_structure("ice_spike_large",{ + sidelen = 6, + filenames = { + modpath.."/schematics/mcl_structures_ice_spike_large.mts" + }, +},true) --is spawned as a normal decoration. this is just for /spawnstruct + -- Debug command minetest.register_chatcommand("spawnstruct", { - params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon", + params = "igloo | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon", description = S("Generate a pre-defined structure near your position."), privs = {debug = true}, func = function(name, param) @@ -521,16 +533,8 @@ minetest.register_chatcommand("spawnstruct", { local message = S("Structure placed.") if param == "igloo" then mcl_structures.generate_igloo(pos, rot, pr) - elseif param == "witch_hut" then - mcl_structures.generate_witch_hut(pos, rot, pr) - elseif param == "boulder" then - mcl_structures.generate_boulder(pos, rot, pr) elseif param == "fossil" then mcl_structures.generate_fossil(pos, rot, pr) - elseif param == "ice_spike_small" then - mcl_structures.generate_ice_spike_small(pos, rot, pr) - elseif param == "ice_spike_large" then - mcl_structures.generate_ice_spike_large(pos, rot, pr) elseif param == "end_exit_portal" then mcl_structures.generate_end_exit_portal(pos, rot, pr) elseif param == "end_exit_portal_open" then From 607511518f6e529a8d421d2ad1e94fca9ced9299 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 18:15:26 +0200 Subject: [PATCH 17/29] fix warning --- mods/MAPGEN/mcl_biomes/init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index e4b6bb85b..2914d148f 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -2594,7 +2594,16 @@ local function register_decorations() deco_type = "simple", place_on = {"group:sand","mcl_core:gravel"}, sidelen = 16, - noise_params = noise, + noise_params = { + offset = -0.0085, + scale = 0.002, + spread = {x = 25, y = 120, z = 25}, + seed = 235, + octaves = 5, + persist = 1.8, + lacunarity = 3.5, + flags = "absvalue" + }, y_min = OCEAN_MIN, y_max = -5, decoration = "mcl_ocean:dead_brain_coral_block", From 7f8a366a7b0124e32bc2d4ca4624895821e8ff0c Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 18:24:41 +0200 Subject: [PATCH 18/29] make geodes slightly larger, fix positioning --- mods/MAPGEN/mcl_geodes/init.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mods/MAPGEN/mcl_geodes/init.lua b/mods/MAPGEN/mcl_geodes/init.lua index c03173367..d0f0e0cab 100644 --- a/mods/MAPGEN/mcl_geodes/init.lua +++ b/mods/MAPGEN/mcl_geodes/init.lua @@ -13,8 +13,8 @@ local function set_node_no_bedrock(pos,node) return minetest.set_node(pos,node) end -local function makegeode(pos,pr) - local size = pr:next(4,7) +local function makegeode(pos,def,pr) + local size = pr:next(5,7) local p1 = vector.offset(pos,-size,-size,-size) local p2 = vector.offset(pos,size,size,size) local calcite = {} @@ -79,8 +79,5 @@ mcl_structures.register_structure("geode",{ y_max = -24, y_min = mcl_vars.mg_overworld_min, y_offset = function(pr) return pr:next(-4,-2) end, - place_func = function(pos,def,pr) - local p = vector.new(pos.x + pr:next(-30,30),pos.y,pos.z + pr:next(-30,30)) - return makegeode(p,pr) - end + place_func = makegeode, }) From 3ca6d4de3b75ce8fc5482e708866cc31736c0067 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 21:10:52 +0200 Subject: [PATCH 19/29] fix chunk probability and distributions --- mods/MAPGEN/mcl_geodes/init.lua | 1 + mods/MAPGEN/mcl_mapgen_core/init.lua | 4 +-- mods/MAPGEN/mcl_structures/api.lua | 9 ++++-- mods/MAPGEN/mcl_structures/desert_temple.lua | 12 ++------ mods/MAPGEN/mcl_structures/init.lua | 31 ++++---------------- mods/MAPGEN/mcl_structures/jungle_temple.lua | 14 ++------- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 14 ++------- 7 files changed, 24 insertions(+), 61 deletions(-) diff --git a/mods/MAPGEN/mcl_geodes/init.lua b/mods/MAPGEN/mcl_geodes/init.lua index d0f0e0cab..a1ea0b631 100644 --- a/mods/MAPGEN/mcl_geodes/init.lua +++ b/mods/MAPGEN/mcl_geodes/init.lua @@ -76,6 +76,7 @@ mcl_structures.register_structure("geode",{ flags = "absvalue", }, flags = "place_center_x, place_center_z, force_placement", + terrain_feature = true, y_max = -24, y_min = mcl_vars.mg_overworld_min, y_offset = function(pr) return pr:next(-4,-2) end, diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index b064c6d73..25065be2a 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1334,7 +1334,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- Witch hut (v6) if ground_y <= 0 and nn == "mcl_core:dirt" then local prob = minecraft_chunk_probability(48, minp, maxp) - if pr:next(1, prob) == 1 then + if mg_name == "v6" and pr:next(1, prob) == 1 then local swampland = minetest.get_biome_id("Swampland") local swampland_shore = minetest.get_biome_id("Swampland_shore") @@ -1345,7 +1345,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) here_be_witches = true end local here_be_witches = false - if mg_name == "v6" and here_be_witches then + if here_be_witches then local r = tostring(pr:next(0, 3) * 90) -- "0", "90", "180" or 270" local p1 = {x=p.x-1, y=WITCH_HUT_HEIGHT+2, z=p.z-1} diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 5c27fbb8e..d9ab21702 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -46,13 +46,18 @@ function mcl_structures.place_structure(pos, def, pr) local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) local node_top = minetest.registered_biomes[bn].node_top local node_fill = minetest.registered_biomes[bn].node_filler + local node_stone = minetest.registered_biomes[bn].node_stone local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) + if not node_stone then node_stone = "mcl_core:stone" end + if not node_fill then node_fill = "mcl_core:dirt" end + if not node_top then node_top = "mcl_core:dirt_with_grass" end 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 minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_fill}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{name=node_fill}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid"}),{name=node_stone}) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") @@ -124,7 +129,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) + minetest.register_node(":"..structblock, {drawtype="normal", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 27e5ddfb9..ddacd83d2 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -34,21 +34,13 @@ end mcl_structures.register_structure("desert_temple",{ place_on = {"group:sand"}, - noise_params = { - offset = 0, - scale = 0.0000822, - spread = {x = 250, y = 250, z = 250}, - seed = 34115, - octaves = 3, - persist = -0.4, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, sidelen = 18, y_offset = -12, - chunk_probability = 256, + chunk_probability = 500, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Desert" }, diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 12b9fc248..a8a2d9b1b 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -449,21 +449,12 @@ end mcl_structures.register_structure("witch_hut",{ place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, - noise_params = { - offset = 0, - scale = 0.0012, - spread = {x = 250, y = 250, z = 250}, - seed = 233, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 5, - chunk_probability = 64, + chunk_probability = 128, y_max = mcl_vars.mg_overworld_max, - y_min = 1, - --y_offset = function(pr) return pr:next(-4,1) end, + y_min = -4, y_offset = 0, biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" }, filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" }, @@ -471,20 +462,12 @@ mcl_structures.register_structure("witch_hut",{ }) mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, - noise_params = { - offset = 0, - scale = 0.00012, - spread = {x = 250, y = 250, z = 250}, - seed = 233, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", not_near = { "desert_temple_new" }, solid_ground = true, sidelen = 4, - chunk_probability = 64, + chunk_probability = 256, y_max = mcl_vars.mg_overworld_max, y_min = 1, y_offset = -2, @@ -493,17 +476,15 @@ mcl_structures.register_structure("desert_well",{ }) mcl_structures.register_structure("boulder",{ - flags = "place_center_x, place_center_z", - sidelen = 4, filenames = { 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", + -- small boulder 3x as likely }, },true) --is spawned as a normal decoration. this is just for /spawnstruct mcl_structures.register_structure("ice_spike_small",{ - sidelen = 3, filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" }, diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1a7a620fe..aa5bf9412 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,20 +4,12 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - noise_params = { - offset = 0, - scale = 0.0000812, - spread = {x = 250, y = 250, z = 250}, - seed = 31585, - octaves = 3, - persist = -0.2, - flags = "absvalue", - }, + fill_ratio = 0.1, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, - y_offset = -5, - chunk_probability = 256, + y_offset = function(pr) return pr:next(-3,0) -5 end, + chunk_probability = 1500, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Jungle" }, diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index 256d4bb8d..dafc2dfff 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -74,15 +74,7 @@ local cold = { place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, spawn_by = {"mcl_core:water_source"}, num_spawn_by = 2, - noise_params = { - offset = 0, - scale = 0.0000812, - spread = {x = 250, y = 250, z = 250}, - seed = 146315, - octaves = 3, - persist = -0.2, - flags = "absvalue", - }, + fill_ratio = 0.001, flags = "place_center_x, place_center_z, force_placement", solid_ground = true, make_foundation = true, @@ -90,8 +82,8 @@ local cold = { y_min = mcl_vars.mg_overworld_min, y_max = -2, biomes = cold_oceans, - chunk_probability = 64, - sidelen = 8, + chunk_probability = 128, + sidelen = 20, filenames = { modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts", From a09226c370446d103fd6b152b82ce15c1d8e89e8 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 21:47:44 +0200 Subject: [PATCH 20/29] fossil & igloo -> new api --- mods/MAPGEN/mcl_mapgen_core/init.lua | 15 +- mods/MAPGEN/mcl_structures/api.lua | 21 +- mods/MAPGEN/mcl_structures/igloo.lua | 152 +++++++++++++ mods/MAPGEN/mcl_structures/init.lua | 258 +++-------------------- mods/MAPGEN/mcl_structures/witch_hut.lua | 49 +++++ 5 files changed, 246 insertions(+), 249 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/igloo.lua create mode 100644 mods/MAPGEN/mcl_structures/witch_hut.lua diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 25065be2a..f9745b471 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1264,8 +1264,8 @@ end local function generate_structures(minp, maxp, blockseed, biomemap) local chunk_has_igloo = false local struct_min, struct_max = -3, 111 --64 - - if maxp.y >= struct_min and minp.y <= struct_max then + --except end exit portall all v6 + if mg_name == "v6" and maxp.y >= struct_min and minp.y <= struct_max then -- Generate structures local pr = PcgRandom(blockseed) perlin_structures = perlin_structures or minetest.get_perlin(329, 3, 0.6, 100) @@ -1334,7 +1334,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- Witch hut (v6) if ground_y <= 0 and nn == "mcl_core:dirt" then local prob = minecraft_chunk_probability(48, minp, maxp) - if mg_name == "v6" and pr:next(1, prob) == 1 then + if pr:next(1, prob) == 1 then local swampland = minetest.get_biome_id("Swampland") local swampland_shore = minetest.get_biome_id("Swampland_shore") @@ -1425,7 +1425,7 @@ local function generate_structures(minp, maxp, blockseed, biomemap) -- Ice spikes in v6 -- In other mapgens, ice spikes are generated as decorations. - if mg_name == "v6" and nn == "mcl_core:snowblock" then + if nn == "mcl_core:snowblock" then local spike = pr:next(1,58000) if spike < 3 then -- Check surface @@ -1710,14 +1710,9 @@ local function generate_underground_mushrooms(minp, maxp, seed) end end -local nether_wart_chance -if mg_name == "v6" then - nether_wart_chance = 85 -else - nether_wart_chance = 170 -end -- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart -- (only v6) +local nether_wart_chance = 85 local function generate_nether_decorations(minp, maxp, seed) local pr_nether = PseudoRandom(seed+667) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index d9ab21702..65532b245 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -43,20 +43,25 @@ function mcl_structures.place_structure(pos, def, pr) end local pp = vector.offset(pos,0,y_offset,0) if def.solid_ground and def.sidelen then - local bn = minetest.get_biome_name(minetest.get_biome_data(pos).biome) - local node_top = minetest.registered_biomes[bn].node_top - local node_fill = minetest.registered_biomes[bn].node_filler - local node_stone = minetest.registered_biomes[bn].node_stone + local node_stone = "mcl_core:stone" + local node_filler = "mcl_core:dirt" + local node_top = "mcl_core:dirt_with_grass" + + if minetest.get_mapgen_setting("mg_name") ~= "v6" then + local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] + 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 + end + local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) - if not node_stone then node_stone = "mcl_core:stone" end - if not node_fill then node_fill = "mcl_core:dirt" end - if not node_top then node_top = "mcl_core:dirt_with_grass" end + 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 minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{name=node_fill}) + minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{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),{"air","group:liquid"}),{name=node_stone}) else if logging then diff --git a/mods/MAPGEN/mcl_structures/igloo.lua b/mods/MAPGEN/mcl_structures/igloo.lua new file mode 100644 index 000000000..15363be51 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/igloo.lua @@ -0,0 +1,152 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +function mcl_structures.generate_igloo_top(pos, pr) + -- FIXME: This spawns bookshelf instead of furnace. Fix this! + -- Furnace does ot work atm because apparently meta is not set. :-( + local newpos = {x=pos.x,y=pos.y-1,z=pos.z} + local path = modpath.."/schematics/mcl_structures_igloo_top.mts" + local rotation = tostring(pr:next(0,3)*90) + return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation +end + +function mcl_structures.generate_igloo_basement(pos, orientation, pr) + -- TODO: Add brewing stand + -- TODO: Add monster eggs + -- TODO: Spawn villager and zombie villager + local path = modpath.."/schematics/mcl_structures_igloo_basement.mts" + mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, igloo_placement_callback, pr) +end + +function mcl_structures.generate_igloo(pos, def, pr) + -- Place igloo + local success, rotation = mcl_structures.generate_igloo_top(pos, pr) + -- Place igloo basement with 50% chance + local r = pr:next(1,2) + if r == 1 then + -- Select basement depth + local dim = mcl_worlds.pos_to_dimension(pos) + --local buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10) + local buffer + if dim == "nether" then + buffer = pos.y - (mcl_vars.mg_lava_nether_max + 10) + elseif dim == "end" then + buffer = pos.y - (mcl_vars.mg_end_min + 1) + elseif dim == "overworld" then + buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10) + else + return success + end + if buffer <= 19 then + return success + end + local depth = pr:next(19, buffer) + local bpos = {x=pos.x, y=pos.y-depth, z=pos.z} + -- trapdoor position + local tpos + local dir, tdir + if rotation == "0" then + dir = {x=-1, y=0, z=0} + tdir = {x=1, y=0, z=0} + tpos = {x=pos.x+7, y=pos.y-1, z=pos.z+3} + elseif rotation == "90" then + dir = {x=0, y=0, z=-1} + tdir = {x=0, y=0, z=-1} + tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+1} + elseif rotation == "180" then + dir = {x=1, y=0, z=0} + tdir = {x=-1, y=0, z=0} + tpos = {x=pos.x+1, y=pos.y-1, z=pos.z+3} + elseif rotation == "270" then + dir = {x=0, y=0, z=1} + tdir = {x=0, y=0, z=1} + tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+7} + else + return success + end + local function set_brick(pos) + local c = pr:next(1, 3) -- cracked chance + local m = pr:next(1, 10) -- chance for monster egg + local brick + if m == 1 then + if c == 1 then + brick = "mcl_monster_eggs:monster_egg_stonebrickcracked" + else + brick = "mcl_monster_eggs:monster_egg_stonebrick" + end + else + if c == 1 then + brick = "mcl_core:stonebrickcracked" + else + brick = "mcl_core:stonebrick" + end + end + minetest.set_node(pos, {name=brick}) + end + local ladder_param2 = minetest.dir_to_wallmounted(tdir) + local real_depth = 0 + -- Check how deep we can actuall dig + for y=1, depth-5 do + real_depth = real_depth + 1 + local node = minetest.get_node({x=tpos.x,y=tpos.y-y,z=tpos.z}) + local def = minetest.registered_nodes[node.name] + if not (def and def.walkable and def.liquidtype == "none" and def.is_ground_content) then + bpos.y = tpos.y-y+1 + break + end + end + if real_depth <= 6 then + return success + end + -- Generate ladder to basement + for y=1, real_depth-1 do + set_brick({x=tpos.x-1,y=tpos.y-y,z=tpos.z }) + set_brick({x=tpos.x+1,y=tpos.y-y,z=tpos.z }) + set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z-1}) + set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z+1}) + minetest.set_node({x=tpos.x,y=tpos.y-y,z=tpos.z}, {name="mcl_core:ladder", param2=ladder_param2}) + end + -- Place basement + mcl_structures.generate_igloo_basement(bpos, rotation, pr) + -- Place hidden trapdoor + minetest.after(5, function(tpos, dir) + minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2 + end, tpos, dir) + end + return success +end + +mcl_structures.register_structure("igloo",{ + place_on = {"mcl_core:snowblock","mcl_core:snow","group:grass_block_snow"}, + fill_ratio = 0.01, + sidelen = 16, + chunk_probability = 4400, + y_max = mcl_vars.mg_overworld_max, + y_min = 0, + y_offset = 0, + biomes = { "ColdTaiga", "IcePlainsSpikes", "IcePlains" }, + place_func = mcl_structures.generate_igloo, + loot = { + ["mcl_chests:chest"] = {{ + stacks_min = 1, + stacks_max = 1, + items = { + { itemstring = "mcl_core:apple_gold", weight = 1 }, + } + }, + { + stacks_min = 2, + stacks_max = 8, + items = { + { itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_core:apple", weight = 15, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_farming:wheat_item", weight = 10, amount_min = 2, amount_max = 3 }, + { itemstring = "mcl_core:gold_nugget", weight = 10, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, + { itemstring = "mcl_tools:axe_stone", weight = 2 }, + { itemstring = "mcl_core:emerald", weight = 1 }, + } + }}, + } +}) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index a8a2d9b1b..809448d2e 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -75,11 +75,7 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr) if not rotation then rotation = "random" end - if struct_style == "igloo" then - return mcl_structures.generate_igloo(pos, rotation, pr) - elseif struct_style == "fossil" then - return mcl_structures.generate_fossil(pos, rotation, pr) - elseif struct_style == "end_exit_portal" then + if struct_style == "end_exit_portal" then return mcl_structures.generate_end_exit_portal(pos, rotation) elseif struct_style == "end_exit_portal_open" then return mcl_structures.generate_end_exit_portal_open(pos, rotation) @@ -90,197 +86,6 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr) end end -function mcl_structures.generate_igloo(pos, rotation, pr) - -- Place igloo - local success, rotation = mcl_structures.generate_igloo_top(pos, pr) - -- Place igloo basement with 50% chance - local r = pr:next(1,2) - if r == 1 then - -- Select basement depth - local dim = mcl_worlds.pos_to_dimension(pos) - --local buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10) - local buffer - if dim == "nether" then - buffer = pos.y - (mcl_vars.mg_lava_nether_max + 10) - elseif dim == "end" then - buffer = pos.y - (mcl_vars.mg_end_min + 1) - elseif dim == "overworld" then - buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10) - else - return success - end - if buffer <= 19 then - return success - end - local depth = pr:next(19, buffer) - local bpos = {x=pos.x, y=pos.y-depth, z=pos.z} - -- trapdoor position - local tpos - local dir, tdir - if rotation == "0" then - dir = {x=-1, y=0, z=0} - tdir = {x=1, y=0, z=0} - tpos = {x=pos.x+7, y=pos.y-1, z=pos.z+3} - elseif rotation == "90" then - dir = {x=0, y=0, z=-1} - tdir = {x=0, y=0, z=-1} - tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+1} - elseif rotation == "180" then - dir = {x=1, y=0, z=0} - tdir = {x=-1, y=0, z=0} - tpos = {x=pos.x+1, y=pos.y-1, z=pos.z+3} - elseif rotation == "270" then - dir = {x=0, y=0, z=1} - tdir = {x=0, y=0, z=1} - tpos = {x=pos.x+3, y=pos.y-1, z=pos.z+7} - else - return success - end - local function set_brick(pos) - local c = pr:next(1, 3) -- cracked chance - local m = pr:next(1, 10) -- chance for monster egg - local brick - if m == 1 then - if c == 1 then - brick = "mcl_monster_eggs:monster_egg_stonebrickcracked" - else - brick = "mcl_monster_eggs:monster_egg_stonebrick" - end - else - if c == 1 then - brick = "mcl_core:stonebrickcracked" - else - brick = "mcl_core:stonebrick" - end - end - minetest.set_node(pos, {name=brick}) - end - local ladder_param2 = minetest.dir_to_wallmounted(tdir) - local real_depth = 0 - -- Check how deep we can actuall dig - for y=1, depth-5 do - real_depth = real_depth + 1 - local node = minetest.get_node({x=tpos.x,y=tpos.y-y,z=tpos.z}) - local def = minetest.registered_nodes[node.name] - if not (def and def.walkable and def.liquidtype == "none" and def.is_ground_content) then - bpos.y = tpos.y-y+1 - break - end - end - if real_depth <= 6 then - return success - end - -- Generate ladder to basement - for y=1, real_depth-1 do - set_brick({x=tpos.x-1,y=tpos.y-y,z=tpos.z }) - set_brick({x=tpos.x+1,y=tpos.y-y,z=tpos.z }) - set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z-1}) - set_brick({x=tpos.x ,y=tpos.y-y,z=tpos.z+1}) - minetest.set_node({x=tpos.x,y=tpos.y-y,z=tpos.z}, {name="mcl_core:ladder", param2=ladder_param2}) - end - -- Place basement - mcl_structures.generate_igloo_basement(bpos, rotation, pr) - -- Place hidden trapdoor - minetest.after(5, function(tpos, dir) - minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2 - end, tpos, dir) - end - return success -end - -function mcl_structures.generate_igloo_top(pos, pr) - -- FIXME: This spawns bookshelf instead of furnace. Fix this! - -- Furnace does ot work atm because apparently meta is not set. :-( - local newpos = {x=pos.x,y=pos.y-1,z=pos.z} - local path = modpath.."/schematics/mcl_structures_igloo_top.mts" - local rotation = tostring(pr:next(0,3)*90) - return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation -end - -local function igloo_placement_callback(p1, p2, size, orientation, pr) - local chest_offset - if orientation == "0" then - chest_offset = {x=5, y=1, z=5} - elseif orientation == "90" then - chest_offset = {x=5, y=1, z=3} - elseif orientation == "180" then - chest_offset = {x=3, y=1, z=1} - elseif orientation == "270" then - chest_offset = {x=1, y=1, z=5} - else - return - end - --local size = {x=9,y=5,z=7} - local lootitems = mcl_loot.get_multi_loot({ - { - stacks_min = 1, - stacks_max = 1, - items = { - { itemstring = "mcl_core:apple_gold", weight = 1 }, - } - }, - { - stacks_min = 2, - stacks_max = 8, - items = { - { itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 }, - { itemstring = "mcl_core:apple", weight = 15, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_farming:wheat_item", weight = 10, amount_min = 2, amount_max = 3 }, - { itemstring = "mcl_core:gold_nugget", weight = 10, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 10 }, - { itemstring = "mcl_tools:axe_stone", weight = 2 }, - { itemstring = "mcl_core:emerald", weight = 1 }, - } - }}, pr) - - local chest_pos = vector.add(p1, chest_offset) - init_node_construct(chest_pos) - local meta = minetest.get_meta(chest_pos) - local inv = meta:get_inventory() - mcl_loot.fill_inventory(inv, "main", lootitems, pr) -end - -function mcl_structures.generate_igloo_basement(pos, orientation, pr) - -- TODO: Add brewing stand - -- TODO: Add monster eggs - -- TODO: Spawn villager and zombie villager - local path = modpath.."/schematics/mcl_structures_igloo_basement.mts" - mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, igloo_placement_callback, pr) -end - -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 = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity() - local cat = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat"):get_luaentity() - witch._home = c - witch.can_despawn = false - 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 - return - end -end - -function mcl_structures.generate_fossil(pos, rotation, pr) - -- Generates one out of 8 possible fossil pieces - local newpos = {x=pos.x,y=pos.y-1,z=pos.z} - local fossils = { - "mcl_structures_fossil_skull_1.mts", -- 4×5×5 - "mcl_structures_fossil_skull_2.mts", -- 5×5×5 - "mcl_structures_fossil_skull_3.mts", -- 5×5×7 - "mcl_structures_fossil_skull_4.mts", -- 7×5×5 - "mcl_structures_fossil_spine_1.mts", -- 3×3×13 - "mcl_structures_fossil_spine_2.mts", -- 5×4×13 - "mcl_structures_fossil_spine_3.mts", -- 7×4×13 - "mcl_structures_fossil_spine_4.mts", -- 8×5×13 - } - local r = pr:next(1, #fossils) - local path = modpath.."/schematics/"..fossils[r] - return mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true) -end function mcl_structures.generate_end_exit_portal(pos, rot) local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts" @@ -429,37 +234,10 @@ dofile(modpath.."/api.lua") dofile(modpath.."/desert_temple.lua") dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") +dofile(modpath.."/witch_hut.lua") +dofile(modpath.."/igloo.lua") -local function hut_placement_callback(pos,def,pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - if not p1 or not p2 then return end - local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") - local tree = {} - for i = 1, #legs do - while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do - legs[i].y = legs[i].y - 1 - table.insert(tree,legs[i]) - end - end - minetest.bulk_set_node(tree, {name = "mcl_core:tree", param2 = 2}) - spawn_witch(p1,p2) -end -mcl_structures.register_structure("witch_hut",{ - place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, - fill_ratio = 0.01, - flags = "place_center_x, place_center_z, liquid_surface, force_placement", - sidelen = 5, - chunk_probability = 128, - y_max = mcl_vars.mg_overworld_max, - y_min = -4, - y_offset = 0, - biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" }, - filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" }, - after_place = hut_placement_callback, -}) mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, fill_ratio = 0.01, @@ -475,6 +253,28 @@ mcl_structures.register_structure("desert_well",{ filenames = { modpath.."/schematics/mcl_structures_desert_well.mts" }, }) +mcl_structures.register_structure("fossil",{ + place_on = {"group:material_stone"}, + fill_ratio = 0.01, + flags = "place_center_x, place_center_z", + solid_ground = true, + sidelen = 13, + chunk_probability = 256, + y_max = 1, + y_min = mcl_vars.mg_overworld_min, + biomes = { "Desert" }, + filenames = { + modpath.."/schematics/mcl_structures_fossil_skull_1.mts", -- 4×5×5 + modpath.."/schematics/mcl_structures_fossil_skull_2.mts", -- 5×5×5 + modpath.."/schematics/mcl_structures_fossil_skull_3.mts", -- 5×5×7 + modpath.."/schematics/mcl_structures_fossil_skull_4.mts", -- 7×5×5 + modpath.."/schematics/mcl_structures_fossil_spine_1.mts", -- 3×3×13 + modpath.."/schematics/mcl_structures_fossil_spine_2.mts", -- 5×4×13 + modpath.."/schematics/mcl_structures_fossil_spine_3.mts", -- 7×4×13 + modpath.."/schematics/mcl_structures_fossil_spine_4.mts", -- 8×5×13 + }, +}) + mcl_structures.register_structure("boulder",{ filenames = { modpath.."/schematics/mcl_structures_boulder_small.mts", @@ -498,7 +298,7 @@ mcl_structures.register_structure("ice_spike_large",{ -- Debug command minetest.register_chatcommand("spawnstruct", { - params = "igloo | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon", + params = "end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon", description = S("Generate a pre-defined structure near your position."), privs = {debug = true}, func = function(name, param) @@ -512,11 +312,7 @@ minetest.register_chatcommand("spawnstruct", { local pr = PseudoRandom(pos.x+pos.y+pos.z) local errord = false local message = S("Structure placed.") - if param == "igloo" then - mcl_structures.generate_igloo(pos, rot, pr) - elseif param == "fossil" then - mcl_structures.generate_fossil(pos, rot, pr) - elseif param == "end_exit_portal" then + if param == "end_exit_portal" then mcl_structures.generate_end_exit_portal(pos, rot, pr) elseif param == "end_exit_portal_open" then mcl_structures.generate_end_exit_portal_open(pos, rot, pr) diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua new file mode 100644 index 000000000..6c2250b76 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -0,0 +1,49 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +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 = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity() + local cat = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat"):get_luaentity() + witch._home = c + witch.can_despawn = false + 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 + return + end +end + +local function hut_placement_callback(pos,def,pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") + local tree = {} + for i = 1, #legs do + while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do + legs[i].y = legs[i].y - 1 + table.insert(tree,legs[i]) + end + end + minetest.bulk_set_node(tree, {name = "mcl_core:tree", param2 = 2}) + spawn_witch(p1,p2) +end + +mcl_structures.register_structure("witch_hut",{ + place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, + fill_ratio = 0.01, + flags = "place_center_x, place_center_z, liquid_surface, force_placement", + sidelen = 5, + chunk_probability = 128, + y_max = mcl_vars.mg_overworld_max, + y_min = -4, + y_offset = 0, + biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" }, + filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" }, + after_place = hut_placement_callback, +}) From 7945de132480312c9159154180fa3399b16c2be7 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 24 Jun 2022 23:24:51 +0200 Subject: [PATCH 21/29] igloo fixes, mobspawns, move geode to mcl_structs --- mods/MAPGEN/mcl_geodes/mod.conf | 3 -- mods/MAPGEN/mcl_structures/api.lua | 51 +++++++++++-------- .../init.lua => mcl_structures/geode.lua} | 4 +- mods/MAPGEN/mcl_structures/igloo.lua | 21 ++++++-- mods/MAPGEN/mcl_structures/init.lua | 2 + mods/MAPGEN/mcl_structures/jungle_temple.lua | 2 +- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 4 +- mods/MAPGEN/mcl_structures/witch_hut.lua | 2 +- 8 files changed, 55 insertions(+), 34 deletions(-) delete mode 100644 mods/MAPGEN/mcl_geodes/mod.conf rename mods/MAPGEN/{mcl_geodes/init.lua => mcl_structures/geode.lua} (96%) diff --git a/mods/MAPGEN/mcl_geodes/mod.conf b/mods/MAPGEN/mcl_geodes/mod.conf deleted file mode 100644 index cccb57108..000000000 --- a/mods/MAPGEN/mcl_geodes/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mcl_geodes -author = cora -depends = mcl_init, mcl_structures diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 65532b245..dc1f905f2 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -1,13 +1,11 @@ mcl_structures.registered_structures = {} -local function generate_loot(pos, def, pr) - local hl = def.sidelen / 2 - local p1 = vector.offset(pos,-hl,-hl,-hl) - local p2 = vector.offset(pos,hl,hl,hl) - for it,lt in pairs(def.loot) do + +function mcl_structures.fill_chests(p1,p2,loot,pr) + for it,lt in pairs(loot) do local nodes = minetest.find_nodes_in_area(p1, p2, it) for _,p in pairs(nodes) do - local lootitems = mcl_loot.get_multi_loot( lt, pr) + local lootitems = mcl_loot.get_multi_loot(lt, pr) mcl_structures.init_node_construct(p) local meta = minetest.get_meta(p) local inv = meta:get_inventory() @@ -16,6 +14,14 @@ local function generate_loot(pos, def, pr) end end +local function generate_loot(pos, def, pr) + local hl = def.sidelen / 2 + local p1 = vector.offset(pos,-hl,-hl,-hl) + local p2 = vector.offset(pos,hl,hl,hl) + if def.loot then mcl_structures.fill_chests(p1,p2,def.loot,pr) end +end + + function mcl_structures.find_lowest_y(pp) local y = 31000 for _,p in pairs(pp) do @@ -43,26 +49,31 @@ function mcl_structures.place_structure(pos, def, pr) end local pp = vector.offset(pos,0,y_offset,0) if def.solid_ground and def.sidelen then - local node_stone = "mcl_core:stone" - local node_filler = "mcl_core:dirt" - local node_top = "mcl_core:dirt_with_grass" - - if minetest.get_mapgen_setting("mg_name") ~= "v6" then - local b = minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] - 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 - end - local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2) local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2) 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 - minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid"}),{name=node_top}) - minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-1,0),vector.offset(ground_p2,0,-4,0),{"air","group:liquid"}),{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),{"air","group:liquid"}),{name=node_stone}) + 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.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 + minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid","mcl_core:snow"}),{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),{"air","group:liquid","mcl_core:snow"}),{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),{"air","group:liquid","mcl_core:snow"}),{name=node_stone}) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") diff --git a/mods/MAPGEN/mcl_geodes/init.lua b/mods/MAPGEN/mcl_structures/geode.lua similarity index 96% rename from mods/MAPGEN/mcl_geodes/init.lua rename to mods/MAPGEN/mcl_structures/geode.lua index a1ea0b631..81b505558 100644 --- a/mods/MAPGEN/mcl_geodes/init.lua +++ b/mods/MAPGEN/mcl_structures/geode.lua @@ -65,7 +65,7 @@ local function makegeode(pos,def,pr) end mcl_structures.register_structure("geode",{ - place_on = {"mcl_core:stone"}, + place_on = {"group:material_stone"}, noise_params = { offset = 0, scale = 0.00022, @@ -75,7 +75,7 @@ mcl_structures.register_structure("geode",{ persist = 0.001, flags = "absvalue", }, - flags = "place_center_x, place_center_z, force_placement", + flags = "force_placement", terrain_feature = true, y_max = -24, y_min = mcl_vars.mg_overworld_min, diff --git a/mods/MAPGEN/mcl_structures/igloo.lua b/mods/MAPGEN/mcl_structures/igloo.lua index 15363be51..d364ec492 100644 --- a/mods/MAPGEN/mcl_structures/igloo.lua +++ b/mods/MAPGEN/mcl_structures/igloo.lua @@ -5,18 +5,27 @@ local modpath = minetest.get_modpath(modname) function mcl_structures.generate_igloo_top(pos, pr) -- FIXME: This spawns bookshelf instead of furnace. Fix this! -- Furnace does ot work atm because apparently meta is not set. :-( - local newpos = {x=pos.x,y=pos.y-1,z=pos.z} + local newpos = {x=pos.x,y=pos.y-2,z=pos.z} local path = modpath.."/schematics/mcl_structures_igloo_top.mts" local rotation = tostring(pr:next(0,3)*90) return mcl_structures.place_schematic(newpos, path, rotation, nil, true), rotation end -function mcl_structures.generate_igloo_basement(pos, orientation, pr) +function mcl_structures.generate_igloo_basement(pos, orientation, loot, pr) -- TODO: Add brewing stand -- TODO: Add monster eggs - -- TODO: Spawn villager and zombie villager local path = modpath.."/schematics/mcl_structures_igloo_basement.mts" - mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, igloo_placement_callback, pr) + mcl_structures.place_schematic(pos, path, orientation, nil, true, nil, function() + local p1 = vector.offset(pos,-5,-5,-5) + local p2 = vector.offset(pos,5,5,5) + mcl_structures.fill_chests(p1,p2,loot,pr) + local mc = minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_core:stonebrickmossy"}) + if #mc == 2 then + table.shuffle(mc) + minetest.add_entity(vector.offset(mc[1],0,1,0),"mobs_mc:villager") + minetest.add_entity(vector.offset(mc[2],0,1,0),"mobs_mc:villager_zombie") + end + end, pr) end function mcl_structures.generate_igloo(pos, def, pr) @@ -108,7 +117,7 @@ function mcl_structures.generate_igloo(pos, def, pr) minetest.set_node({x=tpos.x,y=tpos.y-y,z=tpos.z}, {name="mcl_core:ladder", param2=ladder_param2}) end -- Place basement - mcl_structures.generate_igloo_basement(bpos, rotation, pr) + mcl_structures.generate_igloo_basement(bpos, rotation, def.loot, pr) -- Place hidden trapdoor minetest.after(5, function(tpos, dir) minetest.set_node(tpos, {name="mcl_doors:trapdoor", param2=20+minetest.dir_to_facedir(dir)}) -- TODO: more reliable param2 @@ -122,6 +131,8 @@ mcl_structures.register_structure("igloo",{ fill_ratio = 0.01, sidelen = 16, chunk_probability = 4400, + solid_ground = true, + make_foundation = true, y_max = mcl_vars.mg_overworld_max, y_min = 0, y_offset = 0, diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 809448d2e..d54fc2dea 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -39,6 +39,7 @@ function mcl_structures.place_schematic(pos, schematic, rotation, replacements, minetest.log("verbose", "[mcl_structures] size=" ..minetest.pos_to_string(s.size) .. ", rotation=" .. tostring(rotation) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2)) local param = {pos=vector.new(pos), schematic=s, rotation=rotation, replacements=replacements, force_placement=force_placement, flags=flags, p1=p1, p2=p2, after_placement_callback = after_placement_callback, size=vector.new(s.size), pr=pr, callback_param=callback_param} minetest.emerge_area(p1, p2, ecb_place, param) + return true end end @@ -236,6 +237,7 @@ dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") dofile(modpath.."/witch_hut.lua") dofile(modpath.."/igloo.lua") +dofile(modpath.."/geode.lua") mcl_structures.register_structure("desert_well",{ diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index aa5bf9412..1ac3bd1b4 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - fill_ratio = 0.1, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index dafc2dfff..df0a740f9 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -74,7 +74,7 @@ local cold = { place_on = {"group:sand","mcl_core:gravel","mcl_core:dirt","mcl_core:clay","group:material_stone"}, spawn_by = {"mcl_core:water_source"}, num_spawn_by = 2, - fill_ratio = 0.001, + fill_ratio = 0.01, flags = "place_center_x, place_center_z, force_placement", solid_ground = true, make_foundation = true, @@ -82,7 +82,7 @@ local cold = { y_min = mcl_vars.mg_overworld_min, y_max = -2, biomes = cold_oceans, - chunk_probability = 128, + chunk_probability = 256, sidelen = 20, filenames = { modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 6c2250b76..68b1c6809 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -39,7 +39,7 @@ mcl_structures.register_structure("witch_hut",{ fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 5, - chunk_probability = 128, + chunk_probability = 256, y_max = mcl_vars.mg_overworld_max, y_min = -4, y_offset = 0, From f5cc0ef2dc7ed0739c63d7d51b790b15429eddfa Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Jun 2022 00:31:28 +0200 Subject: [PATCH 22/29] Move shipwrecks to mcl_structures --- mods/MAPGEN/mcl_shipwrecks/init.lua | 179 ------------------ mods/MAPGEN/mcl_shipwrecks/mod.conf | 3 - mods/MAPGEN/mcl_structures/api.lua | 2 +- mods/MAPGEN/mcl_structures/init.lua | 2 + mods/MAPGEN/mcl_structures/jungle_temple.lua | 2 +- ...tructures_shipwreck_full_back_damaged.mts} | Bin ...mcl_structures_shipwreck_full_damaged.mts} | Bin .../mcl_structures_shipwreck_full_normal.mts} | Bin .../mcl_structures_shipwreck_half_back.mts} | Bin .../mcl_structures_shipwreck_half_front.mts} | Bin mods/MAPGEN/mcl_structures/shipwrecks.lua | 161 ++++++++++++++++ 11 files changed, 165 insertions(+), 184 deletions(-) delete mode 100644 mods/MAPGEN/mcl_shipwrecks/init.lua delete mode 100644 mods/MAPGEN/mcl_shipwrecks/mod.conf rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_damaged.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_full_normal.mts => mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_half_back.mts => mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts} (100%) rename mods/MAPGEN/{mcl_shipwrecks/schematics/shipwreck_half_front.mts => mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts} (100%) create mode 100644 mods/MAPGEN/mcl_structures/shipwrecks.lua diff --git a/mods/MAPGEN/mcl_shipwrecks/init.lua b/mods/MAPGEN/mcl_shipwrecks/init.lua deleted file mode 100644 index a3861a2c9..000000000 --- a/mods/MAPGEN/mcl_shipwrecks/init.lua +++ /dev/null @@ -1,179 +0,0 @@ -local modname = minetest.get_current_modname() -local modpath = minetest.get_modpath(modname) ---local S = minetest.get_translator(modname) - -local seed = minetest.get_mapgen_setting("seed") -local water_level = minetest.get_mapgen_setting("water_level") -local pr = PseudoRandom(seed) - ---schematics by chmodsayshello -local schems = { - modpath.."/schematics/".."shipwreck_full_damaged"..".mts", - modpath.."/schematics/".."shipwreck_full_normal"..".mts", - modpath.."/schematics/".."shipwreck_full_back_damaged"..".mts", - modpath.."/schematics/".."shipwreck_half_front"..".mts", - modpath.."/schematics/".."shipwreck_half_back"..".mts", -} - -local function get_supply_loot() - return { - stacks_min = 3, - stacks_max = 10, - items = { - --{ itemstring = "TODO:sus_stew", weight = 10, amount_min = 1, amount_max = 1 }, - { itemstring = "mcl_core:paper", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 8, amount_max = 21 }, - { itemstring = "mcl_farming:carrot_item", weight = 7, amount_min = 4, amount_max = 8 }, - { itemstring = "mcl_farming:potato_item_poison", weight = 7, amount_min = 2, amount_max = 6 }, - { itemstring = "mcl_farming:potato_item", weight = 7, amount_min = 2, amount_max = 6 }, - --{ itemstring = "TODO:moss_block", weight = 7, amount_min = 1, amount_max = 4 }, - { itemstring = "mcl_core:coal_lump", weight = 6, amount_min = 2, amount_max = 8 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 }, - { itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, - --{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 }, - - } - } -end - -local function get_treasure_loot() - return { - stacks_min = 3, - stacks_max = 10, - items = { - { itemstring = "mcl_core:iron_ingot", weight = 8, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:iron_nugget", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_core:emerald", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_dye:blue", weight = 8, amount_min = 1, amount_max = 12 }, - { itemstring = "mcl_core:gold_ingot", weight = 8, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:gold_nugget", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_experience:bottle", weight = 8, amount_min = 1, amount_max = 10 }, - { itemstring = "mcl_core:diamond", weight = 8, amount_min = 1, amount_max = 10 }, - } - } -end - -local function fill_chests(p1,p2) - for _,p in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_chests:chest_small"})) do - if minetest.get_meta(p):get_string("infotext") ~= "Chest" then - minetest.registered_nodes["mcl_chests:chest_small"].on_construct(p) - end - local inv = minetest.get_inventory( {type="node", pos=p} ) - local loot = get_supply_loot() - if pr:next(1,10) == 1 then loot = get_treasure_loot() end - mcl_loot.fill_inventory(inv, "main", mcl_loot.get_multi_loot({loot}, pr), pr) - end -end - -local ocean_biomes = { - "RoofedForest_ocean", - "JungleEdgeM_ocean", - "BirchForestM_ocean", - "BirchForest_ocean", - "IcePlains_deep_ocean", - "Jungle_deep_ocean", - "Savanna_ocean", - "MesaPlateauF_ocean", - "ExtremeHillsM_deep_ocean", - "Savanna_deep_ocean", - "SunflowerPlains_ocean", - "Swampland_deep_ocean", - "Swampland_ocean", - "MegaSpruceTaiga_deep_ocean", - "ExtremeHillsM_ocean", - "JungleEdgeM_deep_ocean", - "SunflowerPlains_deep_ocean", - "BirchForest_deep_ocean", - "IcePlainsSpikes_ocean", - "Mesa_ocean", - "StoneBeach_ocean", - "Plains_deep_ocean", - "JungleEdge_deep_ocean", - "SavannaM_deep_ocean", - "Desert_deep_ocean", - "Mesa_deep_ocean", - "ColdTaiga_deep_ocean", - "Plains_ocean", - "MesaPlateauFM_ocean", - "Forest_deep_ocean", - "JungleM_deep_ocean", - "FlowerForest_deep_ocean", - "MushroomIsland_ocean", - "MegaTaiga_ocean", - "StoneBeach_deep_ocean", - "IcePlainsSpikes_deep_ocean", - "ColdTaiga_ocean", - "SavannaM_ocean", - "MesaPlateauF_deep_ocean", - "MesaBryce_deep_ocean", - "ExtremeHills+_deep_ocean", - "ExtremeHills_ocean", - "MushroomIsland_deep_ocean", - "Forest_ocean", - "MegaTaiga_deep_ocean", - "JungleEdge_ocean", - "MesaBryce_ocean", - "MegaSpruceTaiga_ocean", - "ExtremeHills+_ocean", - "Jungle_ocean", - "RoofedForest_deep_ocean", - "IcePlains_ocean", - "FlowerForest_ocean", - "ExtremeHills_deep_ocean", - "MesaPlateauFM_deep_ocean", - "Desert_ocean", - "Taiga_ocean", - "BirchForestM_deep_ocean", - "Taiga_deep_ocean", - "JungleM_ocean" -} - -local beach_biomes = { - "FlowerForest_beach", - "Forest_beach", - "StoneBeach", - "ColdTaiga_beach_water", - "Taiga_beach", - "Savanna_beach", - "Plains_beach", - "ExtremeHills_beach", - "ColdTaiga_beach", - "Swampland_shore", - "MushroomIslandShore", - "JungleM_shore", - "Jungle_shore" -} - -mcl_structures.register_structure("shipwreck",{ - place_on = {"group:sand","mcl_core:gravel"}, - spawn_by = {"group:water"}, - num_spawn_by = 4, - noise_params = { - offset = 0, - scale = 0.000022, - spread = {x = 250, y = 250, z = 250}, - seed = 3, - octaves = 3, - persist = 0.001, - flags = "absvalue", - }, - flags = "force_placement", - biomes = ocean_biomes, - y_max = water_level-4, - y_min = mcl_vars.mg_overworld_min, - filenames = schems, - y_offset = function(pr) return pr:next(-4,-2) end, - after_place = function(pos) - fill_chests(vector.offset(pos,-20,-5,-20),vector.offset(pos,20,15,20)) - end -}) diff --git a/mods/MAPGEN/mcl_shipwrecks/mod.conf b/mods/MAPGEN/mcl_shipwrecks/mod.conf deleted file mode 100644 index 79940c744..000000000 --- a/mods/MAPGEN/mcl_shipwrecks/mod.conf +++ /dev/null @@ -1,3 +0,0 @@ -name = mcl_shipwrecks -author = cora -depends = mcl_loot, mcl_structures, mcl_enchanting diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index dc1f905f2..f0c4fa6a5 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -145,7 +145,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it y_max = def.y_max, y_min = def.y_min }) - minetest.register_node(":"..structblock, {drawtype="normal", walkable = false, pointable = false,groups = sbgroups}) + minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups}) def.structblock = structblock def.deco_id = minetest.get_decoration_id("mcl_structures:deco_"..name) minetest.set_gen_notify({decoration=true}, { def.deco_id }) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index d54fc2dea..a996e440a 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -232,6 +232,7 @@ local function dir_to_rotation(dir) end dofile(modpath.."/api.lua") +dofile(modpath.."/shipwrecks.lua") dofile(modpath.."/desert_temple.lua") dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") @@ -240,6 +241,7 @@ dofile(modpath.."/igloo.lua") dofile(modpath.."/geode.lua") + mcl_structures.register_structure("desert_well",{ place_on = {"group:sand"}, fill_ratio = 0.01, diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 1ac3bd1b4..aa5bf9412 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - fill_ratio = 0.01, + fill_ratio = 0.1, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_back_damaged.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_back_damaged.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_damaged.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_damaged.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_full_normal.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_full_normal.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_back.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_back.mts diff --git a/mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_front.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts similarity index 100% rename from mods/MAPGEN/mcl_shipwrecks/schematics/shipwreck_half_front.mts rename to mods/MAPGEN/mcl_structures/schematics/mcl_structures_shipwreck_half_front.mts diff --git a/mods/MAPGEN/mcl_structures/shipwrecks.lua b/mods/MAPGEN/mcl_structures/shipwrecks.lua new file mode 100644 index 000000000..72823d811 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/shipwrecks.lua @@ -0,0 +1,161 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) +--local S = minetest.get_translator(modname) + +local seed = minetest.get_mapgen_setting("seed") +local water_level = minetest.get_mapgen_setting("water_level") +local pr = PseudoRandom(seed) + +--schematics by chmodsayshello +local schems = { + modpath.."/schematics/mcl_structures_shipwreck_full_damaged.mts", + modpath.."/schematics/mcl_structures_shipwreck_full_normal.mts", + modpath.."/schematics/mcl_structures_shipwreck_full_back_damaged.mts", + modpath.."/schematics/mcl_structures_shipwreck_half_front.mts", + modpath.."/schematics/mcl_structures_shipwreck_half_back.mts", +} + +local ocean_biomes = { + "RoofedForest_ocean", + "JungleEdgeM_ocean", + "BirchForestM_ocean", + "BirchForest_ocean", + "IcePlains_deep_ocean", + "Jungle_deep_ocean", + "Savanna_ocean", + "MesaPlateauF_ocean", + "ExtremeHillsM_deep_ocean", + "Savanna_deep_ocean", + "SunflowerPlains_ocean", + "Swampland_deep_ocean", + "Swampland_ocean", + "MegaSpruceTaiga_deep_ocean", + "ExtremeHillsM_ocean", + "JungleEdgeM_deep_ocean", + "SunflowerPlains_deep_ocean", + "BirchForest_deep_ocean", + "IcePlainsSpikes_ocean", + "Mesa_ocean", + "StoneBeach_ocean", + "Plains_deep_ocean", + "JungleEdge_deep_ocean", + "SavannaM_deep_ocean", + "Desert_deep_ocean", + "Mesa_deep_ocean", + "ColdTaiga_deep_ocean", + "Plains_ocean", + "MesaPlateauFM_ocean", + "Forest_deep_ocean", + "JungleM_deep_ocean", + "FlowerForest_deep_ocean", + "MushroomIsland_ocean", + "MegaTaiga_ocean", + "StoneBeach_deep_ocean", + "IcePlainsSpikes_deep_ocean", + "ColdTaiga_ocean", + "SavannaM_ocean", + "MesaPlateauF_deep_ocean", + "MesaBryce_deep_ocean", + "ExtremeHills+_deep_ocean", + "ExtremeHills_ocean", + "MushroomIsland_deep_ocean", + "Forest_ocean", + "MegaTaiga_deep_ocean", + "JungleEdge_ocean", + "MesaBryce_ocean", + "MegaSpruceTaiga_ocean", + "ExtremeHills+_ocean", + "Jungle_ocean", + "RoofedForest_deep_ocean", + "IcePlains_ocean", + "FlowerForest_ocean", + "ExtremeHills_deep_ocean", + "MesaPlateauFM_deep_ocean", + "Desert_ocean", + "Taiga_ocean", + "BirchForestM_deep_ocean", + "Taiga_deep_ocean", + "JungleM_ocean" +} + +local beach_biomes = { + "FlowerForest_beach", + "Forest_beach", + "StoneBeach", + "ColdTaiga_beach_water", + "Taiga_beach", + "Savanna_beach", + "Plains_beach", + "ExtremeHills_beach", + "ColdTaiga_beach", + "Swampland_shore", + "MushroomIslandShore", + "JungleM_shore", + "Jungle_shore" +} + +mcl_structures.register_structure("shipwreck",{ + place_on = {"group:sand","mcl_core:gravel"}, + spawn_by = {"group:water"}, + num_spawn_by = 4, + noise_params = { + offset = 0, + scale = 0.000022, + spread = {x = 250, y = 250, z = 250}, + seed = 3, + octaves = 3, + persist = 0.001, + flags = "absvalue", + }, + sidelen = 16, + flags = "force_placement", + biomes = ocean_biomes, + y_max = water_level-4, + y_min = mcl_vars.mg_overworld_min, + filenames = schems, + y_offset = function(pr) return pr:next(-4,-2) end, + loot = { + ["mcl_chests:chest_small"] = { + stacks_min = 3, + stacks_max = 10, + items = { + { itemstring = "mcl_sus_stew:stew", weight = 10, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:paper", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_farming:wheat_item", weight = 7, amount_min = 8, amount_max = 21 }, + { itemstring = "mcl_farming:carrot_item", weight = 7, amount_min = 4, amount_max = 8 }, + { itemstring = "mcl_farming:potato_item_poison", weight = 7, amount_min = 2, amount_max = 6 }, + { itemstring = "mcl_farming:potato_item", weight = 7, amount_min = 2, amount_max = 6 }, + --{ itemstring = "TODO:moss_block", weight = 7, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_core:coal_lump", weight = 6, amount_min = 2, amount_max = 8 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 5, amount_max = 24 }, + { itemstring = "mcl_farming:potato_item", weight = 3, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_armor:helmet_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + --{ itemstring = "TODO:bamboo", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_farming:pumpkin", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 }, + + }, + { + stacks_min = 3, + stacks_max = 10, + items = { + { itemstring = "mcl_core:iron_ingot", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:iron_nugget", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:emerald", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_dye:blue", weight = 8, amount_min = 1, amount_max = 12 }, + { itemstring = "mcl_core:gold_ingot", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:gold_nugget", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_experience:bottle", weight = 8, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:diamond", weight = 8, amount_min = 1, amount_max = 10 }, + } + } + } + } +}) From be2a8d705499b4ec6ace552ceaae1ad8aa4dd86c Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Jun 2022 02:53:58 +0200 Subject: [PATCH 23/29] Structure transfer fixes --- mods/MAPGEN/mcl_structures/desert_temple.lua | 2 +- mods/MAPGEN/mcl_structures/igloo.lua | 2 +- mods/MAPGEN/mcl_structures/jungle_temple.lua | 2 +- mods/MAPGEN/mcl_structures/ocean_ruins.lua | 2 +- mods/MAPGEN/mcl_structures/witch_hut.lua | 14 +++++++------- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index ddacd83d2..272310802 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -34,7 +34,7 @@ end mcl_structures.register_structure("desert_temple",{ place_on = {"group:sand"}, - fill_ratio = 0.01, + fill_ratio = 0.05, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, diff --git a/mods/MAPGEN/mcl_structures/igloo.lua b/mods/MAPGEN/mcl_structures/igloo.lua index d364ec492..49e3c879a 100644 --- a/mods/MAPGEN/mcl_structures/igloo.lua +++ b/mods/MAPGEN/mcl_structures/igloo.lua @@ -130,7 +130,7 @@ mcl_structures.register_structure("igloo",{ place_on = {"mcl_core:snowblock","mcl_core:snow","group:grass_block_snow"}, fill_ratio = 0.01, sidelen = 16, - chunk_probability = 4400, + chunk_probability = 250, solid_ground = true, make_foundation = true, y_max = mcl_vars.mg_overworld_max, diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index aa5bf9412..d421ba5b0 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -19,7 +19,7 @@ mcl_structures.register_structure("jungle_temple",{ modpath.."/schematics/mcl_structures_jungle_temple_nice.mts", }, loot = { - ["mcl_chests:chest_small" ] ={{ + ["mcl_chests:trapped_chest_small" ] ={{ stacks_min = 2, stacks_max = 6, items = { diff --git a/mods/MAPGEN/mcl_structures/ocean_ruins.lua b/mods/MAPGEN/mcl_structures/ocean_ruins.lua index df0a740f9..0b609aee7 100644 --- a/mods/MAPGEN/mcl_structures/ocean_ruins.lua +++ b/mods/MAPGEN/mcl_structures/ocean_ruins.lua @@ -82,7 +82,7 @@ local cold = { y_min = mcl_vars.mg_overworld_min, y_max = -2, biomes = cold_oceans, - chunk_probability = 256, + chunk_probability = 400, sidelen = 20, filenames = { modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts", diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 68b1c6809..6a10e7a91 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -22,12 +22,12 @@ local function hut_placement_callback(pos,def,pr) local hl = def.sidelen / 2 local p1 = vector.offset(pos,-hl,-hl,-hl) local p2 = vector.offset(pos,hl,hl,hl) - local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") + local legs = minetest.find_nodes_in_area(vector.offset(pos,-hl,0,-hl),vector.offset(pos,hl,0,hl), "mcl_core:tree") local tree = {} - for i = 1, #legs do - while minetest.get_item_group(mcl_vars.get_node({x=legs[i].x, y=legs[i].y-1, z=legs[i].z}, true, 333333).name, "water") ~= 0 do - legs[i].y = legs[i].y - 1 - table.insert(tree,legs[i]) + for _,leg in pairs(legs) do + while minetest.get_item_group(mcl_vars.get_node(vector.offset(leg,0,-1,0), true, 333333).name, "water") ~= 0 do + leg = vector.offset(leg,0,-1,0) + table.insert(tree,leg) end end minetest.bulk_set_node(tree, {name = "mcl_core:tree", param2 = 2}) @@ -38,8 +38,8 @@ mcl_structures.register_structure("witch_hut",{ place_on = {"group:sand","group:grass_block","mcl_core:water_source","group:dirt"}, fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", - sidelen = 5, - chunk_probability = 256, + sidelen = 8, + chunk_probability = 400, y_max = mcl_vars.mg_overworld_max, y_min = -4, y_offset = 0, From 8684140740295e31bb95c6f36baa22fe5eed00cf Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Jun 2022 06:16:18 +0200 Subject: [PATCH 24/29] log actual placement position --- mods/MAPGEN/mcl_structures/api.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index f0c4fa6a5..596c493a9 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -76,7 +76,7 @@ function mcl_structures.place_structure(pos, def, pr) minetest.bulk_set_node(minetest.find_nodes_in_area(vector.offset(ground_p1,0,-5,0),vector.offset(ground_p2,0,-30,0),{"air","group:liquid","mcl_core:snow"}),{name=node_stone}) else if logging then - minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.") + minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.") end return false end @@ -84,7 +84,7 @@ function mcl_structures.place_structure(pos, def, pr) end if def.on_place and not def.on_place(pos,def,pr) then if logging then - minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. Conditions not satisfied.") + minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. Conditions not satisfied.") end return false end @@ -101,14 +101,14 @@ function mcl_structures.place_structure(pos, def, pr) return ap(pos,def,pr) end,pr) if logging then - minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp)) end return true end elseif def.place_func and def.place_func(pos,def,pr) then if not def.after_place or ( def.after_place and def.after_place(pos,def,pr) ) then if logging then - minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pos)) + minetest.log("action","[mcl_structures] "..def.name.." placed at "..minetest.pos_to_string(pp)) end return true end From f115fc8ea0858a014bef6d7d56ecd1ad72617c86 Mon Sep 17 00:00:00 2001 From: cora Date: Sat, 25 Jun 2022 06:16:43 +0200 Subject: [PATCH 25/29] tweak probabilities --- mods/MAPGEN/mcl_structures/desert_temple.lua | 4 ++-- mods/MAPGEN/mcl_structures/init.lua | 11 ++++++----- mods/MAPGEN/mcl_structures/jungle_temple.lua | 4 ++-- mods/MAPGEN/mcl_structures/witch_hut.lua | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 272310802..61daaf338 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -34,13 +34,13 @@ end mcl_structures.register_structure("desert_temple",{ place_on = {"group:sand"}, - fill_ratio = 0.05, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, sidelen = 18, y_offset = -12, - chunk_probability = 500, + chunk_probability = 300, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Desert" }, diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index a996e440a..3a778b138 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -249,7 +249,7 @@ mcl_structures.register_structure("desert_well",{ not_near = { "desert_temple_new" }, solid_ground = true, sidelen = 4, - chunk_probability = 256, + chunk_probability = 600, y_max = mcl_vars.mg_overworld_max, y_min = 1, y_offset = -2, @@ -258,14 +258,15 @@ mcl_structures.register_structure("desert_well",{ }) mcl_structures.register_structure("fossil",{ - place_on = {"group:material_stone"}, + place_on = {"group:material_stone","group:sand"}, fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, sidelen = 13, - chunk_probability = 256, - y_max = 1, - y_min = mcl_vars.mg_overworld_min, + chunk_probability = 1000, + y_offset = function(pr) return ( pr:next(1,16) * -1 ) -16 end, + y_max = 15, + y_min = mcl_vars.mg_overworld_min + 35, biomes = { "Desert" }, filenames = { modpath.."/schematics/mcl_structures_fossil_skull_1.mts", -- 4×5×5 diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index d421ba5b0..843dec04d 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -4,12 +4,12 @@ local modpath = minetest.get_modpath(modname) mcl_structures.register_structure("jungle_temple",{ place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, - fill_ratio = 0.1, + fill_ratio = 0.01, flags = "place_center_x, place_center_z", solid_ground = true, make_foundation = true, y_offset = function(pr) return pr:next(-3,0) -5 end, - chunk_probability = 1500, + chunk_probability = 200, y_max = mcl_vars.mg_overworld_max, y_min = 1, biomes = { "Jungle" }, diff --git a/mods/MAPGEN/mcl_structures/witch_hut.lua b/mods/MAPGEN/mcl_structures/witch_hut.lua index 6a10e7a91..039c46332 100644 --- a/mods/MAPGEN/mcl_structures/witch_hut.lua +++ b/mods/MAPGEN/mcl_structures/witch_hut.lua @@ -39,7 +39,7 @@ mcl_structures.register_structure("witch_hut",{ fill_ratio = 0.01, flags = "place_center_x, place_center_z, liquid_surface, force_placement", sidelen = 8, - chunk_probability = 400, + chunk_probability = 300, y_max = mcl_vars.mg_overworld_max, y_min = -4, y_offset = 0, From ac69b7c7104908c027fc5cb2494a20213f495e55 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 1 Jul 2022 04:25:34 +0200 Subject: [PATCH 26/29] Add woodland cabin and outpost --- mods/MAPGEN/mcl_structures/api.lua | 7 +-- mods/MAPGEN/mcl_structures/init.lua | 1 + .../mcl_structures_woodland_cabin.mts | Bin 0 -> 2736 bytes .../mcl_structures_woodland_outpost.mts | Bin 0 -> 3341 bytes .../mcl_structures/woodland_mansion.lua | 43 ++++++++++++++++++ 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_cabin.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_outpost.mts create mode 100644 mods/MAPGEN/mcl_structures/woodland_mansion.lua diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 596c493a9..4e017b502 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -68,12 +68,13 @@ function mcl_structures.place_structure(pos, def, pr) if b.node_stone then node_stone = b.node_stone end if b.node_dust then node_dust = b.node_dust end end - minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,ground_p2,{"air","group:liquid","mcl_core:snow"}),{name=node_top}) + 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),{"air","group:liquid","mcl_core:snow"}),{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),{"air","group:liquid","mcl_core:snow"}),{name=node_stone}) + 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}) else if logging then minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pp).." not placed. No solid ground.") diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 3a778b138..a77b3dbe4 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -238,6 +238,7 @@ dofile(modpath.."/jungle_temple.lua") dofile(modpath.."/ocean_ruins.lua") dofile(modpath.."/witch_hut.lua") dofile(modpath.."/igloo.lua") +dofile(modpath.."/woodland_mansion.lua") dofile(modpath.."/geode.lua") diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_cabin.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_cabin.mts new file mode 100644 index 0000000000000000000000000000000000000000..f654da926d5583b0109bcdcb3b43cf5fbb768fef GIT binary patch literal 2736 zcmaJ2zE=jJs2Cq5^8*dJ`@rO~`Z;LIW8T&^i$x zqSz`!wTLzl5M&;r(vnzErov^45u_qS&=ewLLcaiZc~GW?=ykAQFW{jY6%~XXi`OYXxW^`G1P~t4DvZ zMM6{p1po1BZjZ8?!~47Hg?b}UroXFS=)s)6cg@i|^UgDXMWfHNvuI2L5rQ#uao$S( zo&{s(0su#Y6bi~lkNgfu-|PiWfW~G)%=u>vqUVfTP&{Yn@BR>oAc^|tnjtU(&xVO8 zV?8>DMx$WpBr17+6#hc?Zi4h}SjhjQML-nDg611Wgun}_}Wbeqa_u^pL`NSjcmVL$%&I{bW>-9iOcRcc8RL62kpO; z|9~vJ8N9~wh`ieHer%{*7?#riOevaCDP9w`7dKw{`u5#xkkv4U|gv-d!%52{H7RRL%fFQ4RYp={DQqn zFQ&$CAD76MLL0ZQORe@-*KdBn4r#%KguUuJYekTMI9&Xg(->?p8uVUc{-Pg;4*AJl`h$368Y?Mrp;@hgW7)Kl#lXUdG5)Wp&t8&(={pRB`(sS>N<2s zB*QDUYV9LSiIo?}WURFWl!$+r;-VpmY;VrQb#frA*!r5XuC-|Cy0E(`b!D*%t@9hH z>z3$1pG%p|e6R7ATgaB?mz}on)!12Q*P-w3tVf$)Sl2E`>e2ouwQtI7>NR!-i0>rZ z3{L-Iyl9ZsC^*Mgh#Zr_7F^mHFIDw~)x_9W+4q+0IFsbgXz0CK^$H1iesK{}J4v)g z2t9q1gTFfDyh404_?@mk;k4nDvxu)T<`e_%hNyLi%@EQ@-IeOn=ZwVLXS8k_V(1f% z%0M>k(v{c)m+oZe`odb*&U}HH>s!_6OvMiNdG<_&oSv@5BqIXzW4h%#o?HBcX7Iyq zF3xj~s2UNG6Yi+FOE-nf(3S+ZH=aT0a_@-X+8YR{>e(A-)3lrQrNbMNQ7=dQT}|JA>g-E0Tfz!z<$z7C=ZQtZ-}dzU6(Z z(dD@-61W`jSRMy>Xw*}$le-0`QQ5j{_#1U0+X;L4=?}F`-gKOFf^R8e@U?bp{*}>Z zB)r2jD|A739765@$pqzcZm)dXH%ADM>vwz&%>a@X7(-&_b?!fpx7@4op}%?#xolO0K7%2fg3E zQ9XYR?`2ef_W&n#?7z`Zek#qd^N*dKdKBrjZ(FUIQflJUa% zTy)2Ef2m>oe;jT7CvZU*bctCr7z%F$Zsir2w92dxwlconn%Z`NzqV-RP*g=`Oa7D8 z^)pq2;T=p}N1FP)MaE^-=02Y#2@j5Mu{8QWVO_zvjllBpQ-iY2yGE}M{<3V3)9C{P z<~1)r-!}21C{EY#toZXYk3`4IJi?Cd>NYIk&aMg#dxnsII?GqQIG80Fs+d03l5~&v zsTc|ScV0L_yfK_PWqtemY>|~24vAC4rV?d+PeH>_SAv0uSdV4#Di@h@ z+uMis1tCv{+=->;*@qlU(ye+z$9ck{J-NR9cGGQGj{lyvQLlK`BZf`;aHG3}{R(FF zU~UGd|AJpI!Dap3EB^M_#t(vJkzbV@(HLzH7Btg=)6VZ}f=w$$dHX~w5yEaX8?WuU zeJW4(-0t)w&PT{C^Fz`Su!Y6%NxT;${PL5)N_UVQd)~uXce&EI*DllDDm$0o1!5$^ zwls!f%#Z069}_ESBjg;q2_?D&D-BMx4K}y(tJT{H8o$+Ik6Og}#ED4Q#;Ux^Nz)MmHfVUla__dsBx!hOShu60bmVPu30I}GZ7R9rkw_8N7vu}u^77!`dQgyd{s?)+r}s<)!y_22Jc1@3&+V6AFX~6OtW1(5c)NiX7~zmc6wDf zyJ8Q;RP$iSuvHl(j+4u?L@9&zQ5wIj)jk`qHnJ}{$V1apvBEZT^E7_o(g17CFy~vK zu^%xMS2_!4FhouYp0BmdGbv0e%D3k&)^?D0>o!L5`W-g-C7Z@Ol3XGzTRK#?3T$5r cRksSfrz=R)*Mp_*IG5fnAIutD6O29m4b|R2YybcN literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_outpost.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_woodland_outpost.mts new file mode 100644 index 0000000000000000000000000000000000000000..6fd48068b0f5d3b67cbbd8448806c7269619a82b GIT binary patch literal 3341 zcmaJ>dpuNm8$XqlL>omC+P5uht$Qgmz3ZiRrCf4pm2f(9=3vY*XPh&}rN$<^TP|tU zMi<8JSkbyf<5F%#WtLo`!WfsOG$lh`MNxV`a|T=O+nztp`Td^z`99z0arX3Z29yA8 zKm*YH?r#r30Tw_E99S6)qo6;Eg&{aW;e?_LHi#p1VAbEn7!I)lkPjRn6b-;3f&f01 zJD?DYgWxQJLSUhDHxNb`D1#LMsL4%W3`Zzj1`7c+-t&M1AqET3A=4r(7$GQh2xo#A z#01GZuzb#2uHfJZq9~H!Kn$Fq5GX_g<(e=IqbuUfYUBogsn*Ej%&OjX0y!8PSUs18 z;NT248=;e)@;U&ma5lt32#Wj-(ohIyg8nGPQ6MrKkxWL`@P5IhNb{ZO7z?4{444V5 zm=gwL1Q7vaG#ZM$SIDd>j6*PUwmBq_#GH=w1+>Umfe67NDC7quf*}+I*2(3HF0(NX zK~Wq*HpT(z5Q~nW42%UBeB6kQvDp#8`i~pX&`<=#a5#`bSKu*I-VBCv`2K1?oq=-{ zSkN$xNl?glAcFcUnls0unZq1`{vkgU8H&rB5{htuPslPABvNo^!^aC(P=1EnWGnn3 zJea`>pb!`X1;Y>yu$J_mk+MUB*-QqD!w5h?l)+*mbdUq+ziSbUpx6g`vMn4rJP1J{ zzhIcWEhHa4h^*kvtdI-_sLSJ%hz6kYVS9&1Y&;Z3NOI}Qjozc-J4%v_?^U3f5e5ed z_Q#=MgrLZeAbD2c5QbqW1&)ANAPnJbWacmF7$%=KGA+o#A+}rqVr+z^=sW2Z7RcZr zvu@;uA;keWg3LuD#qUuSMf^Gchru`_AaG{LNC?6p4uXRO7K+1&0tqrWj?iZ_D%wHr zv=73H_pdP|$ucWe(38zzF#&CoWHX!k9lnRB%6#MPCDtoe77i$} zmDM)nnvXv&DcLWnOb1KB^cR=?r1kDQbQe>CXwu2O$(+zb$k#>*cBusmnW@cc7yivC zst!;`wbHf@3#lh7@1es5DW9ERV14|j%o5K!=ccc8Qz}eommaze7hWyOx;=dP?xw~Y zMpRgOJ?g7YSF0w+(bq(iFnqqiuhFyI=EXCkfq}H!o2KhxM$UKn1@8K}|G$TK37c!D z39a?eHfiqOWq0G~m#S3@B}&vb@00_g!6zC6iQ*i3+^Ei3+G0JQgn^}ZZzXU|EyJg6 zw5=+>X?uRMauuk{-Bguh!rQ#>xWncq9ol)Cw3rXA>)o2#y`dx9t7Yg)`j?uOO1Jn? z73r}Xl^hOcr}2G-CgttD$a4M zgar5R2=`YS4tJGW8o3HA;*kASvmw}Rr@*epk-Yx(dx2h^G~a-y{REi_HKheG*O4Q8Ofge>4O$SN25BU z^6qZ7gvL8+8O8 zt50~QFGx$-u9sjqA}*!y3^i*hTa4AbsLBzYul%yQi^tAYCOrwgeA8e|#Xn5ewVbP3 z+HR&oEvZU_4BV+9T{{?tUnSF0f(#e&3ew;)nsr;#vdOWu8`kXN8}TA^{?1L8ijO?j zkQ^J$a4PI>EdOly=i|?Oj(1sI-Vp(QEhUzbOzRD}H!&*GlfZf0#~S5trf!_cdDQ2J zEV?-FM9r3JYpr=qi8Ix#^X~^LoT! zm!0clR@WWL_c1i+$HsgkwQK`&$6dPf$I`(Cet2X)mar}Vt2yBZVS1bU^S zsunZYRg@Mnl@-}jS7?yMRa)(8H%Lv@rj%rdm3^19XR%kLb9CI!seNA8vjRsG-`G^) zZ7XxvPnp&Eof>L`uZ?x2NBPdH0c4qPraT&jjgk{y)Fn}L6{)b*xHGxh`uKgPn_}%p zZPmA)Qa!rZ_tz~H@*8W{2>EK!e%e~=itSCl3HrfX=e+luZ`*|`dy&_T(@BzW(=C~N zcUgAQ9Z{RhlE6K#L3*JLj(HhcyC-c4al(cB@$oe?vO*r;Ml@5;tM{_?SAf~ z6?dE@KZt=-AsY{_#%_Yl-ZUsmHGW>6NzD4TVms$mUhcf5 z!fQ{IV}{RVyPu7yIc%$z?@(6PHC3>1&6oMI*n?v(D*df8mF*s}2E$G%OHIqnsnp1$ z_EOL0(G@K{!*A^m9T?#pz{&<4>9}kGTSe33E}7*!bV3PfqXD*Wo@>?>_Pe_3K~hy`4#F#+46}ZqHweM5T6$>!^LM zMp;fSG$yq&^U~w-ku|c7f8OlBGRARO7})R#xpt>>c@pSg86!*;UZcm(4nQb-r4b-XApWzLtZA(TOXU zbzFZ-iEbENo;KBX-leyyM3NxYTT1J4KC3DfmuR`(rS4mGonMnJ95rBDNK-ZW%c7^z phX*2WUI~$A@2PDaYXAAE?WDHv#@fP&EP+5E=no&Y^%LB__&?^K{J8)C literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/woodland_mansion.lua b/mods/MAPGEN/mcl_structures/woodland_mansion.lua new file mode 100644 index 000000000..b4b54f5fc --- /dev/null +++ b/mods/MAPGEN/mcl_structures/woodland_mansion.lua @@ -0,0 +1,43 @@ +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local modpath = minetest.get_modpath(modname) + +mcl_structures.register_structure("woodland_cabin",{ + place_on = {"group:grass_block","group:dirt","mcl_core:dirt_with_grass"}, + fill_ratio = 0.01, + flags = "place_center_x, place_center_z", + solid_ground = true, + make_foundation = true, + chunk_probability = 800, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + biomes = { "RoofedForest" }, + sidelen = 32, + filenames = { + modpath.."/schematics/mcl_structures_woodland_cabin.mts", + modpath.."/schematics/mcl_structures_woodland_outpost.mts", + }, + loot = { + ["mcl_chests:trapped_chest_small" ] ={{ + stacks_min = 2, + stacks_max = 6, + items = { + { itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 16, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, + --{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO + { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_mobitems:saddle", weight = 3, }, + { itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) + end }, + { itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, + { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, + { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, + } + }} + } +}) From c59a89096394cb4d4a5761f27610a8649794b4f9 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 1 Jul 2022 06:10:45 +0200 Subject: [PATCH 27/29] add woodland cabin loot --- .../mcl_structures/woodland_mansion.lua | 47 ++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/woodland_mansion.lua b/mods/MAPGEN/mcl_structures/woodland_mansion.lua index b4b54f5fc..d47d4a0e6 100644 --- a/mods/MAPGEN/mcl_structures/woodland_mansion.lua +++ b/mods/MAPGEN/mcl_structures/woodland_mansion.lua @@ -18,24 +18,39 @@ mcl_structures.register_structure("woodland_cabin",{ modpath.."/schematics/mcl_structures_woodland_outpost.mts", }, loot = { - ["mcl_chests:trapped_chest_small" ] ={{ - stacks_min = 2, - stacks_max = 6, + ["mcl_chests:chest_small" ] ={{ + stacks_min = 3, + stacks_max = 3, items = { - { itemstring = "mcl_mobitems:bone", weight = 20, amount_min = 4, amount_max=6 }, - { itemstring = "mcl_mobitems:rotten_flesh", weight = 16, amount_min = 3, amount_max=7 }, + { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 1, amount_max=8 }, + { itemstring = "mcl_mobitems:gunpowder", weight = 10, amount_min = 1, amount_max = 8 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 10, amount_min = 1, amount_max=8 }, + { itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max=8 }, + { itemstring = "mcl_core:gold_ingot", weight = 15, amount_min = 2, amount_max = 7 }, - --{ itemstring = "mcl_bamboo:bamboo", weight = 15, amount_min = 1, amount_max=3 }, --FIXME BAMBOO - { itemstring = "mcl_core:iron_ingot", weight = 15, amount_min = 1, amount_max = 5 }, - { itemstring = "mcl_core:diamond", weight = 3, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_mobitems:saddle", weight = 3, }, - { itemstring = "mcl_core:emerald", weight = 2, amount_min = 1, amount_max = 3 }, - { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr) - mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) - end }, - { itemstring = "mcl_mobitems:iron_horse_armor", weight = 1, }, - { itemstring = "mcl_mobitems:gold_horse_armor", weight = 1, }, - { itemstring = "mcl_mobitems:diamond_horse_armor", weight = 1, }, + }},{ + stacks_min = 1, + stacks_max = 4, + items = { + { itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_farming:bread", weight = 20, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 }, + { itemstring = "mesecons:mesecon", weight = 15, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 }, + { itemstring = "mcl_farming:melon_seeds", weight = 10, amount_min = 2, amount_max = 4 }, + { itemstring = "mcl_farming:pumpkin_seeds", weight = 10, amount_min = 2, amount_max = 4 }, + { itemstring = "mcl_core:iron_ingot", weight = 10, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_buckets:bucket_empty", weight = 10, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:gold_ingot", weight = 5, amount_min = 1, amount_max = 4 }, + }},{ + stacks_min = 1, + stacks_max = 4, + items = { + --{ itemstring = "FIXME:lead", weight = 20, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_mobs:nametag", weight = 2, amount_min = 1, amount_max = 3 }, + { itemstring = "mcl_books:book", weight = 1, func = function(stack, pr)mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}, pr) end }, + { itemstring = "mcl_armor:chestplate_chain", weight = 1, }, + { itemstring = "mcl_armor:chestplate_diamond", weight = 1, }, { itemstring = "mcl_core:apple_gold_enchanted", weight = 2, }, } }} From ef14006f15b57a063a5b335e8c4ff11a28df97b4 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 1 Jul 2022 14:30:02 +0200 Subject: [PATCH 28/29] Fix surface pools & desert temple loot --- mods/MAPGEN/mcl_structures/desert_temple.lua | 2 +- mods/MAPGEN/mcl_terrain_features/init.lua | 21 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 61daaf338..75c170ab1 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -47,7 +47,7 @@ mcl_structures.register_structure("desert_temple",{ filenames = { modpath.."/schematics/mcl_structures_desert_temple.mts" }, after_place = temple_placement_callback, loot = { - ["mcl_chests:chest_small" ] ={ + ["mcl_chests:chest" ] ={ { stacks_min = 2, stacks_max = 4, diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index bf3a846a2..9ee8ba26f 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -24,31 +24,34 @@ local function set_node_no_bedrock(pos,node) end local function airtower(pos,tbl,h) - for i=0,h do + 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) local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) - local p1 = vector.offset(pos,-size,-size,-size) - local p2 = vector.offset(pos,size,size,size) + local p1 = vector.offset(pos,-size,-1,-size) + local p2 = vector.offset(pos,size,-1,size) local nn = minetest.find_nodes_in_area(p1,p2,placein) 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 not nn[1] then return end - local y = mcl_structures.find_highest_y(nn) + local y = pos.y - pr:next(1,2) local lq = {} local air = {} - for i=1,pr:next(1,#nn) do + local r = pr:next(1,#nn) + if r > #nn then return end + for i=1,r do if nn[i].y == y then - airtower(vector.offset(nn[i],0,1,0),air,55) + airtower(nn[i],air,55) table.insert(lq,nn[i]) end end minetest.bulk_set_node(lq,{name=liquid}) - local air = {} + minetest.bulk_set_node(air,{name="air"}) + air = {} local br = {} for k,v in pairs(lq) do for kk,vv in pairs(adjacents) do @@ -68,13 +71,13 @@ local function makelake(pos,size,liquid,placein,border,pr) if an.name ~= liquid then table.insert(br,pp) if un.name ~= liquid then - airtower(vector.offset(pp,0,1,0),air,55) + airtower(pp,air,55) end end end end - minetest.bulk_set_node(air,{name="air"}) minetest.bulk_set_node(br,{name=border}) + minetest.bulk_set_node(air,{name="air"}) return true end From 6ad00e41709befeefd2ba524c3f0c77707f66aba Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 1 Jul 2022 14:43:03 +0200 Subject: [PATCH 29/29] emerge before geode and surface pool placement otherwise they can be cut off --- mods/MAPGEN/mcl_structures/geode.lua | 72 +++++++++--------- mods/MAPGEN/mcl_terrain_features/init.lua | 92 ++++++++++++----------- 2 files changed, 86 insertions(+), 78 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/geode.lua b/mods/MAPGEN/mcl_structures/geode.lua index 81b505558..1a2e8bedc 100644 --- a/mods/MAPGEN/mcl_structures/geode.lua +++ b/mods/MAPGEN/mcl_structures/geode.lua @@ -17,50 +17,54 @@ local function makegeode(pos,def,pr) local size = pr:next(5,7) local p1 = vector.offset(pos,-size,-size,-size) local p2 = vector.offset(pos,size,size,size) - local calcite = {} - local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"}) - table.sort(nn,function(a, b) - return vector.distance(pos, a) < vector.distance(pos, b) - end) - if not nn[1] then return end + minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param) + if calls_remaining ~= 0 then return end + local calcite = {} + local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"}) + table.sort(nn,function(a, b) + return vector.distance(pos, a) < vector.distance(pos, b) + end) + if not nn[1] then return end - for i=1,math.random(#nn) do - set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"}) - end + for i=1,math.random(#nn) do + set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"}) + end - for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do - local all_amethyst = true - for kk,vv in pairs(adjacents) do - local pp = vector.add(v,vv) - local an = minetest.get_node(pp) - if an.name ~= "mcl_amethyst:amethyst_block" then - if minetest.get_item_group(an.name,"material_stone") > 0 then - set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"}) - table.insert(calcite,pp) - if pr:next(1,5) == 1 then - set_node_no_bedrock(v,{name="mcl_amethyst:budding_amethyst_block"}) + for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do + local all_amethyst = true + for kk,vv in pairs(adjacents) do + local pp = vector.add(v,vv) + local an = minetest.get_node(pp) + if an.name ~= "mcl_amethyst:amethyst_block" then + if minetest.get_item_group(an.name,"material_stone") > 0 then + set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"}) + table.insert(calcite,pp) + if pr:next(1,5) == 1 then + set_node_no_bedrock(v,{name="mcl_amethyst:budding_amethyst_block"}) + end + all_amethyst = false + elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" then + all_amethyst = false end - all_amethyst = false - elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" then - all_amethyst = false end end + if all_amethyst then set_node_no_bedrock(v,{name="air"}) end end - if all_amethyst then set_node_no_bedrock(v,{name="air"}) end - end - for _,v in pairs(calcite) do - for _,vv in pairs(minetest.find_nodes_in_area(vector.offset(v,-1,-1,-1),vector.offset(v,1,1,1),{"group:material_stone"})) do - set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"}) + for _,v in pairs(calcite) do + for _,vv in pairs(minetest.find_nodes_in_area(vector.offset(v,-1,-1,-1),vector.offset(v,1,1,1),{"group:material_stone"})) do + set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"}) + end end - end - for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_amethyst:amethyst_block","mcl_amethyst:budding_amethyst_block"})) do - local r = pr:next(1,50) - if r < 10 then - set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1}) + for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_amethyst:amethyst_block","mcl_amethyst:budding_amethyst_block"})) do + local r = pr:next(1,50) + if r < 10 then + set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1}) + end end - end + return true + end) return true end diff --git a/mods/MAPGEN/mcl_terrain_features/init.lua b/mods/MAPGEN/mcl_terrain_features/init.lua index 9ee8ba26f..0c95eb9b2 100644 --- a/mods/MAPGEN/mcl_terrain_features/init.lua +++ b/mods/MAPGEN/mcl_terrain_features/init.lua @@ -33,51 +33,55 @@ local function makelake(pos,size,liquid,placein,border,pr) 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) - local nn = minetest.find_nodes_in_area(p1,p2,placein) - 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) + minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param) + if calls_remaining ~= 0 then return end + local nn = minetest.find_nodes_in_area(p1,p2,placein) + 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 not nn[1] then return end + local y = pos.y - pr:next(1,2) + local lq = {} + local air = {} + local r = pr:next(1,#nn) + if r > #nn then return end + for i=1,r do + if nn[i].y == y then + airtower(nn[i],air,55) + table.insert(lq,nn[i]) + end + end + minetest.bulk_set_node(lq,{name=liquid}) + minetest.bulk_set_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) + local un = minetest.get_node(vector.offset(pp,0,1,0)) + 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 an.name ~= liquid then + table.insert(br,pp) + if un.name ~= liquid then + airtower(pp,air,55) + end + end + end + end + minetest.bulk_set_node(br,{name=border}) + minetest.bulk_set_node(air,{name="air"}) + return true end) - if not nn[1] then return end - local y = pos.y - pr:next(1,2) - local lq = {} - local air = {} - local r = pr:next(1,#nn) - if r > #nn then return end - for i=1,r do - if nn[i].y == y then - airtower(nn[i],air,55) - table.insert(lq,nn[i]) - end - end - minetest.bulk_set_node(lq,{name=liquid}) - minetest.bulk_set_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) - local un = minetest.get_node(vector.offset(pp,0,1,0)) - 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 an.name ~= liquid then - table.insert(br,pp) - if un.name ~= liquid then - airtower(pp,air,55) - end - end - end - end - minetest.bulk_set_node(br,{name=border}) - minetest.bulk_set_node(air,{name="air"}) return true end