mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-04-30 13:11:41 -04:00
Get rid of recursive call in default.dig_up
This commit is contained in:
parent
511619253f
commit
4ce5dba268
2 changed files with 19 additions and 6 deletions
|
@ -293,12 +293,25 @@ minetest.register_abm({
|
||||||
-- Dig upwards
|
-- Dig upwards
|
||||||
--
|
--
|
||||||
|
|
||||||
function default.dig_up(pos, node, digger)
|
local in_dig_up = false
|
||||||
|
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
|
if digger == nil then return end
|
||||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
max_height = max_height or tonumber(minetest.settings:get("mapgen_limit")) or 31007
|
||||||
local nn = minetest.get_node(np)
|
|
||||||
if nn.name == node.name then
|
for y = pos.y + 1, max_height do
|
||||||
minetest.node_dig(np, nn, digger)
|
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
|
||||||
|
in_dig_up = true
|
||||||
|
if not minetest.dig_node(up_pos, digger) then
|
||||||
|
in_dig_up = false
|
||||||
|
break
|
||||||
|
end
|
||||||
|
in_dig_up = false
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ default.get_translator = S
|
||||||
-- and avoids obscure, hard to debug runtime errors.
|
-- and avoids obscure, hard to debug runtime errors.
|
||||||
-- This section should be updated before release and older checks can be dropped
|
-- This section should be updated before release and older checks can be dropped
|
||||||
-- when newer ones are introduced.
|
-- when newer ones are introduced.
|
||||||
if ItemStack("").add_wear_by_uses == nil then
|
if not minetest.features.node_interaction_actor then
|
||||||
error("\nThis version of Minetest Game is incompatible with your engine version "..
|
error("\nThis version of Minetest Game is incompatible with your engine version "..
|
||||||
"(which is too old). You should download a version of Minetest Game that "..
|
"(which is too old). You should download a version of Minetest Game that "..
|
||||||
"matches the installed engine version.\n")
|
"matches the installed engine version.\n")
|
||||||
|
|
Loading…
Add table
Reference in a new issue