Fix crash on high levels of frost walker (#4423)

Reviewed-on: VoxeLibre/VoxeLibre#4423
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: WillConker <willconker@noreply.git.minetest.land>
Co-committed-by: WillConker <willconker@noreply.git.minetest.land>
This commit is contained in:
WillConker 2024-06-11 19:17:12 +02:00 committed by the-real-herowl
parent 1b0deae026
commit fd4e1484af
1 changed files with 2 additions and 1 deletions

View File

@ -205,7 +205,8 @@ walkover.register_global(function(pos, _, player)
if frost_walker <= 0 then
return
end
local radius = frost_walker + 2
-- 1011 = sqrt(4096000)/2; 4096000 is the max number of nodes for find_nodes_in_area_under_air
local radius = math.min(frost_walker + 2, 1011)
local minp = {x = pos.x - radius, y = pos.y, z = pos.z - radius}
local maxp = {x = pos.x + radius, y = pos.y, z = pos.z + radius}
local positions = minetest.find_nodes_in_area_under_air(minp, maxp, "mcl_core:water_source")