From 6a832fffdedffaa2a56308005504366a5f1d353b Mon Sep 17 00:00:00 2001 From: kno10 Date: Tue, 17 Sep 2024 21:08:24 +0200 Subject: [PATCH] more structures, more to discover. --- mods/MAPGEN/mcl_structures/campsite.lua | 71 +++++++++++++ mods/MAPGEN/mcl_structures/desert_temple.lua | 2 +- mods/MAPGEN/mcl_structures/igloo.lua | 2 +- mods/MAPGEN/mcl_structures/init.lua | 2 + mods/MAPGEN/mcl_structures/ocean_temple.lua | 2 +- .../mcl_structures/schematics/campsite_1.mts | Bin 0 -> 237 bytes .../mcl_structures/schematics/cocoon_1.mts | Bin 0 -> 190 bytes mods/MAPGEN/mcl_structures/spider_cocoon.lua | 94 ++++++++++++++++++ mods/MAPGEN/vl_terraforming/level.lua | 2 +- 9 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 mods/MAPGEN/mcl_structures/campsite.lua create mode 100644 mods/MAPGEN/mcl_structures/schematics/campsite_1.mts create mode 100644 mods/MAPGEN/mcl_structures/schematics/cocoon_1.mts create mode 100644 mods/MAPGEN/mcl_structures/spider_cocoon.lua diff --git a/mods/MAPGEN/mcl_structures/campsite.lua b/mods/MAPGEN/mcl_structures/campsite.lua new file mode 100644 index 000000000..35a61e591 --- /dev/null +++ b/mods/MAPGEN/mcl_structures/campsite.lua @@ -0,0 +1,71 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) + +vl_structures.register_structure("campsite",{ + place_on = {"group:grass_block"}, + flags = "place_center_x, place_center_z", + chunk_probability = 50, + y_max = mcl_vars.mg_overworld_max, + y_min = 1, + prepare = { tolerance = 1, foundation = -2, clear_top = 1, padding = 1, corners = 1 }, -- low tolerance, perform little terraforming + filenames = { + modpath.."/schematics/campsite_1.mts" + }, + loot = { + ["mcl_chests:trapped_chest_small"] = { + { + stacks_min = 1, + stacks_max = 3, + 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 = "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, _) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:chestplate_leather_enchanted", weight = 3, func = function(stack, _) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:leggings_leather_enchanted", weight = 3, func = function(stack, _) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_armor:boots_leather_enchanted", weight = 3, func = function(stack, _) + mcl_enchanting.enchant_uniform_randomly(stack, {"soul_speed"}) end }, + { itemstring = "mcl_bamboo: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 = 1, + stacks_max = 2, + items = { + { itemstring = "mcl_core:iron_ingot", weight = 90, amount_min = 1, amount_max = 2 }, + { itemstring = "mcl_core:iron_nugget", weight = 50, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:emerald", weight = 40, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:lapis", weight = 20, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:gold_ingot", weight = 10, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:gold_nugget", weight = 10, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_experience:bottle", weight = 5, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 1 }, + } + },{ + stacks_min = 1, + stacks_max = 1, + items = { + --{ itemstring = "FIXME TREASURE MAP", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:paper", weight = 20, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_mobitems:feather", weight = 10, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_books:book", weight = 5, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_clock:clock", weight = 1, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_compass:compass", weight = 1, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_maps:empty_map", weight = 1, amount_min = 1, amount_max = 1 }, + } + }, + } + } +}) + diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index aa38df4fb..9f90c4b49 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -32,7 +32,7 @@ vl_structures.register_structure("desert_temple",{ place_on = {"group:sand"}, flags = "place_center_x, place_center_z", y_offset = -12, - prepare = { padding = 3, corners = 3, foundation = true, clear = false }, + prepare = { tolerance = 10, padding = 3, corners = 3, foundation = true, clear = false }, chunk_probability = 18, y_max = mcl_vars.mg_overworld_max, y_min = 1, diff --git a/mods/MAPGEN/mcl_structures/igloo.lua b/mods/MAPGEN/mcl_structures/igloo.lua index 5317f8d83..91d71e563 100644 --- a/mods/MAPGEN/mcl_structures/igloo.lua +++ b/mods/MAPGEN/mcl_structures/igloo.lua @@ -78,7 +78,7 @@ local function igloo_callback(cpos,def,pr,p1,p2,size,rotation) end local path = modpath.."/schematics/mcl_structures_igloo_basement.mts" vl_structures.place_schematic(bpos, -1, path, rotation, { - force_place = true, + force_placement = true, prepare = { tolerance = -1, foundation = false, clear = false }, after_place = function(_, _, pr, p1, p2) -- Generate ladder to basement diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 9c323fac2..d2b16fa47 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -27,6 +27,7 @@ mcl_structures.register_structure = function(name, def, nospawn) vl_structures.register_structure(name, def) end +dofile(modpath.."/campsite.lua") dofile(modpath.."/desert_temple.lua") dofile(modpath.."/desert_well.lua") dofile(modpath.."/end_city.lua") @@ -40,6 +41,7 @@ dofile(modpath.."/ocean_temple.lua") dofile(modpath.."/pillager_outpost.lua") dofile(modpath.."/ruined_portal.lua") dofile(modpath.."/shipwrecks.lua") +dofile(modpath.."/spider_cocoon.lua") dofile(modpath.."/witch_hut.lua") dofile(modpath.."/woodland_mansion.lua") diff --git a/mods/MAPGEN/mcl_structures/ocean_temple.lua b/mods/MAPGEN/mcl_structures/ocean_temple.lua index 73aa5b270..5888d2a36 100644 --- a/mods/MAPGEN/mcl_structures/ocean_temple.lua +++ b/mods/MAPGEN/mcl_structures/ocean_temple.lua @@ -81,7 +81,7 @@ vl_structures.register_structure("ocean_temple",{ flags = "absvalue", }, flags = "force_placement", - force_place = true, + force_placement = true, prepare = { tolerance = 8, clear = false, foundation = 3, mode="water" }, biomes = ocean_biomes, y_max = water_level-4, diff --git a/mods/MAPGEN/mcl_structures/schematics/campsite_1.mts b/mods/MAPGEN/mcl_structures/schematics/campsite_1.mts new file mode 100644 index 0000000000000000000000000000000000000000..5f8ff4bc3c0de05389ecb1a5fd61e361efb8ffe1 GIT binary patch literal 237 zcmeYb3HD`RVPI!qW?-$auLm-e%5vf}@^f4<@xzJR^=I)C8-PoAbwhEUUF)&6_{d>1BoPOq!yPHTa^?gf=vN) zb8;BO!19T?1!DJo1x z#v2$6d)i~=wWp*x2XS8Pj+Hm=^2$jQdV8*_icwBZj_pmu#03m`4Oe{_UVkz92mo># BR7(H= literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/schematics/cocoon_1.mts b/mods/MAPGEN/mcl_structures/schematics/cocoon_1.mts new file mode 100644 index 0000000000000000000000000000000000000000..eafe17ddf655ab52c3116e6c16ce7ec93c2a25c5 GIT binary patch literal 190 zcmeYb3HD`RVPIuoXJD;|03e4sF|&w)KQ}oiJ~_WA)hanZsXR4_fe$25o}Zs%Ri2Sq zlFA?s;^*ck6&ECy=cN`ETR|BNVql#asl_G5R>>eLzBo5AC#Paga>4;diI1B$tW0k? zrM!8@hfNZOK1Z%_FPeEUN1&VaT$0nI_L+xVLbpHoq;4lB7trseaOCytj{+;aUIj9S Yc-j^&6L=_gi{TN|v=Rme=@p980Vat`7ytkO literal 0 HcmV?d00001 diff --git a/mods/MAPGEN/mcl_structures/spider_cocoon.lua b/mods/MAPGEN/mcl_structures/spider_cocoon.lua new file mode 100644 index 000000000..e37a594be --- /dev/null +++ b/mods/MAPGEN/mcl_structures/spider_cocoon.lua @@ -0,0 +1,94 @@ +local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) + +vl_structures.register_structure("cocoon",{ + place_on = {"group:material_stone"}, + flags = "place_center_x, place_center_z, all_floors", + chunk_probability = 20, + y_max = -10, + y_min = mcl_vars.mg_overworld_min, + y_offset = 2, + spawn_by = "air", + check_offset = 1, + num_spawn_by = 6, + force_placement = false, + prepare = { foundation = false, clear = false, clear_top = 0, padding = -1, corners = 1 }, -- TODO: make clear/foundation not use grass + filenames = { + modpath.."/schematics/cocoon_1.mts" + }, + after_place = function(p,def,pr,p1,p2) + if mcl_mobspawners then + local spawner = minetest.find_nodes_in_area(p1,p2,{"mcl_mobspawners:spawner"}) + if #spawner > 0 then + mcl_mobspawners.setup_spawner(spawner[1], "mobs_mc:cave_spider", 0, 7, 4, 15, -3) + end + end + -- p2.y is the top slice only, not a typo, we look for the rope + local cs = minetest.find_nodes_in_area(vector.new(p1.x,p2.y,p1.z), p2, "mcl_wool:white") + local rope = {} + -- TODO: port to VoxelManip? + for _,c in pairs(cs) do + while true do + c = vector.offset(c,0,1,0) + local name = minetest.get_node(c).name + if name == "ignore" then break end + if name ~= "air" then break end + table.insert(rope,c) + end + end + minetest.bulk_swap_node(rope, {name = "mcl_wool:white", param2 = 2}) + -- remove some of the spiderwebs to add variation + local ws = minetest.find_nodes_in_area(p1, p2, "mcl_core:cobweb") + local clear = {} + for i = 1,math.floor(#ws/4) do + if #ws == 0 then break end + local idx = pr:next(1,#ws) + table.insert(clear, ws[idx]) + table.remove(ws, idx) + end + minetest.bulk_swap_node(clear, {name = "air"}) + end, + loot = { + ["mcl_chests:chest_small"] = { + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 2, amount_max = 4 }, + { itemstring = "mcl_farming:potato_item_poison", weight = 7, amount_min = 2, amount_max = 6 }, + { 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_tnt:tnt", weight = 1, amount_min = 1, amount_max = 2 }, + } + }, + { + stacks_min = 2, + stacks_max = 4, + items = { + { itemstring = "mcl_core:iron_ingot", weight = 90, amount_min = 1, amount_max = 2 }, + { itemstring = "mcl_core:iron_nugget", weight = 50, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:emerald", weight = 40, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:lapis", weight = 20, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_core:gold_ingot", weight = 10, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:gold_nugget", weight = 10, amount_min = 1, amount_max = 4 }, + { itemstring = "mcl_experience:bottle", weight = 5, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_core:diamond", weight = 5, amount_min = 1, amount_max = 1 }, + } + },{ + stacks_min = 1, + stacks_max = 1, + items = { + --{ itemstring = "FIXME TREASURE MAP", weight = 8, amount_min = 1, amount_max = 5 }, + { itemstring = "mcl_core:paper", weight = 20, amount_min = 1, amount_max = 10 }, + { itemstring = "mcl_mobitems:bone", weight = 10, amount_min = 2, amount_max = 4 }, + { itemstring = "mcl_mobitems:rotten_flesh", weight = 5, amount_min = 3, amount_max = 8 }, + { itemstring = "mcl_books:book", weight = 5, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_clock:clock", weight = 1, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_compass:compass", weight = 1, amount_min = 1, amount_max = 1 }, + { itemstring = "mcl_maps:empty_map", weight = 1, amount_min = 1, amount_max = 1 }, + } + }, + } + } +}) + diff --git a/mods/MAPGEN/vl_terraforming/level.lua b/mods/MAPGEN/vl_terraforming/level.lua index 074f91294..643c1ab37 100644 --- a/mods/MAPGEN/vl_terraforming/level.lua +++ b/mods/MAPGEN/vl_terraforming/level.lua @@ -256,7 +256,7 @@ function vl_terraforming.find_level_vm(vm, cpos, size, tolerance, mode) return cpos, surface_material end -- well supported base, not too uneven? - if #ys < 4 or min(ys[#ys-1]-ys[1], ys[#ys]-ys[2]) > tolerance then + if #ys < 5 or min(ys[#ys-1]-ys[1], ys[#ys]-ys[2]) > tolerance then -- minetest.log("action", "[vl_terraforming] ground too uneven: "..#ys.." positions: "..({dump(ys):gsub("[\n\t ]+", " ")})[1] -- .." tolerance "..tostring(#ys > 2 and min(ys[#ys-1]-ys[1], ys[#ys]-ys[2])).." > "..tolerance) return nil, nil