Use vector.direction instead of subtract in budding ABM

This commit is contained in:
cora 2024-07-05 18:52:32 +02:00 committed by Elias Åström
parent 1a3e20a22d
commit 8c2435702c

View File

@ -38,14 +38,14 @@ minetest.register_abm({
label = "Spawn Amethyst Bud",
nodenames = {"mcl_amethyst:budding_amethyst_block"},
neighbors = {"air", "group:water"},
interval = 35,
chance = 2,
interval = interval,
chance = chance,
action = function(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_name = check_node.name
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.direction(check_pos, pos))
local new_node = {name = "mcl_amethyst:small_amethyst_bud", param2 = param2}
minetest.swap_node(check_pos, new_node)
end,