Merge branch 'master' into feature/15-add-mineral-waters-under

This commit is contained in:
Juraj Vajda 2024-02-14 17:02:22 -05:00
commit e052cc4bf0
7 changed files with 238 additions and 285 deletions

View File

@ -2173,3 +2173,12 @@ function Everness.find_irecursive(table, c_id)
return found return found
end end
---Merge two tables with key/value pair
---@param t1 table
---@param t2 table
---@return table
function Everness.mergeTables(t1, t2)
for k, v in pairs(t2) do t1[k] = v end
return t1
end

View File

@ -243,63 +243,48 @@ Everness:add_to_queue_on_generated({
local marker_node = minetest.get_node(marker_pos) local marker_node = minetest.get_node(marker_pos)
local place_on_node = minetest.get_node(pos) local place_on_node = minetest.get_node(pos)
if not marker_node then if marker_node and marker_node.name == 'everness:marker' then
return -- remove marker
end minetest.remove_node(marker_pos)
if marker_node.name ~= 'everness:marker' then if table.indexof(bioluminescent_tree_place_on, place_on_node.name) ~= -1 then
-- not a valid "place_on" position (e.g. something else was placed there) -- enough air to place structure ?
return local positions = minetest.find_nodes_in_area(
end vector.new(
pos.x - bioluminescent_tree_size_x,
pos.y - bioluminescent_tree_y_dis,
pos.z - bioluminescent_tree_size_z
),
vector.new(
pos.x + bioluminescent_tree_size_x,
pos.y - bioluminescent_tree_y_dis + coral_bioluminescent_tree_size.y,
pos.z + bioluminescent_tree_size_z
),
{
'air',
'everness:coral_tree'
},
true
)
minetest.remove_node(marker_pos) local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
if table.indexof(bioluminescent_tree_place_on, place_on_node.name) == -1 then -- do not overlap another tree
-- not a valid "place_on" position (e.g. something else was placed there) if #tree == 0 and #air > bioluminescent_tree_safe_volume then
return minetest.place_schematic_on_vmanip(
end vm,
vector.new(marker_pos.x, marker_pos.y - bioluminescent_tree_y_dis, marker_pos.z),
schem_bioluminescent_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size -- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string())
end
-- enough air to place structure ? end
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - bioluminescent_tree_size_x,
pos.y - bioluminescent_tree_y_dis,
pos.z - bioluminescent_tree_size_z
),
vector.new(
pos.x + bioluminescent_tree_size_x,
pos.y - bioluminescent_tree_y_dis + coral_bioluminescent_tree_size.y,
pos.z + bioluminescent_tree_size_z
),
{
'air',
'everness:coral_tree'
},
true
)
local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > bioluminescent_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - bioluminescent_tree_y_dis, marker_pos.z),
schem_bioluminescent_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string())
end end
end end
end end

View File

@ -265,67 +265,58 @@ Everness:add_to_queue_on_generated({
local marker_node = minetest.get_node(marker_pos) local marker_node = minetest.get_node(marker_pos)
local place_on_node = minetest.get_node(pos) local place_on_node = minetest.get_node(pos)
if not marker_node then if marker_node and marker_node.name == 'everness:marker' then
return -- remove marker
end minetest.remove_node(marker_pos)
if marker_node.name ~= 'everness:marker' then if table.indexof(crystal_cluster_place_on, place_on_node.name) ~= -1 then
-- not a valid "place_on" position (e.g. something else was placed there) -- enough air to place structure ?
return local positions = minetest.find_nodes_in_area(
end vector.new(
pos.x - crystal_cluster_size_x,
pos.y,
pos.z - crystal_cluster_size_z
),
vector.new(
pos.x + crystal_cluster_size_x,
pos.y + crystal_cluster_size.y,
pos.z + crystal_cluster_size_z
),
{
'air'
},
true
)
minetest.remove_node(marker_pos) local air = positions.air or {}
if table.indexof(crystal_cluster_place_on, place_on_node.name) == -1 then if #air > crystal_cluster_safe_volume then
-- not a valid "place_on" position (e.g. something else was placed there) local replacements
return local rand_color
end
-- enough air to place structure ? if rand:next(0, 100) < 25 then
local positions = minetest.find_nodes_in_area( local colors = { 'purple', 'cyan' }
vector.new( rand_color = colors[rand:next(1, #colors)]
pos.x - crystal_cluster_size_x,
pos.y,
pos.z - crystal_cluster_size_z
),
vector.new(
pos.x + crystal_cluster_size_x,
pos.y + crystal_cluster_size.y,
pos.z + crystal_cluster_size_z
),
{
'air'
},
true
)
local air = positions.air or {} replacements = {
['everness:crystal_block_orange'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_orange'] = 'everness:crystal_' .. rand_color
}
end
if #air > crystal_cluster_safe_volume then minetest.place_schematic_on_vmanip(
local replacements vm,
local rand_color vector.new(marker_pos.x, marker_pos.y, marker_pos.z),
schem_crystal_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
if rand:next(0, 100) < 25 then -- minetest.log('action', '[Everness] Crystal Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
local colors = { 'purple', 'cyan' } end
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_orange'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_orange'] = 'everness:crystal_' .. rand_color
}
end end
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y, marker_pos.z),
schem_crystal_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Crystal Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
end end
end end
@ -339,84 +330,75 @@ Everness:add_to_queue_on_generated({
local place_on_node = minetest.get_node(pos) local place_on_node = minetest.get_node(pos)
local crystal_sphere_cluster_y_dis = rand:next(5, 9) local crystal_sphere_cluster_y_dis = rand:next(5, 9)
if not marker_node then if marker_node and marker_node.name == 'everness:marker' then
return -- remove marker
end minetest.remove_node(marker_pos)
if marker_node.name ~= 'everness:marker' then if table.indexof(crystal_sphere_cluster_place_on, place_on_node.name) ~= -1 then
-- not a valid "place_on" position (e.g. something else was placed there) -- enough air to place structure ?
return local positions = minetest.find_nodes_in_area(
end vector.new(
pos.x - crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis,
pos.z - crystal_sphere_cluster_size_z
),
vector.new(
pos.x + crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis + crystal_sphere_cluster_size.y,
pos.z + crystal_sphere_cluster_size_z
),
{
'air',
'everness:coral_tree',
'everness:crystal_block_orange',
'everness:crystal_block_purple',
'everness:crystal_block_cyan',
},
true
)
minetest.remove_node(marker_pos) local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
local block_orange = positions['everness:crystal_block_orange'] or {}
local block_purple = positions['everness:crystal_block_purple'] or {}
local block_cyan = positions['everness:crystal_block_cyan'] or {}
if table.indexof(crystal_sphere_cluster_place_on, place_on_node.name) == -1 then if
-- not a valid "place_on" position (e.g. something else was placed there) #air > crystal_sphere_cluster_safe_volume
return -- do not overlap
end and not (
#tree > 0
or #block_orange > 0
or #block_purple > 0
or #block_cyan > 0
)
then
local replacements
local rand_color
-- enough air to place structure ? if rand:next(0, 100) < 25 then
local positions = minetest.find_nodes_in_area( local colors = { 'orange', 'cyan' }
vector.new( rand_color = colors[rand:next(1, #colors)]
pos.x - crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis,
pos.z - crystal_sphere_cluster_size_z
),
vector.new(
pos.x + crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis + crystal_sphere_cluster_size.y,
pos.z + crystal_sphere_cluster_size_z
),
{
'air',
'everness:coral_tree',
'everness:crystal_block_orange',
'everness:crystal_block_purple',
'everness:crystal_block_cyan',
},
true
)
local air = positions.air or {} replacements = {
local tree = positions['everness:coral_tree'] or {} ['everness:crystal_block_purple'] = 'everness:crystal_block_' .. rand_color,
local block_orange = positions['everness:crystal_block_orange'] or {} ['everness:crystal_purple'] = 'everness:crystal_' .. rand_color
local block_purple = positions['everness:crystal_block_purple'] or {} }
local block_cyan = positions['everness:crystal_block_cyan'] or {} end
if #tree > 0 minetest.place_schematic_on_vmanip(
or #block_orange > 0 vm,
or #block_purple > 0 vector.new(marker_pos.x, marker_pos.y - crystal_sphere_cluster_y_dis, marker_pos.z),
or #block_cyan > 0 schem_crystal_sphere_cluster,
then 'random',
-- will overlap replacements,
return true,
end 'place_center_x, place_center_z'
)
if #air > crystal_sphere_cluster_safe_volume then -- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
local replacements end
local rand_color
if rand:next(0, 100) < 25 then
local colors = { 'orange', 'cyan' }
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_purple'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_purple'] = 'everness:crystal_' .. rand_color
}
end end
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - crystal_sphere_cluster_y_dis, marker_pos.z),
schem_crystal_sphere_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
end end
end end
end end

View File

@ -249,63 +249,47 @@ Everness:add_to_queue_on_generated({
local marker_node = minetest.get_node(marker_pos) local marker_node = minetest.get_node(marker_pos)
local place_on_node = minetest.get_node(pos) local place_on_node = minetest.get_node(pos)
if not marker_node then if marker_node and marker_node.name == 'everness:marker' then
return -- remove marker
end minetest.remove_node(marker_pos)
if marker_node.name ~= 'everness:marker' then if table.indexof(cursed_dream_tree_place_on, place_on_node.name) ~= -1 then
-- not a valid "place_on" position (e.g. something else was placed there) -- enough air to place structure ?
return local positions = minetest.find_nodes_in_area(
end vector.new(
pos.x - cursed_dream_tree_size_x,
pos.y - cursed_dream_tree_y_dis,
pos.z - cursed_dream_tree_size_z
),
vector.new(
pos.x + cursed_dream_tree_size_x,
pos.y - cursed_dream_tree_y_dis + cursed_dream_tree_size.y,
pos.z + cursed_dream_tree_size_z
),
{
'air',
'everness:dry_tree'
},
true
)
minetest.remove_node(marker_pos) local air = positions.air or {}
local tree = positions['everness:dry_tree'] or {}
if table.indexof(cursed_dream_tree_place_on, place_on_node.name) == -1 then if #air > cursed_dream_tree_safe_volume and #tree <= 1 then
-- not a valid "place_on" position (e.g. something else was placed there) minetest.place_schematic_on_vmanip(
return vm,
end vector.new(marker_pos.x, marker_pos.y - cursed_dream_tree_y_dis, marker_pos.z),
schem_cursed_dream_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size -- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string())
end
-- enough air to place structure ? end
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - cursed_dream_tree_size_x,
pos.y - cursed_dream_tree_y_dis,
pos.z - cursed_dream_tree_size_z
),
vector.new(
pos.x + cursed_dream_tree_size_x,
pos.y - cursed_dream_tree_y_dis + cursed_dream_tree_size.y,
pos.z + cursed_dream_tree_size_z
),
{
'air',
'everness:dry_tree'
},
true
)
local air = positions.air or {}
local tree = positions['everness:dry_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > cursed_dream_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - cursed_dream_tree_y_dis, marker_pos.z),
schem_cursed_dream_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string())
end end
end end
end end

View File

@ -67,7 +67,7 @@ Everness:register_ore({
octaves = 1, octaves = 1,
persist = 0.0 persist = 0.0
}, },
biomes = { 'everness_forsaken_tundra_ocean' } biomes = { 'everness:forsaken_tundra_ocean' }
}) })
-- --
@ -87,7 +87,7 @@ Everness:register_decoration({
octaves = 3, octaves = 3,
persist = 0.7, persist = 0.7,
}, },
biomes = { 'everness_forsaken_tundra_ocean' }, biomes = { 'everness:forsaken_tundra_ocean' },
y_max = y_max, y_max = y_max,
y_min = y_min, y_min = y_min,
place_offset_y = -1, place_offset_y = -1,

View File

@ -308,63 +308,47 @@ Everness:add_to_queue_on_generated({
local marker_node = minetest.get_node(marker_pos) local marker_node = minetest.get_node(marker_pos)
local place_on_node = minetest.get_node(pos) local place_on_node = minetest.get_node(pos)
if not marker_node then if marker_node and marker_node.name == 'everness:marker' then
return -- remove marker
end minetest.remove_node(marker_pos)
if marker_node.name ~= 'everness:marker' then if table.indexof(willow_tree_place_on, place_on_node.name) ~= -1 then
-- not a valid "place_on" position (e.g. something else was placed there) -- enough air to place structure ?
return local positions = minetest.find_nodes_in_area(
end vector.new(
pos.x - size_x,
pos.y - y_dis,
pos.z - size_z
),
vector.new(
pos.x + size_x,
pos.y - y_dis + size.y,
pos.z + size_z
),
{
'air',
'everness:willow_tree'
},
true
)
minetest.remove_node(marker_pos) local air = positions.air or {}
local tree = positions['everness:willow_tree'] or {}
if table.indexof(willow_tree_place_on, place_on_node.name) == -1 then if #air > safe_volume and #tree == 0 then
-- not a valid "place_on" position (e.g. something else was placed there) minetest.place_schematic_on_vmanip(
return vm,
end vector.new(marker_pos.x, marker_pos.y - y_dis, marker_pos.z),
willow_tree_schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size -- minetest.log('action', '[Everness] Willow Tree was placed at ' .. pos:to_string())
end
-- enough air to place structure ? end
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - size_x,
pos.y - y_dis,
pos.z - size_z
),
vector.new(
pos.x + size_x,
pos.y - y_dis + size.y,
pos.z + size_z
),
{
'air',
'everness:willow_tree'
},
true
)
local air = positions.air or {}
local tree = positions['everness:willow_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - y_dis, marker_pos.z),
willow_tree_schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Willow Tree was placed at ' .. pos:to_string())
end end
end end
end end

View File

@ -58,6 +58,11 @@ local function register_vine(name, def, overrides)
-- ALL -- ALL
flammable = 2, flammable = 2,
} }
if _overrides.groups then
Everness.mergeTables(_def.groups, _overrides.groups)
end
-- MCL -- MCL
_def._mcl_shears_drop = true _def._mcl_shears_drop = true
_def._mcl_blast_resistance = 0.2 _def._mcl_blast_resistance = 0.2
@ -66,7 +71,7 @@ local function register_vine(name, def, overrides)
return false return false
end end
_def.sounds = Everness.node_sound_leaves_defaults() _def.sounds = Everness.node_sound_leaves_defaults()
_def.waving = 2 _def.waving = 1
_def.on_destruct = function(pos) _def.on_destruct = function(pos)
local pos_below = vector.new(pos.x, pos.y - 1, pos.z) local pos_below = vector.new(pos.x, pos.y - 1, pos.z)
local node_below = minetest.get_node(pos_below) local node_below = minetest.get_node(pos_below)
@ -183,6 +188,10 @@ register_vine('bulb_vine', {
register_vine('willow_vine', { register_vine('willow_vine', {
description = S('Willow Vine') description = S('Willow Vine')
}, {
groups = {
falling_vines = 0
}
}) })
-- Eye Vine -- Eye Vine