From cd3920c61b772ec07642d823d09ca353e188edac Mon Sep 17 00:00:00 2001 From: 1F616EMO Date: Mon, 17 Jun 2024 16:59:21 +0800 Subject: [PATCH] Do what it should do --- mods/default/functions.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index c0faf3a5..f70d7842 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -294,12 +294,13 @@ minetest.register_abm({ -- local in_dig_up = false +local mapgen_limit = tonumber(minetest.settings:get("mapgen_limit")) or 31007 function default.dig_up(pos, node, digger, max_height) if in_dig_up then return end -- Avoid excess calls if digger == nil then return end - max_height = max_height or tonumber(minetest.settings:get("mapgen_limit")) or 31007 + max_height = max_height or mapgen_limit - for y = pos.y + 1, max_height do + for y = pos.y + 1, math.min(pos.y + max_height, mapgen_limit) do local up_pos = { x = pos.x, y = y, z = pos.z} local up_node = minetest.get_node(up_pos) if up_node.name == node.name then