Merge pull request 'Adjust amethyst bud growth' (#3374) from Amethyst_Bud_Growth into master
Reviewed-on: MineClone2/MineClone2#3374 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
commit
060732cd66
|
@ -36,17 +36,19 @@ local all_directions = {
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Spawn Amethyst Bud",
|
label = "Spawn Amethyst Bud",
|
||||||
nodenames = {"mcl_amethyst:budding_amethyst_block"},
|
nodenames = { "mcl_amethyst:budding_amethyst_block" },
|
||||||
neighbors = {"air", "group:water"},
|
neighbors = { "air", "group:water" },
|
||||||
interval = 20,
|
interval = 34.135, -- 34.135 is 1/2 of 68.27, which is the average time for one bud to grow 1 stage.
|
||||||
chance = 2,
|
chance = 2,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
local check_pos = vector.add(all_directions[math.random(1, #all_directions)], pos)
|
local check_pos = vector.add(all_directions[math.random(1, #all_directions)], pos)
|
||||||
local check_node = minetest.get_node(check_pos)
|
local check_node = minetest.get_node(check_pos)
|
||||||
local check_node_name = check_node.name
|
local check_node_name = check_node.name
|
||||||
if check_node_name ~= "air" and minetest.get_item_group(check_node_name, "water") == 0 then return end
|
if check_node_name ~= "air" and minetest.get_item_group(check_node_name, "water") == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
local param2 = minetest.dir_to_wallmounted(vector.subtract(pos, check_pos))
|
local param2 = minetest.dir_to_wallmounted(vector.subtract(pos, check_pos))
|
||||||
local new_node = {name = "mcl_amethyst:small_amethyst_bud", param2 = param2}
|
local new_node = { name = "mcl_amethyst:small_amethyst_bud", param2 = param2 }
|
||||||
minetest.swap_node(check_pos, new_node)
|
minetest.swap_node(check_pos, new_node)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue