Compare commits

...

4 Commits

Author SHA1 Message Date
kno10 e78b54cd35 minor parameter tweaks 2024-11-01 00:56:07 +01:00
kno10 210fae473e make trees, funghi not ground content, they get damaged in nether 2024-11-01 00:29:51 +01:00
kno10 8df579bc6c finetuning 2024-11-01 00:28:11 +01:00
kno10 ba3d7f1af7 reduce light of witch circle 2024-10-31 20:33:45 +01:00
15 changed files with 75 additions and 45 deletions

View File

@ -59,6 +59,7 @@ function mcl_core.register_tree_trunk(subname, description_trunk, description_ba
_doc_items_hidden = false,
tiles = {tile_inner, tile_inner, tile_bark},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
stack_max = 64,
@ -75,6 +76,7 @@ function mcl_core.register_tree_trunk(subname, description_trunk, description_ba
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {tile_bark},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
@ -104,6 +106,7 @@ function mcl_core.register_stripped_trunk(subname, description_stripped_trunk, d
_doc_items_hidden = false,
tiles = {tile_stripped_inner, tile_stripped_inner, tile_stripped_bark},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
@ -118,6 +121,7 @@ function mcl_core.register_stripped_trunk(subname, description_stripped_trunk, d
_doc_items_longdesc = longdesc_wood,
tiles = {tile_stripped_bark},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
@ -195,6 +199,7 @@ function mcl_core.register_leaves(subname, description, longdesc, tiles, color,
color = color,
paramtype = "light",
paramtype2 = paramtype2,
is_ground_content = false,
palette = palette,
stack_max = 64,
groups = {

View File

@ -337,6 +337,7 @@ minetest.register_node("mcl_crimson:warped_wart_block", {
tiles = {"mcl_crimson_warped_wart_block.png"},
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 85},
_mcl_hardness = 1,
is_ground_content = false,
sounds = mcl_sounds.node_sound_leaves_defaults({
footstep={name="default_dirt_footstep", gain=0.7},
dug={name="default_dirt_footstep", gain=1.5},
@ -349,6 +350,7 @@ minetest.register_node("mcl_crimson:shroomlight", {
groups = {handy = 1, hoey = 7, swordy = 1, deco_block = 1, compostability = 65},
light_source = minetest.LIGHT_MAX,
_mcl_hardness = 1,
is_ground_content = false,
sounds = mcl_sounds.node_sound_leaves_defaults({
footstep={name="default_dirt_footstep", gain=0.7},
dug={name="default_dirt_footstep", gain=1.5},
@ -368,6 +370,7 @@ minetest.register_node("mcl_crimson:warped_hyphae", {
},
},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1},
sounds = mcl_sounds.node_sound_wood_defaults(),
@ -585,6 +588,7 @@ minetest.register_node("mcl_crimson:crimson_hyphae", {
},
},
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
groups = {handy = 1, axey = 1, tree = 1, building_block = 1, material_wood = 1},
sounds = mcl_sounds.node_sound_wood_defaults(),

View File

@ -8,7 +8,7 @@ local template = {
flammable = -1, compostability = 85
},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = true,
is_ground_content = false,
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,

View File

@ -370,12 +370,13 @@ local function world_structure(vm, data, data2, emin, emax, area, minp, maxp, bl
return lvm_used, lvm_used, deco, ores
end
--[[ replaced with decoration hack to replace grass nodes
-- largely replaced with decoration hack to replace grass nodes
-- except for cavegen, which still only produces param2=0
local function block_fixes_grass(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Set param2 (=color) of nodes which use the grass colour palette.
return minp.y <= mcl_vars.mg_overworld_max and maxp.y >= mcl_vars.mg_overworld_min and
set_grass_palette(minp,maxp,data2,area,{"group:grass_palette"})
end]]
end
--[[ replaced with schematic specialization per biome
local function block_fixes_foliage(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
@ -419,7 +420,8 @@ mcl_mapgen_core.register_generator("world_structure", world_structure, nil, 1, t
mcl_mapgen_core.register_generator("end_fixes", end_basic, nil, 9999, true)
if mg_name ~= "v6" and mg_name ~= "singlenode" then
-- replaced with decoration hack: mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true)
-- cavegen will still produce param2=0 only
mcl_mapgen_core.register_generator("block_fixes_grass", block_fixes_grass, nil, 9999, true)
-- replaced with schema specialization: mcl_mapgen_core.register_generator("block_fixes_foliage", block_fixes_foliage, nil, 9999, true)
mcl_mapgen_core.register_generator("block_fixes_water", block_fixes_water, nil, 9999, true)
-- replaced with using param2=3 during generation mcl_mapgen_core.register_generator("block_fixes_seagrass", block_fixes_seagrass, nil, 9999, true)

View File

@ -34,13 +34,12 @@ vl_structures.register_structure("nether_bridge",{
y_min = mcl_vars.mg_lava_nether_max,
y_max = mcl_vars.mg_lava_nether_max + 25, -- otherwise, we may see some very long legs
filenames = nbridges,
y_offset = function(pr) return pr:next(-8, -5) end,
y_offset = function(pr) return pr:next(-12, -8) end,
after_place = function(pos,def,pr,p1,p2)
vl_structures.spawn_mobs("mobs_mc:witherskeleton",{"mcl_blackstone:blackstone_chiseled_polished"},p1,p2,pr,5)
-- p1.y is not a typo, we want to lowest level only
local legs = minetest.find_nodes_in_area(vector.new(p1.x,p1.y,p1.z),vector.new(p2.x,p1.y,p2.z), "mcl_nether:nether_brick")
local bricks = {}
-- TODO: port leg generation to voxel manipulators?
for _,leg in pairs(legs) do
while true do
leg = vector.offset(leg,0,-1,0)

View File

@ -80,7 +80,7 @@ local cold = {
y_max = water_level - 6,
y_offset = -1,
flags = "place_center_x, place_center_z, force_placement",
prepare = { foundation = -2, clear = false, surface = "water" },
prepare = { foundation = -3, clear = false, surface = "water", mode = "min" },
filenames = {
modpath.."/schematics/mcl_structures_ocean_ruins_cold_1.mts",
modpath.."/schematics/mcl_structures_ocean_ruins_cold_2.mts",

View File

@ -5,7 +5,7 @@ local modpath = minetest.get_modpath(modname)
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"})
local c = minetest.find_node_near(p1,15,{"group:cauldron"})
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 witchobj = not peaceful and minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch")
@ -48,10 +48,10 @@ vl_structures.register_structure("witch_hut",{
num_spawn_by = 3,
flags = "place_center_x, place_center_z, all_surfaces",
chunk_probability = 8,
prepare = { surface = "under_air", tolerance = 4, clear_bottom = 3, padding = 0, corners = 1, foundation = false },
prepare = { surface = "under_air", tolerance = 3, clear_bottom = 3, padding = 0, corners = 1, foundation = false, mode = "max" },
y_max = mcl_vars.mg_overworld_max,
y_min = -5,
y_offset = 0,
y_offset = -1,
biomes = { "Swampland", "Swampland_ocean", "Swampland_shore" },
filenames = { modpath.."/schematics/mcl_structures_witch_hut.mts" },
after_place = hut_placement_callback,

View File

@ -3,6 +3,9 @@ local max_jobs = tonumber(minetest.settings:get("vl_villages_max_jobs")) or 14
local placement_priority = minetest.settings:get("vl_villages_placement_priority") or "houses" -- houses is safer for villagers at night
local max_height_difference = 40 -- at distance 40. In the center, half as much
local prepare = { tolerance = 4, surface = "solid", mode = "median", depth = -5, corners = 2, padding = 2 }
local buildsep = 2 -- minimum building separation
local S = minetest.get_translator(minetest.get_current_modname())
local function add_building(settlement, building, count_buildings)
@ -23,13 +26,12 @@ local function layout_town(minp, maxp, pr, input_settlement)
local center = vector.new(pr:next(minp.x + 24, maxp.x - 24), maxp.y, pr:next(minp.z + 24, maxp.z - 24))
minetest.log("action", "[mcl_villages] sudo make me a village at: " .. minetest.pos_to_string(minp).." - "..minetest.pos_to_string(maxp))
local possible_rotations = {"0", "90", "180", "270"}
local center_surface
local center_surface = center
local settlement = {}
-- now some buildings around in a circle, radius = size of town center
local x, y, z, r, lastr = center.x, center.y, center.z, 0, 99
local mindist = 3
if #input_settlement >= 12 then mindist = 2 end
local mindist = #input_settlement >= 12 and buildsep or (buildsep + 1)
-- draw j circles around center and increase radius by math.random(2,4)
for j = 1,20 do
local steps = math.min(math.floor(math.pi * 2 * r / 2), 30) -- try up to 30 angles
@ -44,7 +46,7 @@ local function layout_town(minp, maxp, pr, input_settlement)
-- more defensive and hence safer for the poor villagers, even though less random
-- case distinction is simpler and faster than trigonometry here:
local rotation = building.rotation_offset or 0
if math.abs(cpos.z-center.z) > math.abs(cpos.x-center.x) then
if math.abs(cpos.z-center_surface.z) > math.abs(cpos.x-center_surface.x) then
rotation = rotation + (cpos.z <= center.z and 0 or 2) -- zero indexed for modulo below
else
rotation = rotation + (cpos.x <= center.x and 1 or 3) -- zero indexed for modulo below
@ -57,10 +59,10 @@ local function layout_town(minp, maxp, pr, input_settlement)
-- ensure we have 3 space for terraforming, and avoid problems with VoxelManip
if tlpos.x - 3 >= minp.x and tlpos.x + size.x + 3 <= maxp.x
and tlpos.z + 3 >= minp.z and tlpos.z + size.y + 3 <= maxp.z then
local pos, surface_material = vl_terraforming.find_level(cpos, size, 6)
local pos, surface_material = vl_terraforming.find_level(cpos, size, prepare.tolerance, prepare.surface, prepare.mode)
if pos and pos.y + size.y > maxp.y then pos = nil end
-- check distance to other buildings. Note that we still want to add baseplates etc.
if pos and mcl_villages.surface_mat[surface_material.name] and mcl_villages.check_distance(settlement, cpos, size.x, size.z, mindist) then
if pos and mcl_villages.surface_mat[surface_material.name] and mcl_villages.check_distance(settlement, pos, size.x, size.z, mindist) then
-- use town bell as new reference point for placement height
if #settlement == 0 then
center_surface, y = cpos, math.min(maxp.y, pos.y + max_height_difference + 1)
@ -75,7 +77,7 @@ local function layout_town(minp, maxp, pr, input_settlement)
building.rotation = rotation
building.surface_mat = surface_material
table.insert(settlement, building)
-- minetest.log("verbose", "[mcl_villages] Planning "..schema["name"].." at "..minetest.pos_to_string(pos))
-- minetest.log("verbose", "[mcl_villages] Planning "..building.name.." at "..minetest.pos_to_string(pos))
lastr = r
else
minetest.log("verbose", "Too large height difference "..math.abs(pos.y - center_surface.y).." at distance "..r)
@ -353,7 +355,9 @@ function mcl_villages.terraform(settlement, pr)
building.platform_mat = platform_mat -- remember for use in schematic placement
building.stone_mat = stone_mat
pos = vector.offset(pos, -math.floor((size.x-1)/2), 0, -math.floor((size.z-1)/2))
vl_terraforming.foundation(pos.x-2, pos.y, pos.z-2, size.x+4, -5, size.z+4, 2, surface_mat, platform_mat, stone_mat, dust_mat, pr)
vl_terraforming.foundation(pos.x - prepare.padding, pos.y, pos.z - prepare.padding,
size.x + prepare.padding * 2, prepare.depth, size.z + prepare.padding * 2,
prepare.corners, surface_mat, platform_mat, stone_mat, dust_mat, pr)
end
end
end

View File

@ -219,7 +219,7 @@ mcl_villages.register_building({
num_others = 8,
min_jobs = 7,
yadjust = 1,
rotation_offset = 3, -- entrance is east
rotation_offset = 0, -- entrance is north
})
mcl_villages.register_building({
@ -247,7 +247,7 @@ mcl_villages.register_building({
mts = schem_path .. "new_villages/cartographer.mts",
num_others = 15,
yadjust = 1,
rotation_offset = 1, -- entrance is west
rotation_offset = 0, -- entrance is north
})
mcl_villages.register_building({
@ -263,6 +263,7 @@ mcl_villages.register_building({
mts = schem_path .. "new_villages/mill.mts",
num_others = 8,
yadjust = 1,
rotation_offset = 3, -- entrance is east
})
mcl_villages.register_building({

View File

@ -1,5 +1,16 @@
-- Sugar canes
for _, biome in ipairs(vl_biomes.overworld_biomes) do
local biomes = vl_biomes.overworld_biomes
local bmap = {}
for b = 1, #biomes do
if minetest.registered_biomes[biomes[b]] then -- ignore missing biomes
local param2 = minetest.registered_biomes[biomes[b]]._mcl_grass_palette_index or 0
if not bmap[param2] then bmap[param2] = {} end
table.insert(bmap[param2], biomes[b])
else
minetest.log("warning", "Biome not found: "..biomes[b])
end
end
for param2, bs in pairs(bmap) do
mcl_mapgen_core.register_decoration({
deco_type = "simple",
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
@ -19,8 +30,8 @@ for _, biome in ipairs(vl_biomes.overworld_biomes) do
height_max = 3,
spawn_by = {"mcl_core:water_source", "mclx_core:river_water_source", "group:frosted_ice"},
num_spawn_by = 1,
biomes = {biome},
param2 = biome._mcl_foliage_palette_index
biomes = bs,
param2 = param2
})
end
@ -30,10 +41,10 @@ mcl_mapgen_core.register_decoration({
place_on = {"mcl_core:dirt", "mcl_core:coarse_dirt", "group:grass_block_no_snow", "group:sand", "mcl_core:podzol", "mcl_core:reeds"},
sidelen = 16,
noise_params = {
offset = 0.0,
offset = 0.1,
scale = 0.5,
spread = vector.new(200, 200, 200),
seed = 2,
spread = vector.new(100, 100, 100),
seed = 3,
octaves = 3,
persist = 0.7,
},
@ -45,6 +56,6 @@ mcl_mapgen_core.register_decoration({
height_max = 3,
spawn_by = {"mcl_core:water_source", "group:frosted_ice"},
num_spawn_by = 1,
param2 = 5 -- Swampland foliage palette index
param2 = 28 -- Swampland grass palette index
})

View File

@ -59,6 +59,7 @@ register_grass_decoration(0.18, -0.03, grass_savanna)
register_grass_decoration(0.05, -0.03, grass_sparse)
register_grass_decoration(0.05, 0.05, grass_mpfm)
register_grass_decoration(-0.03, 1, {"BambooJungle", "BambooJungleM", "BambooJungleEdge"})
register_grass_decoration(0.18, 0.03, {"Swampland"})
-- Doubletall grass registration helper
local function register_doubletall_grass(offset, scale, biomes)

View File

@ -65,14 +65,15 @@ local lily_schem = {
-- Spawn them in shallow water at ocean level in Swampland.
-- Tweak lilydepth to change the maximum water depth
local lilydepth = 2
local lilydepth = 3
for d = 1, lilydepth do
local height = d + 2
local y = 1 - d
table.insert(lily_schem, 1, {name = "air", prob = 0})
table.insert(lily_schem, 1, {name = "ignore", prob = 0})
mcl_mapgen_core.register_decoration({
name = "lily:"..tostring(d),
deco_type = "schematic",
schematic = {
size = vector.new(1, height, 1),
@ -81,7 +82,7 @@ for d = 1, lilydepth do
place_on = "mcl_core:dirt",
sidelen = 16,
noise_params = {
offset = 0,
offset = 0.3 - 0.2 * d, -- more when shallow
scale = 0.3,
spread = vector.new(100, 100, 100),
seed = 503,

View File

@ -5,7 +5,7 @@ local modpath = minetest.get_modpath(modname)
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"})
local c = minetest.find_node_near(p1,15,{"group:cauldron"})
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"})
if #nn == 0 then return end

View File

@ -238,21 +238,23 @@ function vl_terraforming.find_level(cpos, size, tolerance, surface, mode)
local pos_c = _find_ground(pos)
if pos_c then table.insert(ys, pos_c.y) end
table.sort(ys)
if #ys < 5 then return nil, nil end -- not fully supported
tolerance = tolerance or 8
-- well supported base, not too uneven?
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
tolerance = tolerance or 6 -- default value
if mode == "min" then -- ignore the largest when using min
if ys[#ys-1]-ys[1] > tolerance then return nil, nil end
cpos.y = ys[1]
elseif mode == "max" then -- ignore the smallest when using max
if ys[#ys]-ys[2] > tolerance then return nil, nil end
cpos.y = ys[#ys]
else -- median
if 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
end
cpos.y = floor(0.5 * (ys[floor(1 + (#ys - 1) * 0.5)] + ys[ceil(1 + (#ys - 1) * 0.5)])) -- rounded
end
if mode == "min" then
pos.y = ys[1]
elseif mode == "max" then
pos.y = ys[#ys]
else -- median except for largest
pos.y = floor(0.5 * (ys[floor(1 + (#ys - 1) * 0.5)] + ys[ceil(1 + (#ys - 1) * 0.5)])) -- rounded
end
return pos, surface_material
return cpos, surface_material
end