[WIP] Move in_deg_up to start and end of function

Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
This commit is contained in:
1F616EMO~nya 2024-06-25 18:56:51 +08:00 committed by GitHub
parent 0b006fccf9
commit 5ae2b04d72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -305,20 +305,18 @@ function default.dig_up(pos, node, digger, max_height)
if digger == nil then return end if digger == nil then return end
max_height = max_height or 100 max_height = max_height or 100
in_dig_up = true
for y = pos.y + 1, pos.y + max_height do for y = pos.y + 1, pos.y + max_height do
local up_pos = vector.new(pos.x, y, pos.z) local up_pos = vector.new(pos.x, y, pos.z)
local up_node = minetest.get_node(up_pos) local up_node = minetest.get_node(up_pos)
if up_node.name == node.name then if up_node.name ~= node.name then
in_dig_up = true break
end
if not minetest.dig_node(up_pos, digger) then if not minetest.dig_node(up_pos, digger) then
in_dig_up = false
break
end
in_dig_up = false
else
break break
end end
end end
in_dig_up = false
end end