From 94d0b77b542f07cdc698c0997791e39e5a8e4848 Mon Sep 17 00:00:00 2001 From: Nils Dagsson Moskopp Date: Sat, 13 Nov 2021 23:29:08 +0100 Subject: [PATCH] Add debug command to crash with minetest.find_nodes_in_area() --- mods/MISC/mcl_engine_workarounds/init.lua | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 mods/MISC/mcl_engine_workarounds/init.lua diff --git a/mods/MISC/mcl_engine_workarounds/init.lua b/mods/MISC/mcl_engine_workarounds/init.lua new file mode 100644 index 00000000..8c966fe4 --- /dev/null +++ b/mods/MISC/mcl_engine_workarounds/init.lua @@ -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 +})