From 19e0528e331d663044c10341f88d5edfc67d4e8b Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 7 Jan 2021 16:04:06 +0100 Subject: [PATCH] Add minetest.get_nearby_objects --- builtin/client/util.lua | 4 ++++ doc/client_lua_api.txt | 2 ++ 2 files changed, 6 insertions(+) diff --git a/builtin/client/util.lua b/builtin/client/util.lua index e85727436..aea15e00f 100644 --- a/builtin/client/util.lua +++ b/builtin/client/util.lua @@ -54,3 +54,7 @@ end function core.close_formspec(formname) return core.show_formspec(formname, "") end + +function core.get_nearby_objects(radius) + return core.get_objects_inside_radius(core.localplayer:get_pos(), radius) +end diff --git a/doc/client_lua_api.txt b/doc/client_lua_api.txt index c7bbe1609..94d40fe2a 100644 --- a/doc/client_lua_api.txt +++ b/doc/client_lua_api.txt @@ -934,6 +934,8 @@ Call these functions only at load time! * `minetest.get_objects_inside_radius(pos, radius)`: returns a list of ClientObjectRefs. * `radius`: using an euclidean metric +* `minetest.get_nearby_objects(radius)` + * alias for minetest.get_objects_inside_radius(minetest.localplayer:get_pos(), radius) * `minetest.disconnect()` * Disconnect from the server and exit to main menu. * Returns `false` if the client is already disconnecting otherwise returns `true`.