Update master #1

Merged
THE-NERD2 merged 296 commits from VoxeLibre/VoxeLibre:master into master 2024-11-21 19:51:04 +01:00
2 changed files with 25 additions and 15 deletions
Showing only changes of commit 8fd736e0fd - Show all commits

View File

@ -191,12 +191,16 @@ minetest.register_abm({
nodenames = {"mcl_core:cactus"}, nodenames = {"mcl_core:cactus"},
neighbors = {"group:sand"}, neighbors = {"group:sand"},
interval = 25, interval = 25,
chance = 10, chance = 40,
action = function(pos) action = function(pos)
mcl_core.grow_cactus(pos) mcl_core.grow_cactus(pos)
end, end,
}) })
local function is_walkable(pos)
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
return ndef and ndef.walkable
end
minetest.register_abm({ minetest.register_abm({
label = "Cactus mechanisms", label = "Cactus mechanisms",
nodenames = {"mcl_core:cactus"}, nodenames = {"mcl_core:cactus"},
@ -209,18 +213,21 @@ minetest.register_abm({
object:remove() object:remove()
end end
end end
local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } } if is_walkable(vector.offset(pos, 1, 0, 0))
for _, p in pairs(posses) do or is_walkable(vector.offset(pos, -1, 0, 0))
local ndef = minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name] or is_walkable(vector.offset(pos, 0, 0, 1))
if ndef and ndef.walkable then or is_walkable(vector.offset(pos, 0, 0, -1)) then
local posy = pos.y local lpos = vector.copy(pos)
while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do local dx, dy
local pos = vector.new(pos.x, posy, pos.z) while true do
minetest.dig_node(pos) local node = minetest.get_node(lpos)
-- minetest.add_item(vector.offset(pos, math.random(-0.5, 0.5), 0, math.random(-0.5, 0.5)), "mcl_core:cactus") if not node or node.name ~= "mcl_core:cactus" then break end
posy = posy + 1 minetest.dig_node(lpos)
end dx = dx or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5
break dy = dy or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5
local obj = minetest.add_item(vector.offset(lpos, dx, 0.25, dy), "mcl_core:cactus")
obj:set_velocity(vector.new(dx, 1, dy))
lpos.y = lpos.y + 1
end end
end end
end, end,

View File

@ -4656,9 +4656,9 @@ local function register_decorations()
place_on = {"group:sand"}, place_on = {"group:sand"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = -0.012, offset = -0.01,
scale = 0.024, scale = 0.024,
spread = {x = 100, y = 100, z = 100}, spread = vector.new(100, 100, 100),
seed = 257, seed = 257,
octaves = 3, octaves = 3,
persist = 0.6 persist = 0.6
@ -4672,6 +4672,9 @@ local function register_decorations()
"MesaPlateauFM", "MesaPlateauFM_sandlevel"}, "MesaPlateauFM", "MesaPlateauFM_sandlevel"},
height = 1, height = 1,
height_max = 3, height_max = 3,
spawn_by = "air",
check_offset = 1,
num_spawn_by = 16
}) })
-- Sugar canes -- Sugar canes