From 5836d8835f88af8b82154a48bcf1281937ed1f04 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 4 Oct 2024 18:33:28 +0300 Subject: Lua api to get info about nearby avatars and objects --- indra/newview/scripts/lua/test_nearby_avatars.lua | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 indra/newview/scripts/lua/test_nearby_avatars.lua (limited to 'indra/newview/scripts/lua/test_nearby_avatars.lua') diff --git a/indra/newview/scripts/lua/test_nearby_avatars.lua b/indra/newview/scripts/lua/test_nearby_avatars.lua new file mode 100644 index 0000000000..c7fa686076 --- /dev/null +++ b/indra/newview/scripts/lua/test_nearby_avatars.lua @@ -0,0 +1,25 @@ +inspect = require 'inspect' +LLAgent = require 'LLAgent' + +-- Get the list of nearby avatars and print the info +local nearby_avatars = LLAgent.getNearbyAvatarsList() +if nearby_avatars.result.length == 0 then + print("No avatars nearby") +else + print("Nearby avatars:") + for _, av in pairs(nearby_avatars.result) do + print(av.name ..' ID: ' .. av.id ..' Global pos:' .. inspect(av.global_pos)) + end +end + +-- Get the list of nearby objects in 3m range and print the info +local nearby_objects = LLAgent.getNearbyObjectsList(3) +if nearby_objects.result.length == 0 then + print("No objects nearby") +else + print("Nearby objects:") + local pos={} + for _, obj in pairs(nearby_objects.result) do + print('ID: ' .. obj.id ..' Global pos:' .. inspect(obj.global_pos)) + end +end -- cgit v1.2.3