mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-20 01:43:45 +01:00
Improve cactus drops and spawning (#4581)
- breaking cactus will drop randomly in x=-0.75..+0.75, z=-0.75..+0.75 - breaking cactus will have an initial velocity in this direction - if a larger cactus break, they break into the same direction - cactus growth rate reduced 4x, to debuff farm efficiency (will need a larger rebalancing) - cactus only spawns when there is air surrounding it and above, so it does not immediately break - slightly increase the frequency of cactus to counter this The first changes make cactus farms possible. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4581 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: kno10 <erich.schubert@gmail.com> Co-committed-by: kno10 <erich.schubert@gmail.com>
This commit is contained in:
parent
d2b96b6142
commit
8fd736e0fd
@ -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,
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user