forked from VoxeLibre/VoxeLibre
Merge pull request 'Make cactus mechanisms more MC like (Fix #1741)' (#1851) from NO11/MineClone2:cactus into master
Reviewed-on: MineClone2/MineClone2#1851
This commit is contained in:
commit
872e3e74d3
|
@ -184,6 +184,7 @@ minetest.register_abm({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Cactus mechanisms
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Cactus growth",
|
label = "Cactus growth",
|
||||||
nodenames = {"mcl_core:cactus"},
|
nodenames = {"mcl_core:cactus"},
|
||||||
|
@ -195,9 +196,8 @@ minetest.register_abm({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Make cactus destroy items
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Cactus destroy items",
|
label = "Cactus mechanisms",
|
||||||
nodenames = {"mcl_core:cactus"},
|
nodenames = {"mcl_core:cactus"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
|
@ -208,6 +208,19 @@ minetest.register_abm({
|
||||||
object:remove()
|
object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local posses = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } }
|
||||||
|
for _, p in pairs(posses) do
|
||||||
|
if minetest.registered_nodes[minetest.get_node(vector.new(pos.x + p[1], pos.y, pos.z + p[2])).name].walkable then
|
||||||
|
local posy = pos.y
|
||||||
|
while minetest.get_node(vector.new(pos.x, posy, pos.z)).name == "mcl_core:cactus" do
|
||||||
|
local pos = vector.new(pos.x, posy, pos.z)
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
minetest.add_item(vector.offset(pos, math.random(-0.5, 0.5), 0, math.random(-0.5, 0.5)), "mcl_core:cactus")
|
||||||
|
posy = posy + 1
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue