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 4375e869d4..f1388a42f7 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 f1388a42f7..34f29e38dc 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 023cd3de9e..f2fb331848 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 2bbcab1cf8..a5a6d7a527 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 3a3a84b928..ed589e75cf 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 ed589e75cf..5bcee086a5 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 34f29e38dc..60555f0fff 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 8910669cda..a82d3f4c7b 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 5bcee086a5..5153e85f98 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 f2fb331848..f538d97aa0 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 a82d3f4c7b..16fd11fb1d 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 60555f0fff..623e518b32 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 16fd11fb1d..8a5d972440 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 5153e85f98..c0167060b2 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 a5a6d7a527..117d8ee094 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 c0167060b2..e2daef96b1 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 0000000000..9398e60627 --- /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 ffc25d40c9..f150721653 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 0000000000..1dc89b7870 --- /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 c19113ad44..823714aad5 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`&4K$Q#8=f)EJHxy&C^JTQ(O6Q9pH#EaJ4~8N)*vY||MD{!<0mN@48}Gz`mj{H zA%B&evHcC-R$~mNrLDeHBeZI@8=F09Woe~P_UG*PefvG3s*i98{Tmn;@g6O&U@5Al+@T%iDA@@Mt;g3VGPR*;&O zN=*}UL?Qv7#rtq%r6zKOLIm+oL26oZl7K6Y<0ULzh#-7GQqvZ_QmIQ}(QV0t^fwZo zn8QmD@DY}OhjGLii;!KSAXUIiPD*7RTr?I6G6Z7khm5t9vXWzB5H^2O_yQs4&?4dY z_yJ|PBS?SX)Pr$i0gFPRxG!$XlJ>u`CFFO^{tq2X6!)RcRO)YWvAxB14=w4*|BsU{ z`YUbK|4ikt<2V1C_A{e-5@Y}n05}56ZeazUHOML>**>X_Z~}@^Gi1hr>Db6>wX3?d zv=|xV;DT~FeOo744u?tjRYX__oR(A|xdsgDq}@kgXW8d1u!U_ABU$lkZ@#g%=BX$rPbQjfN@=2v0L@|Am)=Xo3iEkn8LW7HOu6$;li zij;#oGGM>q>_72)e(II8gek>7)-{bQ0%G6#tv4OBr>`lTB3dec*v06`tEWZ9!(Zwq zU`Ot;<>8k-2+sgtfIENecA%74H`diyy0VIj=PbXqdmhYhl5_mld`ENd(Mo)tz;!P; z-Fa7r)qz%P!76TGL@4I!>rabwO}k5E`X2emeA8h8{ygZKzV_}uv+!h(r@9~H;Oq$U zALMZBEd$ZP9b9c_D=oxV`({>*N$+!HC)VPjy8bcls3=o-5Z>VyYDylgjhTUiXye01A~d z8ER2aG7KSclefWv`2#FPrl20$>FFWa7l=J0IdbQY%-L}z$YHCZ@onL~*yJYlj_mMy1svoiWT%XI zp_s)s7$~Rq5!3?eC)NqyfG#`wjK{c97xzmip_|VV%r9wvcC4-R)CPtF^KVS+`imND z`(LBSSPbw|C%NrGwhFyM#pbeO z;5%f!=2P?L)5mgyZ3^30)fqRE4!`B`;h=kgph|46TM>}yt2q;0RkJA{xh-mnHYvTr zlbj_uOl#Clbpb-L?6Rziv~UG&y`xHW4x)>iIk#`^#}iU}Qf6 zKLa9FHJ`=mdk+p;!gy0^&1*D^3TwCgG=u9eQ4Mt~yh>ii509gF1ADfAqe1*w(z#>5 z#iw5r0uL*Pz)J-01&#E;5kh57+k*_y3mNECYp`=r|BP@yD+YKr;Et~~KG|mEv zpfZhQQ{16n0ag}G>gj-5G|+6WvZ6#D(@hfS&c$&X{HzyV?e_(a0`$^?*_FS{;!q<< z2ULb^?+rF}`C+TlBk5qokW@~bJ8gO(JLvW(>Iw-;{3Q64fu<|Qm%pkCz4-=moW^l0 zg2xfz;c!oe@>&u6^VWG#nT7QFOxr`rMA&=d6F(BZLMHe_6YCgpCDpC)AzY&o)4t{c zPje!uT67r=CDC_1DldW-jv{nNbS+*C>*lD=5%YpsVm(T$+22ZgyoZu52hXx8QpD3V zL<+fWB7m2kS)`7o)-dNEIv}f74p{Kmh?7{d;wvW0#LWNI9v=o-0b8^bi6(BDI&8V? zWRm~>{g0hb3aPd`H=0|!Vy|OOnD#yJJJB4=WX5%KrTUwEtlhD97-XHM!DjDD-F1oy z50{s<`r`$E&X1;o0_pY3g>l%^ zZ3}1TEEBRiNv`S_WVa|$lU;lvF6PkIC|`r!{1;i4YV^_UY@dBk774LmE4$s+TI1I| zntE}uXt0EWJNXoz@n8173zw+uGtGM=8limamkqwLT`hpMM1>KtUzFRfKzcgku`Xs^ z=%^}aQ-jS&jPU!;x{F`P#0MFTgn?L|+PqOl#9-{NW_GRUO0tRZ?NV}vfw+gDv3J;4n1B~R2;lkS&AL|QHN6@_NE*Ts5#-b@#xip%htZcsQniB~GzxjnhJI`4>))Ip{SH zJuF;hQ7`?_hF499&?HK1u!8TMMGS5qYYNG-b8E++>Pb0gW$fZz)m-)9g(Bfxm~CxG zd2vwpZFZ2`v=It;3m9x4FEIQ;Ggfy0iGWMmo4DR|y7Uq;pJ;BbAksRaJi!#Zz5yk? O=Ofi15Yfy7q<;etnMdjX 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 zcmaJ@30zX?+CMBJASxg#sDmKnlA5?=qq%^Rf-P=TE|nl+N?3&JSQ-*4E+vUMwwalf znHH8AHuv6eU$WiOx;dGelVyEQla5m}_F3Od_kMTg`_B2D-}Aoj|M@@9`9JS-mi3&- z^#Bww1B?OFegFFa%mD~5Spwiv_@X%eE{VW9WmjtIH~d}k@gf0W{AKm`1>)z0BtdFg zs&|@%Cl(75;`pDYaj7XhkqE$lA*815+9`;aB=dKC4hWckLQ>O~a;18IHcQz)=dkz- z3SYwG?+_#agulXgl8hyYoFYgS@OSM@jmun0ED~f0B;KD!ai52AyAl%t;un_$fr$6b zlEd%z6B_3VSp0!|XC_MoaWopub?Ksg=Kd%48TlQv`GXfHPW~h_)%$2xKrg6u70xjGJGi1O}Pgn_F;P(T`Qv%w)gjCT@iR<(0(qS-V zHX6}<46$SHtUJw(dnSF$?%rNtZDF6&4CZFx&=d}MY0`CUfbNAI_xIH784))W^!?V`3Jm`N6;pW(#Bb$qrX(LmbH3Hf2j6 zblq-k#4>A0LkYuY%N3_VQ_Uu0`{!`pdR0JFPQmDwdqW*hfRO8@cP?3Eo~J7qsF(gh zq!RHV1iK9kiD<3;Rz>nNfxLN(nq))k@zwPOuihBDDi_ zGR#lB4W^D$hLFL@>*2&bUDS}M4|y>Nd>fJ3av!c{%U^46_zg;oGLH=ON$u6V#0f_` z0s-yoq%;vfH~L$T=gqwxKytTk9a!y= z3(Gy;6zT_?+@wWA7C8vvG<_hBY;zp><7&(BYFSm`Q%+P#DaN6KKoDQCJA$tw;PGM4 zo6qN;BX4jviFj(g?^vZ?wFQ|6JJ)|GQV#63!s6c6w;AAeYG$SNf%QF`HU!8Br-GCq zH!zfaNbv+RKvp)dpL}doXAyhdXs8<3^};SNM)3k;u-wjdt$)}*m4?fR^cCE8FR-Id z*CDl{{F=3AS~k{f$ofv6KUTjY2@1Zqk8(zhMCJr|f$!P`q@3klEW@PhIhl?*+VQ+h zYAg5Wod9LN7sx9qjdx-oo2^fr1Z}F7ZRvyF{H^|*io+nULh=V_Ipm0Pz-j5JI6zBP zKCsEoX=HUYq7)B}BuC|?+*89((GOnm5R$JPD}h9T?&1D~?(jv88|i8XL-fSg$`2-A zOXrc+)vV*^e~XcGWI=EQslKt3He=Mo$iJ zCHmC8Q1nPK(Cz9EX?{+HKu%q=Y!kp7_s>4)t?`huwu?{;kE@@sE@^MDZDA{5lO719 z;g+d@0g7#Xo5n}}_m%oDZ%X%ez*n6>1Sie9>V|CYxtJW>O;N_M48RYILHQQ*;kL>c zk-)kYn_pHJUvLtH#VS1dp~TZ&0=N2MS-lD3=iO0w(r@JW$0{W@uVS8>d);PO(wDMU zlnYUBOB9dhJC&S&-H+gO<%iF6-OVc-$hPf+ovRWL!nd-F@v%ptYW=@g!3@Z#m;rjk=+kR7ebgEuXp0YHoapACzN7d&%|fdj}rdZ= z1$o+P^9Pm^wCObIY{<;SjlLW@(@@%UoJl-M^(li0LjyVx_g+f1_^0@*=oXwQm(+Av zN6*ytNx#A#vnA}VV~dvAI0$#o6{3@|ZHqmlm3c#B$|!mw|EH61?O8}UsJjVXt%W@3 z`}K}hdk^sJS+O_kg0$r}DTO|xzGko4+J0M#Psv}vJ@xTUT8V7@9(ptPvMb6Ma7;(1 zuvuI9p{jNE&iJZrTZDv~2C^ElGxdmO(qQSWb;T^n5N(;}i}ue;XDBP|q1B;Kb+Dgo z8I+}8S8BtlgiG(cu$&XRuyI0QZXb7IU~kqitw<&ytNmE|iyYX1m%@wAC2#-kt3+2iM7||CntGz5*R+vexP@27}?7 z?}XrzAWxET{+-NbWG&3NNOIWg-bi=qAGQzYQP9JKa3m3+X*y1E`q(vg_ z*IwLjWiIRQ`A}cACzp>X<$DOujp8~^e5d&?)?%>n<&Pgel;@Cr3P@%if?+sjnEh z=L*e|!ZL^UADbq<8f&v$0r3QgMsrGK{l#E*j%Ms!?@`Itr($I=YYP*^|nsBEZmL8#UzpfaAm6&Kb{R`xp8+fCXgA-s&*5- zkOl03GyGMbp*yTmdV!3%5X<#+Bkdt%9s^cxbXOj=Z61M@d<`29D9>Zje^xg3T9jw$ zy$U}{8$15iTCKTYceX6>b^AdErW`ewRldPjcz0Xb8t05q8mcmP)tMh=<=&j)Fv7;N zm3??_ZcoI+;o*q}N;qzUW`5ro6==kT0#EekqSTt=_%7p1WF^f1%UN?MgB0|J6_R=<#X=_VfR zk!nUkb1iNuT4S);5oPeol@(4=nXwu!jLMQvwXa5#`xO9-+;0zl>`(2m4~Q6YrEn-s z9Yh6(eO1Y0^2&#fUMX!-V55L<=1 zL+3N+4I{$%bCiH;1l#h+Iv7l-Pwk{1Rw>hpX1>aLYqAF0z0?_Ci|RWH*10|bVhH;V zSmrO)Z|nhi9Xa$80oiwO&8_b>N@gmU;&dIY`k8P@<@q|W9O2MRlOb2v%|hB@t+aOL z)KZp;9;(=HoQo0A*{X4+lFN*)b~Z8~R*>=v36caJf(3&$=G$dIGw`&$%!IYNqg%_Z z%d4h~ii)_*c(!~H6@_$8s&eJt>>KGswM|m25;bVs6@&DKBZ#bn@08FZ3PR!_iYd?^ z^5|EvRHdaO_o$TaCGHQdHYuM6Hw5R>|OE*h%T>2Q#CxqI&lf2AFpVx3?gvH4-Xkn#_ zT1Y$Cl|Smjs_je1hgSwj%!=Ez;8MhJK_pCAp(;gj^u!aawW^U(AXKFs%dZSlR3KX+ z@fhJ-0W_arn&U}&&F&k~dk-(bQ^a!k*FRi!wAOQP<{{js=%Fhd~ zQE)5fb+dwaY&(9C86p%%imiUo^9xrL 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 23d93c712a..ea051603fc 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 9398e60627..fed97f047e 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 1dc89b7870..a8d93ca5de 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 f150721653..176c09acda 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 0000000000..53115d38f5 --- /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_pOctZl3J99`!6F|7+v!EgE_B=*ceNSK8>^} z#K77zQj1H9t&%}hd~t4KP7add;)0^mWU%6jIZp!u#SSZQGb!-CQ~{7){=zAyEP>r3I|mjy>tGNUvWSLLiadE@4V z>nWAF(mh3K4`Y{_KTCUF@;*RJCV&6Ydu-v4vX?|2NSs;w=SxlLhckZaZ~pbo=<^kp z{ynuXF#OZ`>Bmy%n&?XB{jmGO@o0hK_K3r+oN8T@?mTYFmv~rnJY`D9c^h%H>eaC` SCO++6RPuLsEhEE1yFUPCvaDYK literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_3.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_cold_3.mts new file mode 100644 index 0000000000000000000000000000000000000000..67cb5c9acf2f84f69df5514dcae3bc53e2f35e08 GIT binary patch literal 697 zcmeYb3HD`RVGv+oV-TnZ0|s6O=ETe*2L9aSocQGYqExH&qQtV)90p;yKygWaUTRWN zW^y)z1Qx;E{NmzD20m07B=eHU0wB@6)RK(UBCFiQ^xQ;bdkcz6 zlT*v{^HUgj;hKvR^HLbZz}$?~;*w&kWDpf!oST?~?B=Y}y!0H1UP**rxJQx`i^@_{ zD(1YM)?L=Dz~jKoBzybc%=mbYiPL{%bnDuFex^}zVL}TFivkPx1=c(NMO;KAtAn34 zKMG6xer2CDqtwxW)nfA)sus<@@9SKlpk-K~d{Kv!Gv3vjO~^Iyk8X9sL+Q8MuWUYA zZGUI;9qC4!Z(_wxg@1xw*+u#!U#a@LEjT0B85XrCyDBJU;~K59x>*5Ur#`B7?SI`J z$FbmUTh`5Yb$7*uzwcVi(Y1a_hSaK-8e6ZXci-}!%)HTNnzAglw&rhjL;MsW@3Pw( zNs0SoPIjdJv+2LNWuNbj%vZHrwlY=!+-okEv)kNxn_R{Na!eBoU6rKs3FVuz>w^6>uGEO2qU!2e3o zWpD0T_sgrhMisYC4eRf7KJfFK$ydSuGV6BU4&7UREB3kmDA)l|6j0o_dgZit^baHD*k(R8FTsV-G+tQc7HRjU9S{& mu(qEc!he)y=D+1vk0N&yy literal 0 HcmV?d00001 From fcb8160a60033013ea43698a1cbb4650b28e909d Mon Sep 17 00:00:00 2001 From: cora 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 ea051603fc..0748101862 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 e2daef96b1..ebdfdfbea5 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 fed97f047e..27e5ddfb98 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 a8d93ca5de..1a7a620fef 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 53115d38f5..1e477c3c21 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 1e477c3c21..1452de64b7 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`RVPFMfj(Q+q;9y`*%q(Ky%}vgUPtGq&wJJ``OJNW~;TD(V=cO`8V2ULt z7L}!@Fo?rt(u)%FGD}k9i*xhyOER!&fy#)1wPd6gmlRtigD9Yu#GD)k0g!lJYDq?F zkyUPDdTwIHoTU>Y`5F{>T-t-a-q^dVgm=dge($V=in)P|CecwXc2TSQpItbyB}{wu z^}N+;%0F6*w@sg4++v$&A+c9cd8&n8UCGD8XZ4GBYRKIYyZ8RSW7#FkW542!O3#&f wxqNE8(Rm|MbcfESEaB&m*PUPvzs#{t=z5RAnd=<_f7XBN{j)-N*G0|$0AehGrT_o{ 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?P6ewjMUr?U+F2HVH+j|Unfyy%eXUuk_H9vV z?YyIfS@X6p-7a+Z$liT#Z^=*P){sb>_)^@d>UeD^L;j{6_U8OM%S|sa-CQiW;(7J| Q{Mye(GYgouOgG*R0OM1L#sB~S literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_3.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_3.mts new file mode 100644 index 0000000000000000000000000000000000000000..eb43cdf1c8166d40c9d902e56802f5812ed76449 GIT binary patch literal 536 zcmeYb3HD`RVGv+oWe}(b0R~P6=ETe*2HxD{ocQGYqExHm#Jm&+aX2@Pxo0y)P$RGh%3es6zlAo6fRf|O?IkBiLHHAS4QxAg}SS%y8 zxTM%B8AJiCOw7q)5Cw_nC#NRnSrw-y#^)sFm82HsRm^!C9x2wWz{7H%fK4?;BrA2QPdp8!U5vHSbLR8G+ep zpHpjtFR8ir@9%xBy>MMxjAhKGcbo5Vt;*?nFiE8CYH97I-{&;zG&hHcpM7Uo`)-L8 z-x-FlJ4KEj%((fNeFOXNx`{^Cr3>`kh10~Il`A}-&eZ?m&(&uyJLbf{e9d&;`#^!i z{hOB$DE?+no_@OJO75>|-Cxgc+!1p5^XnsTFL#u&34B!4qQGH@1H8tVYANuoMSCh zeC+&V?&5MR4}N==mDbzNc=k`LHg^8;_9xvx3U|$TG`S|_b5OnQ-Sa;u{Sqoob~8Ct aW|eU3rd&zyt@=sq{BkA_c?0*(Wd;BW*z*zq literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_4.mts b/mods/MAPGEN/mcl_structures/schematics/mcl_structures_ocean_ruins_warm_4.mts new file mode 100644 index 0000000000000000000000000000000000000000..0eb5bacf0671bd7e33768d8e9e2320d819a6dbf1 GIT binary patch literal 390 zcmeYb3HD`RVc=q5W#Fm@0R~P6-rVGz_~iVeRIB2|yc7oJ#LOZF2^6v7lKi~X*7ccfb&CIAUQ}tT# zj;lQ(UnPx}TI&{nT-%a(@ZvkZxnH=}Ppf|S@NG7)!6BE^#}9C1i*Gw+;#BAVsAqZb z_5D+CrwMVErk{J-^;=`%4BKjEHl?Rac#j_RIHa((Ins&2`l-T8`$^_PAzNKqwpE2q od9!mRm*efqHpS?K%smMT_EYcr$1dJ;DfDf%-=8>RIe)uT0JD#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 ebdfdfbea5..14dda38f85 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 1452de64b7..256d4bb8db 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 117d8ee094..9b5502bbf0 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 14dda38f85..5c27fbb8e1 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 623e518b32..bf3a846a2f 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 f538d97aa0..e4b6bb85b0 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 9b5502bbf0..b064c6d736 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 176c09acda..12b9fc2486 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 e4b6bb85b0..2914d148f0 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 c03173367d..d0f0e0cabb 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 d0f0e0cabb..a1ea0b6316 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 b064c6d736..25065be2a4 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 5c27fbb8e1..d9ab217020 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 27e5ddfb98..ddacd83d2b 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 12b9fc2486..a8a2d9b1b7 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 1a7a620fef..aa5bf94127 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 256d4bb8db..dafc2dfff0 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 25065be2a4..f9745b4719 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 d9ab217020..65532b2453 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 0000000000..15363be51a --- /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 a8a2d9b1b7..809448d2e0 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 0000000000..6c2250b766 --- /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 cccb57108b..0000000000 --- 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 65532b2453..dc1f905f2c 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 a1ea0b6316..81b505558a 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 15363be51a..d364ec4929 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 809448d2e0..d54fc2dea8 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 aa5bf94127..1ac3bd1b47 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 dafc2dfff0..df0a740f98 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 6c2250b766..68b1c68090 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 a3861a2c92..0000000000 --- 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 79940c7448..0000000000 --- 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 dc1f905f2c..f0c4fa6a5c 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 d54fc2dea8..a996e440ab 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 1ac3bd1b47..aa5bf94127 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 0000000000..72823d8113 --- /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 ddacd83d2b..2723108025 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 d364ec4929..49e3c879ad 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 aa5bf94127..d421ba5b0b 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 df0a740f98..0b609aee71 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 68b1c68090..6a10e7a91f 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 f0c4fa6a5c..596c493a93 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 2723108025..61daaf3385 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 a996e440ab..3a778b138c 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 d421ba5b0b..843dec04de 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 6a10e7a91f..039c463323 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 596c493a93..4e017b502b 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 3a778b138c..a77b3dbe4b 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 zcmaJtc=E!0f?zPLZ~?d;Hfwq8AO=r19&O}L`7g3Bqjp{5lH&s)wO5Sa=X%GO#rL1wf^N6vV3k$)ks5Q>hV%6@Lzq zvAA~(EMsX{3J9U}J3zrQSqv;0h$Lf~^Q0p{kOt{I9l>`egt;DSjx>(Qz!T=+=Q884 z3h{CqQNCYM=kMKzdF%V4m@uobUC)6R=Edc$L!E z)m*|aQd%S@#azE$IE*}aHJvWp_vOyP#Co;+dZgiFmYgx<(~1e{jLE6R@b@^Vs-3&1 z)abJSe=wjcf3|?+Q^>P%BBoFGqNG7e++J~|?8g@zORf|nTsQH(a_o>`fMZ?y`OY5* zIi;6cdPh$jIVSvMo0wWV8FI&sMn^qlf#uI8t)|tt>-XJA(JFpbCM(@LGlsTgk2;Lj zSNnpeTV>8^B-wpWBUs&4?z|+@rtY_JDd}06&0F8%xO6-aM4xRwOql%ER~ycp8(n>M`W?u3i`6W#Xw+pofOps{-Ic))-nAl_`1O;^6%hdi&az3R_c z7|zIMO#XQ!k|^dgx1zf|Uv}j2v)-~vJ45el%pt1)hmn(oTdvam+;bD`Grzh<%G{n` zusi9+)cDP#V(C(FRF;-mZl3ga2%`RuyyaqZb?dMMTD9)7U9*-I7v2Qq8lY(60A_=Ol zLv}>cy;7^zKC%>Bd9h8#T1&8E(Ss=t5)?~!=S*B71w!&IugU9Li3>}Frp%^ZZD#=c zPO{9P^l!$C2APfgGd#J_F&W!}Njv4Gte&u%82c{!&XVn?lHBPHy%(!q!2!>|Uj)}q z60Bi-Pv7L=?+!VyVBZX0r>jpmbvWfT>}!lVK}Wj5D(yitnD}XTrK+RyjITv7L36HB%v@rE5^hFyH)$cKP<_7QZ0r zys+zw^PD59MuenV6hiT6SxHK6am{bE{ zoznbGWBkO=c6?%*0G;;7ZKB(50AO>^m95`i4C)bZWmRY+^a@&JB*(VyT;HM5%?FGU z%DwHw*>_c(siEkLfHd;}PmcMPe|Dy#CTDcLr-Y}OL2)S+$-v&>mGN>5AS4r#yR~`W z@V?RL^4t{;Tn>0Fj{`i^s;Sq>-F(xiZ0%*-wYrdP_+7m8`x*v!I!-ddvlP;K8oM?B z$mlZ?+~S%Qx*$99MaKbY$7yB$sTgO{neONV%AsBm#Q%?+V4%gDXa!x64cBf{NO(g5TCI8@ zencHEyyd#L)G+>Ej<)_2n4ojo#H<+g8gPTTOT`0G=Tgh$If!VZ7cZCJpWT@@Pk3?}_@nkRp;KTAARF@2;Z z=??b`5ghin~V`sUBsLMt;29H)Xz#fti#f`*~41OpMfrZUY_G+xv5aw*+1 zp6h(eMipQl{;nPC^y%*>jTlIvFa|K1aa((;lrrXeL|6OgPUh&LFbes0!Mt2AM z6^!b^+zfXAIlo}M%lg|F{O!?=9|cPzzbiSUHrf`9k!oj+6un^p?*_6S$P_?<`= zPSbVsM4t4y-N{LekAPF=2d5>V3yVJxdoPB0<;Q`Q?pRjrSr23F50%EfcA4&0*}1$f zEJ`eBOQXxj{1{&GF|pz{e9nREV4_Q~!r)ljU~?<4TD1+Y_FFCTsD+)69gBo)tjepb z!~`{=?nz*8gPJQS_ilSkl!SMNbvqhLM&1^eaFhz$rjlD8iDW^2LB60ZuRjvqkZbEl z^D?WwJB8k@8Oft@O8~?B&wAXVSqDE>*hrNWi_vnEX(*WO)4uhBvgk?RkwZ4W+lrz+ z#)++sfq02FY456~UzR<_Rn?@oZH$so>`gzSbFURKG3-py;p%(ARNJ)!p+BOjhOb~} zr&oouD|V4h)%S)BTNOc~IGHRBkR0_EHph8EodV(PvZv84=~pZ zv#$b;{ji~^(pfNrBCu0%JdJIhNnuh^zCCxbrh~LoyD^H}@36ry*)-mf=n`Ss(xJRj eVEa;_+r6hNh|^bsCGHrP-pwD)8eHa&J^c^W-au>s 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>dmvQ#9zT_oL>omC+S``3*1MFM?z+^jlt&(|5>98%91O>tab`SgY_hxMkydT= zVC=G@^@zr!yo$;!c|?UV9!qIThFnDv-7{xUc5i$BIOq5KzR&0T`F`zPUF-olKpjv4 zRKNS%15kiP5CaER2f!%kjbb4P&ZcmJPzDRc5jwEu?_vyxm_Eo~93T|+!67yq_*CkE zLQD>VGuae27BqJQVT6G)m_C4#)C9(Ggc8hPB7n*~57-xCFaZrREy9EmHiZu1{vZbV zgWl3RuyW2@s^H)VA}f;3A%26%h(a__stLg`x-8DDMr!b0wN4smR`sD1$iY~^+PN%j z4$fe)5IX58tpiXCWkF1$FzFklp%6@zhC&<}BC`?6WMmEV3noRXA4JEP2n}bz{=lj^ zVF1Qvhrt+)h9dI{nKgxRBIj&#NFdpqSsm#MsFAUJ5jKZSfu$di9YC}Q*dUe5y3E1| zo$Lq_XX5vmbOdE!OhD)3Ml6iQ3IjHN+<=A#As~jsz6`nykD2mjFqFdgzWsCt&H+d) zXc*?trjT!61oZ~U=FG8Z<}gQ~f5;Do2jSAD1R)&Y6S7PhiDcZ_^zp)Fl%L@?*$Qt6 z45SsI^2)CZLg+Xp;i;XyD$l1o!+G>?Yt_ezqC^D2pSTc;!6aZ zbt5+nDfS_Tb}kwzCOJAwRTS~&{2vD63?JW_AtNCOfruRg5*r35wgQO+8JyT!vl(UW zAa~kd+3roOC)sTMjb+44U^rkzK!Ly*lMS+Pgv};c#Uf^0I`uPGki3ILPCAHrdjllw zGF0X^7KsTBH2JuaLn!C1-uGijl4brzW)VaK)Jc-fZ0ZmA9-1uijI|b-uUcKuFUOKs z+LU8F_O!V8pr|4hECEwrUG);zIq%Y3O7WwKC-x_Df{q|x>&00m=P&k8Zc@7RZ$@F2 zk20#3vVDk8Jzent9m-Go?BXKxlRsq?yVlw_ex;dIZa};8*lDQXdST|>p{w_|G~Cjo z!s43|Uv)T|HQJ86WjFFe7p8eNxRzPGdZE|fpK^E0bZyk|#ZE8ZJwNyT_vjveQ_VD6 zZ6mZpoU?z${TTX{D#Zek9JSRw>5yRHnM!}WFqT{dT~M3YfZ`qNr-cWR)WwbQ^4jnttXdXkr3+Mvnc@raIy z-1}Qip|K8&=MU-JvvfsCGS${scb|%-^I1kF=eO_s6a$RlqecdRu2y!8=6KxiVO> zq|HcyT3nd|={QpZJ9ja3ze=Pf`ROj<=BL1;H1pQR6%(T=x6D~Zw_*k8!rfc06dil2 zB04dWZdcINQ1;o-&nI7aoa{6y+4rOn7GzXv@q6N%e#auas@vkZR~wogw%!_TiWUp| zb{(^UJmNcWo6z3{Py7VKJ;Q1EjihKsBCW^g!T5+kO9bZzKUFE4n!I%`Cs=!0&ZRCd zaLMHbr>eJAnX4`E7ui!S3sME$qp^cK2989I54xT2_D{?%?0GyntSk};xZNh)I&QZR z?6h)x%Ith&tQs;lUhX1Z<~)k}{n$|d%dfj=m6Jj_vw+JQlFl&m^uka>yTaDo*2Y}4 zq8myNGdFY0EoP6RC+wT}Zyw!Aw(tX~m&>?s%U#qo_uAGy*jsdFVT;3~a{cvNJXG`* zx0$4$tctDd>2+4k3zomUGV=ALR@HRW8^704PCdg*$2@OV!ULMh6O&qQ)IAOHPH9>t zg34wi*in!YHkldTU0a}&87#Nf(Q1I2tWGJ;3Mu_Ad*4#GaQn!Z-IE90Zf5$9#7|jN z;;pN5HclGVdYu_;g>Q_ur$%@#s0Jh%Q-apSNH2A@4Mo-l-}wFDu5rf1KH!hYm!!*qfu)Noq{ z&sma{a8JuCmseK7j|WMi~R&Wjr|fVb(zT1e{bNC6L56FIpHObrZz9< zk@9coD`ec4H>0 zjqpU;qt>^dmBXb*V-A*{vA#u1UJhxBPmgwo9Tg_tDdP*fY@VkWcG$iJmRp_u!4czG zC=8~&3`(22dLtHp+d&tQTJ%kIrBNXc@?o3*+xW@Z-P#(#FO<8E{XzZuS9(uJf|7p4qlCK)mm?9$9l}~_ zucKb3odeCET9I+(>Dcf($>u+A_gx$1*ev#~e}ddNS6t@5qz8 zuU^r9^BpC!eqd$FWa~wTp2}iToLFl)t<(OzqF7k0=6IiaV9iZlbryd_hh-v8R^_dT roJJoX3cr0VP@J`|re(10=jWCa>Ykfx3c@neh^H@f#L_G6?&bdh=AZnz 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 0000000000..b4b54f5fc7 --- /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 b4b54f5fc7..d47d4a0e65 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 61daaf3385..75c170ab1f 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 bf3a846a2f..9ee8ba26f5 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 81b505558a..1a2e8bedc3 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 9ee8ba26f5..0c95eb9b2c 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