Compare commits

...

1 Commits

Author SHA1 Message Date
Nils Dagsson Moskopp 94d0b77b54
Add debug command to crash with minetest.find_nodes_in_area() 2021-11-14 01:08:48 +01:00
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
local S = minetest.get_translator("mcl_engine_workarounds")
minetest.register_chatcommand("crash_with_find_nodes_in_area", {
description = S("Try crashing the game using minetest.find_nodes_in_area()."),
privs = { debug = true },
func = function(name)
-- In vanilla client, the map is only ever visible until x=31007
local pos = { x=0, y=0, z=0 }
local radius = 1
local minp = pos -- vector.subtract(pos, radius)
local maxp = pos -- vector.add(pos, radius)
local vm = minetest.get_voxel_manip()
local data = vm:read_from_map(
minp,
maxp
)
local c_air = minetest.get_content_id("mcl_core:bedrock")
data[0] = c_air
vm:set_data(data)
vm:write_to_map(true)
local npos, nnum = minetest.find_nodes_in_area(
minp,
maxp,
{ "mcl_core:bedrock" }
)
minetest.debug(nnum["mcl_core:bedrock"])
end
})