forked from Mineclonia/Mineclonia
Add debug command to crash with minetest.find_nodes_in_area()
This commit is contained in:
parent
249cfb8118
commit
94d0b77b54
|
@ -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
|
||||
})
|
Loading…
Reference in New Issue