reorg terrain features with biomes

This commit is contained in:
kno10 2024-10-31 18:27:21 +01:00
parent 3c36131cd9
commit dfeffc8522
40 changed files with 525 additions and 526 deletions

View file

@ -220,16 +220,16 @@ local function sort_decorations()
for _, key in ipairs(keys) do
local def = map[key]
if def.name and minetest.get_decoration_id(def.name) then
minetest.log("warning", "Decoration ID not unique: "..def.name)
minetest.log("warning", "Decoration ID not unique: "..tostring(def.name or key))
end
local deco_id = minetest.register_decoration(def)
if not deco_id then
error("Failed to register decoration "..tostring(def.name).." - name not unique?")
error("Failed to register decoration "..tostring(def.name or key).." - name not unique or schematic not found?")
end
if def.name then
deco_id = minetest.get_decoration_id(def.name)
if not deco_id then
error("Failed to register decoration "..tostring(def.name).." - name not unique?")
error("Failed to register decoration "..tostring(def.name or key).." - name not unique?")
end
if def.gen_callback then
minetest.set_gen_notify({decoration = true}, {deco_id})

View file

@ -31,8 +31,6 @@ dofile(modpath.."/desert_temple.lua")
dofile(modpath.."/desert_well.lua")
dofile(modpath.."/end_city.lua")
dofile(modpath.."/end_spawn.lua")
dofile(modpath.."/fossil.lua")
dofile(modpath.."/geode.lua")
dofile(modpath.."/igloo.lua")
dofile(modpath.."/jungle_temple.lua")
dofile(modpath.."/ocean_ruins.lua")
@ -43,24 +41,3 @@ dofile(modpath.."/shipwrecks.lua")
dofile(modpath.."/witch_hut.lua")
dofile(modpath.."/woodland_mansion.lua")
vl_structures.register_structure("boulder",{
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = {
-- small boulder 3x as likely
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder.mts",
},
})
vl_structures.register_structure("ice_spike_small",{
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" },
})
vl_structures.register_structure("ice_spike_large",{
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = { modpath.."/schematics/mcl_structures_ice_spike_large.mts" },
})

View file

@ -6,31 +6,28 @@ local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local function spawn_witch(p1,p2)
local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"})
if c then
if not c then return end
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"})
local witch
if not peaceful then
witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity()
local witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch")
if witchobj then
local witch = witchobj:get_luaentity()
witch._home = c
witch.can_despawn = false
end
local catobject = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat")
if catobject and catobject:get_pos() then
local cat=catobject:get_luaentity()
local catobj = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat")
if catobj then
local cat=catobj:get_luaentity()
cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}})
cat.owner = "!witch!" --so it's not claimable by player
cat._home = c
cat.can_despawn = false
end
return
end
end
local function hut_placement_callback(pos,def,pr,p1,p2)
-- p1.y is the bottom slice only, not a typo, we look for the hut legs
local legs = minetest.find_nodes_in_area(p1,vector.new(p2.x,p1.y,p2.z), "mcl_core:tree")
local tree = {}
-- TODO: port leg generation to VoxelManip?
for _,leg in pairs(legs) do
while true do
local name = minetest.get_node(vector.offset(leg,0,-1,0)).name

View file

@ -1,361 +0,0 @@
local adjacents = {
vector.new(1,0,0),
vector.new(1,0,1),
vector.new(1,0,-1),
vector.new(-1,0,0),
vector.new(-1,0,1),
vector.new(-1,0,-1),
vector.new(0,0,1),
vector.new(0,0,-1),
vector.new(0,-1,0)
}
local function airtower(pos,tbl,h)
for i=1,h do
table.insert(tbl,vector.offset(pos,0,i,0))
end
end
local function makelake(pos,size,liquid,placein,border,pr,noair)
local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size)
local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size)
minetest.emerge_area(e1, e2, function(_, _, calls_remaining)
if calls_remaining ~= 0 then return end
local nn = minetest.find_nodes_in_area(p1,p2,placein)
if not nn[1] then return end
table.sort(nn,function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
local y = pos.y - 1
local lq, air = {}, {}
local r = pr:next(1,#nn)
for i=1,r do
airtower(nn[i],air,20)
table.insert(lq,nn[i])
end
minetest.bulk_swap_node(lq,{name=liquid})
minetest.bulk_swap_node(air,{name="air"})
air = {}
local br = {}
for k,v in pairs(lq) do
for kk,vv in pairs(adjacents) do
local pp = vector.add(v,vv)
local an = minetest.get_node(pp)
if not border then
if minetest.get_item_group(an.name,"solid") > 0 then
border = an.name
elseif minetest.get_item_group(minetest.get_node(nn[1]).name,"solid") > 0 then
border = minetest.get_node_or_nil(nn[1]).name
else
border = "mcl_core:stone"
end
if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end
end
if not noair and an.name ~= liquid then
table.insert(br,pp)
--[[ no need to have air above border:
local un = minetest.get_node(vector.offset(pp,0,1,0))
if un.name ~= liquid then
airtower(pp,air,20)
end]]--
end
end
end
minetest.bulk_swap_node(br,{name=border})
minetest.bulk_swap_node(air,{name="air"})
return true
end)
return true
end
local mushrooms = {"mcl_mushrooms:mushroom_brown","mcl_mushrooms:mushroom_red"}
local function place_fallen_tree(pos,def,pr)
local tree = minetest.find_node_near(pos,15,{"group:tree"})
if not tree then return end
tree = minetest.get_node(tree).name
local minlen, maxlen = 3, 9
local vrate, mrate = 120, 160
local len = pr:next(minlen,maxlen)
local dir = pr:next(0,3)
local dx, dy, dz, param2, w1, w2
if dir == 0 then
dx, dy, dz, param2, w1, w2 = 1, 0, 0, 12, 5, 4
elseif dir == 1 then
dx, dy, dz, param2, w1, w2 = -1, 0, 0, 12, 4, 5
elseif dir == 2 then
dx, dy, dz, param2, w1, w2 = 0, 0, 1, 6, 3, 2
else -- if dir == 3 then
dx, dy, dz, param2, w1, w2 = 0, 0, -1, 6, 2, 3
end
-- TODO: port this to voxel manipulators
-- ensure we have room for the tree
local minsupport, maxsupport = 99, 1
for i = 1,len do
-- check below
local n = minetest.get_node(vector.offset(pos, dx * i, -1, dz * i)).name
local nd = minetest.registered_nodes[n]
if n ~= "air" and nd.groups and nd.groups.solid and i > 2 then
if i < minsupport then minsupport = i end
maxsupport = i
end
-- check space
local n = minetest.get_node(vector.offset(pos, dx * i, 0, dz * i)).name
local nd = minetest.registered_nodes[n]
if n ~= "air" and nd.groups and not nd.groups.plant then
if i < minlen or pr:next(1,maxsupport) == 1 then return end
len = i
break
end
end
if maxsupport - minsupport < minlen then return end
len = math.min(len, maxsupport - 1)
if len < minlen then return end
-- place the tree
minetest.swap_node(pos, {name = tree, param2 = 0})
-- some are hollow:
if vl_hollow_logs.logs and pr:next(1,20) == 1 then
local nam = string.sub(tree, string.find(tree, ":") + 1)
nam = "vl_hollow_logs:"..nam.."_hollow"
if minetest.registered_nodes[nam] then tree = nam end
end
for i = 2,len do
minetest.swap_node(vector.offset(pos, dx * i, 0, dz * i), {name = tree, param2 = param2})
if pr:next(0,255) < vrate then
local side = vector.offset(pos, dx * i + dz, 0, dz * i + dx)
local n = minetest.get_node(side).name
if n == "air" then
minetest.swap_node(side, {name="mcl_core:vine", param2=w1})
end
end
if pr:next(0,255) < vrate then
local side = vector.offset(pos, dx * i - dz, 0, dz * i - dx)
local n = minetest.get_node(side).name
if n == "air" then
minetest.swap_node(side, {name="mcl_core:vine", param2=w2})
end
end
if pr:next(0,255) < mrate then
local top = vector.offset(pos, dx * i, 1, dz * i)
local n = minetest.get_node(top).name
if n == "air" then
minetest.swap_node(top, {name = mushrooms[pr:next(1,#mushrooms)], param2 = 12})
end
end
end
end
vl_structures.register_structure("fallen_tree",{
priority = 1100, -- after regular trees
place_on = {"group:grass_block"},
terrain_feature = true,
noise_params = {
offset = 0.00018,
scale = 0.01011,
spread = {x = 250, y = 250, z = 250},
seed = 24533,
octaves = 3,
persist = 0.66
},
flags = "place_center_x, place_center_z",
solid_ground = true,
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = place_fallen_tree
})
vl_structures.register_structure("lavapool",{
place_on = {"group:sand", "group:dirt", "group:stone"},
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.0000022,
spread = {x = 250, y = 250, z = 250},
seed = 78375213,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos,5,"mcl_core:lava_source",{"group:material_stone", "group:sand", "group:dirt"},"mcl_core:stone",pr)
end
})
vl_structures.register_structure("water_lake",{
place_on = {"group:dirt","group:stone"},
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.000032,
spread = {x = 250, y = 250, z = 250},
seed = 756641353,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos,5,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block"},"mcl_core:dirt_with_grass",pr)
end
})
vl_structures.register_structure("water_lake_mangrove_swamp",{
place_on = {"mcl_mud:mud"},
biomes = { "MangroveSwamp" },
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.0032,
spread = {x = 250, y = 250, z = 250},
seed = 6343241353,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos,3,"mcl_core:water_source",{"group:material_stone", "group:sand", "group:dirt","group:grass_block","mcl_mud:mud"},"mcl_mud:mud",pr,true)
end
})
vl_structures.register_structure("basalt_column",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
terrain_feature = true,
spawn_by = {"air"},
num_spawn_by = 2,
noise_params = {
offset = 0,
scale = 0.003,
spread = {x = 250, y = 250, z = 250},
seed = 72235213,
octaves = 5,
persist = 0.3,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max - 20,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-5,-1,-5),vector.offset(pos,5,-1,5),{"air","mcl_blackstone:basalt","mcl_blackstone:blackstone"})
table.sort(nn,function(a, b)
return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b)
end)
if #nn < 1 then return false end
local basalt = {}
local magma = {}
for i=1,pr:next(1,#nn) do
if minetest.get_node(vector.offset(nn[i],0,-1,0)).name ~= "air" then
local dst=vector.distance(pos,nn[i])
local r = pr:next(1,14)-dst
for ii=0,r do
if pr:next(1,25) == 1 then
table.insert(magma,vector.new(nn[i].x,nn[i].y + ii,nn[i].z))
else
table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z))
end
end
end
end
minetest.bulk_swap_node(magma,{name="mcl_nether:magma"})
minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"})
return true
end
})
vl_structures.register_structure("basalt_pillar",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.001,
spread = {x = 250, y = 250, z = 250},
seed = 7113,
octaves = 5,
persist = 0.1,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max-40,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-2,-1,-2),vector.offset(pos,2,-1,2),{"air","mcl_blackstone:basalt","mcl_blackstone:blackstone"})
table.sort(nn,function(a, b)
return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b)
end)
if #nn < 1 then return false end
local basalt = {}
local magma = {}
for i=1,pr:next(1,#nn) do
if minetest.get_node(vector.offset(nn[i],0,-1,0)).name ~= "air" then
local dst=vector.distance(pos,nn[i])
for ii=0,pr:next(19,35)-dst do
if pr:next(1,20) == 1 then
table.insert(magma,vector.new(nn[i].x,nn[i].y + ii,nn[i].z))
else
table.insert(basalt,vector.new(nn[i].x,nn[i].y + ii,nn[i].z))
end
end
end
end
minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"})
minetest.bulk_swap_node(magma,{name="mcl_nether:magma"})
return true
end
})
vl_structures.register_structure("lavadelta",{
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
spawn_by = {"mcl_blackstone:basalt","mcl_blackstone:blackstone"},
num_spawn_by = 2,
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.005,
spread = {x = 250, y = 250, z = 250},
seed = 78375213,
octaves = 5,
persist = 0.1,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-10,-1,-10),vector.offset(pos,10,-2,10),{"mcl_blackstone:basalt","mcl_blackstone:blackstone","mcl_nether:netherrack"})
table.sort(nn,function(a, b)
return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b)
end)
if #nn < 1 then return false end
local lava = {}
for i=1,pr:next(1,#nn) do
table.insert(lava,nn[i])
end
minetest.bulk_swap_node(lava,{name="mcl_nether:nether_lava_source"})
local basalt = {}
local magma = {}
for _,v in pairs(lava) do
for _,vv in pairs(adjacents) do
local p = vector.add(v,vv)
if minetest.get_node(p).name ~= "mcl_nether:nether_lava_source" then
table.insert(basalt,p)
end
end
if math.random(3) == 1 then
table.insert(magma,v)
end
end
minetest.bulk_swap_node(basalt,{name="mcl_blackstone:basalt"})
minetest.bulk_swap_node(magma,{name="mcl_nether:magma"})
return true
end
})

View file

@ -1,3 +0,0 @@
name = mcl_terrain_features
author = cora
depends = mcl_init, mcl_structures

View file

@ -0,0 +1,59 @@
-- boulders, in MegaTaiga and MegaSpruceTaiga
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Mossy cobblestone boulder (3x3)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
terrain_feature = true,
sidelen = 80,
noise_params = {
offset = 0.00015,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775703,
octaves = 4,
persist = 0.63,
},
biomes = { "MegaTaiga", "MegaSpruceTaiga" },
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = modpath .. "/schematics/mcl_structures_boulder.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Small mossy cobblestone boulder (2x2)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
terrain_feature = true,
sidelen = 80,
noise_params = {
offset = 0.001,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775704,
octaves = 4,
persist = 0.63,
},
biomes = { "MegaTaiga", "MegaSpruceTaiga" },
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = modpath .. "/schematics/mcl_structures_boulder_small.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
vl_structures.register_structure("boulder", {
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = {
-- small boulder 3x as likely
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder_small.mts",
modpath.."/schematics/mcl_structures_boulder.mts",
},
})

View file

@ -1,5 +1,7 @@
-- TODO: use priorities, and move this to the module where coral blocks are defined?
local mod_mcl_structures = minetest.get_modpath("mcl_structures")
-- TODO: move this to the mcl_ocean module?
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local coral_min = vl_biomes.OCEAN_MIN
local coral_max = -10
local warm_oceans = table.copy(vl_biomes.by_water_temp.warm)
@ -21,12 +23,13 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"},
terrain_feature = true,
sidelen = 80,
noise_params = noise,
biomes = warm_oceans,
y_min = coral_min,
y_max = coral_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_coral_" .. c .. "_1.mts",
schematic = modpath .. "/schematics/mcl_structures_coral_" .. c .. "_1.mts",
rotation = "random",
flags = "all_floors,force_placement",
spawn_by = "mcl_core:water_source",
@ -36,12 +39,13 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"},
terrain_feature = true,
noise_params = noise,
sidelen = 80,
biomes = warm_oceans,
y_min = coral_min,
y_max = coral_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_coral_" .. c .. "_2.mts",
schematic = modpath .. "/schematics/mcl_structures_coral_" .. c .. "_2.mts",
rotation = "random",
flags = "all_floors,force_placement",
spawn_by = "mcl_core:water_source",
@ -52,6 +56,7 @@ for _, c in ipairs({ "brain", "horn", "bubble", "tube", "fire" }) do
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_ocean:" .. c .. "_coral_block"},
terrain_feature = true,
sidelen = 16,
fill_ratio = 3,
y_min = coral_min,
@ -69,6 +74,7 @@ end
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"group:sand", "mcl_core:gravel", "mcl_mud:mud"},
terrain_feature = true,
sidelen = 16,
noise_params = {
offset = -0.0085,
@ -93,6 +99,7 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_ocean:dead_brain_coral_block"},
terrain_feature = true,
sidelen = 16,
fill_ratio = 3,
y_min = coral_min,
@ -107,6 +114,7 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_ocean:dead_brain_coral_block"},
terrain_feature = true,
sidelen = 16,
fill_ratio = 3,
y_min = coral_min,
@ -121,6 +129,7 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_ocean:dead_brain_coral_block"},
terrain_feature = true,
sidelen = 16,
fill_ratio = 2,
y_min = coral_min,
@ -135,6 +144,7 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_ocean:dead_brain_coral_block"},
terrain_feature = true,
sidelen = 16,
fill_ratio = 2,
y_min = coral_min,
@ -150,12 +160,13 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"group:sand", "mcl_core:gravel"},
terrain_feature = true,
fill_ratio = 0.0001,
sidelen = 80,
biomes = warm_oceans,
y_min = coral_min,
y_max = coral_max,
schematic = mod_mcl_structures .. "/schematics/coral_cora.mts",
schematic = modpath .. "/schematics/coral_cora.mts",
rotation = "random",
flags = "all_floors,force_placement",
spawn_by = "mcl_core:water_source",

View file

@ -0,0 +1,100 @@
-- TODO: allow longer logs in MegaTaiga?
local mg_name = minetest.get_mapgen_setting("mg_name")
local mushrooms = {"mcl_mushrooms:mushroom_brown","mcl_mushrooms:mushroom_red"}
vl_structures.register_structure("fallen_tree",{
priority = 1100, -- after regular trees
place_on = {"group:grass_block"},
terrain_feature = true,
noise_params = {
offset = 0.00018,
scale = 0.01011,
spread = {x = 250, y = 250, z = 250},
seed = 24533,
octaves = 3,
persist = 0.66
},
flags = "place_center_x, place_center_z",
solid_ground = true,
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos,def,pr)
local tree = minetest.find_node_near(pos,15,{"group:tree"})
if not tree then return end
tree = minetest.get_node(tree).name
local minlen, maxlen = 3, 9
local vrate, mrate = 120, 160
local len = pr:next(minlen,maxlen)
local dir = pr:next(0,3)
local dx, dy, dz, param2, w1, w2
if dir == 0 then
dx, dy, dz, param2, w1, w2 = 1, 0, 0, 12, 5, 4
elseif dir == 1 then
dx, dy, dz, param2, w1, w2 = -1, 0, 0, 12, 4, 5
elseif dir == 2 then
dx, dy, dz, param2, w1, w2 = 0, 0, 1, 6, 3, 2
else -- if dir == 3 then
dx, dy, dz, param2, w1, w2 = 0, 0, -1, 6, 2, 3
end
-- ensure we have room for the tree
local minsupport, maxsupport = 99, 1
for i = 1,len do
-- check below
local n = minetest.get_node(vector.offset(pos, dx * i, -1, dz * i)).name
local nd = minetest.registered_nodes[n]
if n ~= "air" and nd.groups and nd.groups.solid and i > 2 then
if i < minsupport then minsupport = i end
maxsupport = i
end
-- check space
local n = minetest.get_node(vector.offset(pos, dx * i, 0, dz * i)).name
local nd = minetest.registered_nodes[n]
if n ~= "air" and nd.groups and not nd.groups.plant then
if i < minlen or pr:next(1, maxsupport) == 1 then return end
len = i
break
end
end
if maxsupport - minsupport < minlen then return end
-- get the foliage palette for vines:
local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(pos).biome)]
if biome and biome._mcl_foliage_palette_index then
w1 = biome._mcl_foliage_palette_index * 8 + w1
w2 = biome._mcl_foliage_palette_index * 8 + w2
end
len = math.min(len, maxsupport - 1)
if len < minlen then return end
-- place the upright tree trunk
minetest.swap_node(pos, { name = tree, param2 = 0 })
-- some are hollow:
if vl_hollow_logs.logs and pr:next(1,20) == 1 then
local nam = string.sub(tree, string.find(tree, ":") + 1)
nam = "vl_hollow_logs:"..nam.."_hollow"
if minetest.registered_nodes[nam] then tree = nam end
end
for i = 2,len do
minetest.swap_node(vector.offset(pos, dx * i, 0, dz * i), { name = tree, param2 = param2 })
-- add some vines
if pr:next(0,255) < vrate then
local side = vector.offset(pos, dx * i + dz, 0, dz * i + dx)
if minetest.get_node(side).name == "air" then
minetest.swap_node(side, { name = "mcl_core:vine", param2 = w1 })
end
end
if pr:next(0,255) < vrate then
local side = vector.offset(pos, dx * i - dz, 0, dz * i - dx)
if minetest.get_node(side).name == "air" then
minetest.swap_node(side, { name = "mcl_core:vine", param2 = w2 })
end
end
-- add some mushrooms
if pr:next(0,255) < mrate then
local top = vector.offset(pos, dx * i, 1, dz * i)
if minetest.get_node(top).name == "air" then
minetest.swap_node(top, { name = mushrooms[pr:next(1,#mushrooms)], param2 = 12 })
end
end
end
end
})

View file

@ -1,10 +1,12 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
vl_structures.register_structure("fossil",{
place_on = {"group:material_stone","group:sand"},
vl_structures.register_structure("fossil", {
place_on = { "group:material_stone", "group:sand" },
flags = "place_center_x, place_center_z",
prepare = false,
priority = 900, -- actually a terrain feature,
terrain_feature = false, -- but add them to /locate nevertheless
chunk_probability = 15, -- was 25, FIXME: needs rebalancing
y_offset = function(pr) return pr:next(-32,-16) end,
y_max = 15,

View file

@ -75,12 +75,12 @@ local function makegeode(pos, _, pr)
return true
end
vl_structures.register_structure("geode",{
place_on = {"group:material_stone"},
vl_structures.register_structure("geode", {
place_on = { "group:material_stone" },
noise_params = {
offset = 0,
scale = 0.00022,
spread = {x = 250, y = 250, z = 250},
spread = vector.new(250, 250, 250),
seed = 7894353,
octaves = 3,
persist = 0.001,

View file

@ -0,0 +1,142 @@
-- TODO: overall, these pools tend to be very circular, can we make them more interesting?
-- TODO: use the terraforming from vl_terraforming instead of the airtower?
local mg_name = minetest.get_mapgen_setting("mg_name")
local adjacents = {
vector.new(1,0,0),
vector.new(1,0,1),
vector.new(1,0,-1),
vector.new(-1,0,0),
vector.new(-1,0,1),
vector.new(-1,0,-1),
vector.new(0,0,1),
vector.new(0,0,-1),
vector.new(0,-1,0)
}
local function makelake(pos, size, liquid, placein, border, pr, noair)
local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size)
local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size)
minetest.emerge_area(e1, e2, function(_, _, calls_remaining)
if calls_remaining ~= 0 then return end
local nn = minetest.find_nodes_in_area(p1, p2, placein)
if not nn[1] then return end
table.sort(nn, function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
local y = pos.y - 1
local lq, air = {}, {}
local r = pr:next(1,#nn)
for i=1,r do
for j = 1, 20 do
table.insert(air, vector.offset(nn[i], 0, j, 0))
end
table.insert(lq, nn[i])
end
minetest.bulk_swap_node(lq, { name = liquid })
minetest.bulk_swap_node(air, { name = "air" })
air = {}
local br = {}
for k,v in pairs(lq) do
for kk,vv in pairs(adjacents) do
local pp = vector.add(v,vv)
local an = minetest.get_node(pp)
-- if not border and minetest.get_item_group(an.name, "solid") > 0 then border = an end
if not noair and an.name ~= liquid then
table.insert(br,pp)
end
end
end
--[[ unused:
if not border then
if minetest.get_item_group(minetest.get_node(nn[1]).name, "solid") > 0 then
border = minetest.get_node_or_nil(nn[1])
else
border = { name = "mcl_core:stone" }
end
end
if border == nil or border.name == "mcl_core:dirt" then
local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(nn[1]).biome)]
local p2 = biome and biome._mcl_grass_palette_index and biome._mcl_grass_palette_index or nil
border = { name = "mcl_core:dirt_with_grass", param2 = p2 }
end ]]
if border.name == "mcl_core:dirt_with_grass" and not border.param2 then
local biome = mg_name ~= "v6" and minetest.registered_biomes[minetest.get_biome_name(minetest.get_biome_data(nn[1]).biome)]
local p2 = biome and biome._mcl_grass_palette_index and biome._mcl_grass_palette_index or nil
border = { name = "mcl_core:dirt_with_grass", param2 = p2 }
end
minetest.bulk_swap_node(br, border)
minetest.bulk_swap_node(air, { name = "air" })
return true
end)
return true
end
vl_structures.register_structure("lavapool", {
place_on = { "group:sand", "group:dirt", "group:stone" },
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.0000022,
spread = vector.new(250, 250, 250),
seed = 78375213,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos, 5, "mcl_core:lava_source",
{ "group:material_stone", "group:sand", "group:dirt" },
{ name = "mcl_core:stone" }, pr)
end
})
vl_structures.register_structure("water_lake", {
place_on = { "group:dirt", "group:stone" },
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.000032,
spread = vector.new(250, 250, 250),
seed = 756641353,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos, 5, "mcl_core:water_source",
{ "group:material_stone", "group:sand", "group:dirt", "group:grass_block"},
{ name = "mcl_core:dirt_with_grass" }, pr)
end
})
vl_structures.register_structure("water_lake_mangrove_swamp", {
place_on = { "mcl_mud:mud" },
biomes = { "MangroveSwamp" },
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.0032,
spread = vector.new(250, 250, 250),
seed = 6343241353,
octaves = 3,
persist = 0.001,
flags = "absvalue",
},
flags = "place_center_x, place_center_z, all_floors",
y_max = mcl_vars.mg_overworld_max,
y_min = minetest.get_mapgen_setting("water_level"),
place_func = function(pos, _, pr)
return makelake(pos, 3, "mcl_core:water_source",
{ "group:material_stone", "group:sand", "group:dirt", "group:grass_block", "mcl_mud:mud"},
{ name = "mcl_mud:mud" }, pr, true)
end
})

View file

@ -324,11 +324,16 @@ elseif mg_name ~= "v6" then
-- Additional decorations
dofile(modpath.."/deco/bamboo.lua")
dofile(modpath.."/deco/boulder.lua")
dofile(modpath.."/deco/cacti.lua")
dofile(modpath.."/deco/corals.lua")
dofile(modpath.."/deco/fallentree.lua")
dofile(modpath.."/deco/fern.lua")
dofile(modpath.."/deco/flowers.lua")
dofile(modpath.."/deco/fossil.lua")
dofile(modpath.."/deco/geode.lua")
dofile(modpath.."/deco/kelp.lua")
dofile(modpath.."/deco/lakes.lua")
dofile(modpath.."/deco/mushrooms.lua")
dofile(modpath.."/deco/pumpkin.lua")
dofile(modpath.."/deco/reeds.lua")

View file

@ -133,3 +133,146 @@ mcl_mapgen_core.register_decoration({
y_max = vl_biomes.nether_max - 5,
flags = "all_floors, force_placement",
})
local adjacents = {
vector.new(1,0,0),
vector.new(1,0,1),
vector.new(1,0,-1),
vector.new(-1,0,0),
vector.new(-1,0,1),
vector.new(-1,0,-1),
vector.new(0,0,1),
vector.new(0,0,-1),
vector.new(0,-1,0)
}
vl_structures.register_structure("basalt_column",{
place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" },
terrain_feature = true,
spawn_by = { "air" },
num_spawn_by = 2,
noise_params = {
offset = 0,
scale = 0.003,
spread = vector.new(250, 250, 250),
seed = 72235213,
octaves = 5,
persist = 0.3,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max - 20,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-5,-1,-5), vector.offset(pos,5,-1,5),
{ "air", "mcl_blackstone:basalt", "mcl_blackstone:blackstone" })
table.sort(nn, function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
if #nn < 1 then return false end
local basalt, magma = {}, {}
for i = 1, pr:next(1,#nn) do
if minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name ~= "air" then
local dst = vector.distance(pos, nn[i])
for ii = 0, pr:next(1,14) - dst do
if pr:next(1,25) == 1 then
table.insert(magma, vector.offset(nn[i], 0, ii, 0))
else
table.insert(basalt, vector.offset(nn[i], 0, ii, 0))
end
end
end
end
minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" })
minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" })
return true
end
})
vl_structures.register_structure("basalt_pillar",{
place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" },
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.001,
spread = vector.new(250, 250, 250),
seed = 7113,
octaves = 5,
persist = 0.1,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max - 40,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area(vector.offset(pos,-2,-1,-2), vector.offset(pos,2,-1,2),
{ "air", "mcl_blackstone:basalt", "mcl_blackstone:blackstone" })
table.sort(nn, function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
if #nn < 1 then return false end
local basalt, magma = {}, {}
for i = 1, pr:next(1,#nn) do
if minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name ~= "air" then
local dst = vector.distance(pos, nn[i])
for ii = 0, pr:next(19,35) - dst do
if pr:next(1,20) == 1 then
table.insert(magma, vector.offset(nn[i], 0, ii, 0))
else
table.insert(basalt, vector.offset(nn[i], 0, ii, 0))
end
end
end
end
minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" })
minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" })
return true
end
})
vl_structures.register_structure("lavadelta",{
place_on = { "mcl_blackstone:blackstone", "mcl_blackstone:basalt" },
spawn_by = { "mcl_blackstone:basalt", "mcl_blackstone:blackstone" },
num_spawn_by = 2,
terrain_feature = true,
noise_params = {
offset = 0,
scale = 0.005,
spread = vector.new(250, 250, 250),
seed = 78375213,
octaves = 5,
persist = 0.1,
flags = "absvalue",
},
flags = "all_floors",
y_max = mcl_vars.mg_nether_max,
y_min = mcl_vars.mg_lava_nether_max + 1,
biomes = { "BasaltDelta" },
place_func = function(pos, _, pr)
local nn = minetest.find_nodes_in_area_under_air(vector.offset(pos,-10,-1,-10), vector.offset(pos,10,-2,10),
{ "mcl_blackstone:basalt", "mcl_blackstone:blackstone", "mcl_nether:netherrack" })
table.sort(nn, function(a, b)
return vector.distance(pos, a) < vector.distance(pos, b)
end)
if #nn < 1 then return false end
local lava = {}
for i=1, pr:next(1,#nn) do table.insert(lava,nn[i]) end
minetest.bulk_swap_node(lava, { name = "mcl_nether:nether_lava_source" })
local basalt, magma = {}, {}
for _, v in pairs(lava) do
for _, vv in pairs(adjacents) do
local p = vector.add(v, vv)
if minetest.get_node(p).name ~= "mcl_nether:nether_lava_source" then
table.insert(basalt,p)
end
end
if math.random(3) == 1 then
table.insert(magma,v)
end
end
minetest.bulk_swap_node(basalt, { name = "mcl_blackstone:basalt" })
minetest.bulk_swap_node(magma, { name = "mcl_nether:magma" })
return true
end
})

View file

@ -1,4 +1,5 @@
local mod_mcl_structures = minetest.get_modpath("mcl_structures")
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Ice Plains Spikes (rare) aka Ice Spikes
vl_biomes.register_biome({
@ -36,6 +37,7 @@ vl_biomes.register_biome({
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:snowblock", "mcl_core:snow", "group:grass_block_snow"},
terrain_feature = true,
sidelen = 80,
noise_params = {
offset = 0.00040,
@ -48,7 +50,7 @@ mcl_mapgen_core.register_decoration({
biomes = {"IcePlainsSpikes"},
y_min = 4,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_ice_spike_large.mts",
schematic = modpath .. "/schematics/mcl_structures_ice_spike_large.mts",
rotation = "random",
flags = "place_center_x, place_center_z",
})
@ -57,6 +59,7 @@ mcl_mapgen_core.register_decoration({
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:snowblock", "mcl_core:snow", "group:grass_block_snow"},
terrain_feature = true,
sidelen = 80,
noise_params = {
offset = 0.005,
@ -69,7 +72,18 @@ mcl_mapgen_core.register_decoration({
biomes = {"IcePlainsSpikes"},
y_min = 4,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_ice_spike_small.mts",
schematic = modpath .. "/schematics/mcl_structures_ice_spike_small.mts",
rotation = "random",
flags = "place_center_x, place_center_z",
})
vl_structures.register_structure("ice_spike_small", {
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = { modpath.."/schematics/mcl_structures_ice_spike_small.mts" },
})
vl_structures.register_structure("ice_spike_large", {
-- as they have no place_on, they will not be spawned by this mechanism. this is just for /spawnstruct
filenames = { modpath.."/schematics/mcl_structures_ice_spike_large.mts" },
})

View file

@ -1,5 +1,3 @@
local mod_mcl_structures = minetest.get_modpath("mcl_structures")
-- Mega Pine Taiga aka Old Growth Pine Taiga
vl_biomes.register_biome({
name = "MegaTaiga",
@ -41,47 +39,6 @@ minetest.register_ore({
noise_params = {offset = 0, scale = 15, spread = vector.new(130, 130, 130), seed = 24, octaves = 3, persist = 0.70},
biomes = {"MegaTaiga"},
})
-- Mossy cobblestone boulder (3x3)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
sidelen = 80,
noise_params = {
offset = 0.00015,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775703,
octaves = 4,
persist = 0.63,
},
biomes = {"MegaTaiga"},
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Small mossy cobblestone boulder (2x2)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
sidelen = 80,
noise_params = {
offset = 0.001,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775704,
octaves = 4,
persist = 0.63,
},
biomes = {"MegaTaiga"},
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder_small.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Huge spruce
vl_biomes.register_spruce_decoration(3000, 0.0008, "mcl_core_spruce_huge_up_1.mts", {"MegaTaiga"})

View file

@ -1,5 +1,3 @@
local mod_mcl_structures = minetest.get_modpath("mcl_structures")
-- Mega Spruce Taiga aka Old Growth Spruce Taiga
vl_biomes.register_biome({
name = "MegaSpruceTaiga",
@ -26,47 +24,6 @@ vl_biomes.register_biome({
depth_filler = 3,
},
})
-- Mossy cobblestone boulder (3x3)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
sidelen = 80,
noise_params = {
offset = 0.00015,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775703,
octaves = 4,
persist = 0.63,
},
biomes = {"MegaSpruceTaiga"},
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Small mossy cobblestone boulder (2x2)
mcl_mapgen_core.register_decoration({
deco_type = "schematic",
place_on = {"mcl_core:podzol", "mcl_core:dirt", "mcl_core:coarse_dirt"},
sidelen = 80,
noise_params = {
offset = 0.001,
scale = 0.001,
spread = vector.new(300, 300, 300),
seed = 775704,
octaves = 4,
persist = 0.63,
},
biomes = {"MegaSpruceTaiga"},
y_min = 1,
y_max = vl_biomes.overworld_max,
schematic = mod_mcl_structures .. "/schematics/mcl_structures_boulder_small.mts",
flags = "place_center_x, place_center_z",
rotation = "random",
})
-- Huge spruce
vl_biomes.register_spruce_decoration(3000, 0.0030, "mcl_core_spruce_huge_1.mts", {"MegaSpruceTaiga"})

View file

@ -6,31 +6,30 @@ local peaceful = minetest.settings:get_bool("only_peaceful_mobs", false)
local function spawn_witch(pos,def,pr,p1,p2)
local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"})
if c then
if not c then return end
local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"group:stone"})
local witch
if not peaceful then
witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity()
if #nn == 0 then return end
local witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch")
if witchobj then
local witch = witchobj:get_luaentity()
witch._home = c
witch.can_despawn = false
end
local catobject = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat")
if catobject and catobject:get_pos() then
local cat=catobject:get_luaentity()
local catobj = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat")
if catobj then
local cat = catobj:get_luaentity()
cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}})
cat.owner = "!witch!" --so it's not claimable by player
cat._home = c
cat.can_despawn = false
end
return
end
end
vl_structures.register_structure("witches_circle",{
place_on = {"group:grass_block", "group:dirt", "mclx_core:river_water_source"},
flags = "place_center_x, place_center_z, all_surfaces",
chunk_probability = 14,
prepare = { tolerance=4, clear_bottom=1, clear_top=-1, padding=0, corners=3, foundation=-2 },
chunk_probability = 20,
prepare = { tolerance = 3, clear_bottom = 1, clear_top = 0, padding = 0, corners = 1, foundation = -2 },
y_max = mcl_vars.mg_overworld_max,
y_min = 1,
y_offset = -1,