From 5ae2b04d729254bd33a3c9693a9c389f72652ba2 Mon Sep 17 00:00:00 2001 From: 1F616EMO~nya Date: Tue, 25 Jun 2024 18:56:51 +0800 Subject: [PATCH] [WIP] Move in_deg_up to start and end of function Co-authored-by: SmallJoker --- mods/default/functions.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index d750565c..308488c0 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -305,20 +305,18 @@ function default.dig_up(pos, node, digger, max_height) if digger == nil then return end max_height = max_height or 100 + in_dig_up = true for y = pos.y + 1, pos.y + max_height do local up_pos = vector.new(pos.x, y, pos.z) local up_node = minetest.get_node(up_pos) - if up_node.name == node.name then - in_dig_up = true - if not minetest.dig_node(up_pos, digger) then - in_dig_up = false - break - end - in_dig_up = false - else + if up_node.name ~= node.name then + break + end + if not minetest.dig_node(up_pos, digger) then break end end + in_dig_up = false end