Use `remove_node` instead of `dig_node` in mcl_core ABMs (fixes #4628) (#4629)

The mycelium ABM has been left untouched because of the potential destructiveness. If we ever find that to be an issue, it can be fixed as part of a bigger PR.

Reviewed-on: VoxeLibre/VoxeLibre#4629
Reviewed-by: teknomunk <teknomunk@protonmail.com>
Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com>
Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
This commit is contained in:
Mikita Wiśniewski 2024-09-19 18:54:39 +02:00 committed by the-real-herowl
parent 011be754ca
commit 513413afc7
1 changed files with 3 additions and 2 deletions

View File

@ -161,7 +161,7 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider)
liquid_flow_action(pos, "water", function(pos)
drop_attached_node(pos)
minetest.dig_node(pos)
minetest.remove_node(pos)
end)
end,
})
@ -217,7 +217,8 @@ minetest.register_abm({
while true do
local node = minetest.get_node(lpos)
if not node or node.name ~= "mcl_core:cactus" then break end
minetest.dig_node(lpos)
-- minetest.dig_node ignores protected nodes and causes infinite drop (#4628)
minetest.remove_node(lpos)
dx = dx or ((math.random(0,1)-0.5) * math.sqrt(math.random())) * 1.5
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")