Add debug command to crash with minetest.find_nodes_in_area()

This commit is contained in:
Nils Dagsson Moskopp 2021-11-13 23:29:08 +01:00
parent 249cfb8118
commit 94d0b77b54
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
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
})