diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-10-04 18:33:28 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-10-04 18:34:48 +0300 |
commit | 5836d8835f88af8b82154a48bcf1281937ed1f04 (patch) | |
tree | fdcced3cc76e78051c1829ce9003e71a5cfd6b9b /indra/newview/scripts/lua/require/LLAgent.lua | |
parent | e093a98f86ad46374f5067adb616a2aead73eff5 (diff) |
Lua api to get info about nearby avatars and objects
Diffstat (limited to 'indra/newview/scripts/lua/require/LLAgent.lua')
-rw-r--r-- | indra/newview/scripts/lua/require/LLAgent.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua index 4a1132fe7e..70f3cdfffb 100644 --- a/indra/newview/scripts/lua/require/LLAgent.lua +++ b/indra/newview/scripts/lua/require/LLAgent.lua @@ -1,8 +1,26 @@ local leap = require 'leap' local mapargs = require 'mapargs' +local result_view = require 'result_view' + +local function result(keys) + local result_table = { + result=result_view(keys.result), + -- call result_table:close() to release result sets before garbage + -- collection or script completion + close = function(self) + result_view.close(keys.result[1]) + end + } + -- When the result_table is destroyed, close its result_views. + return LL.setdtor('LLAgent result', result_table, result_table.close) +end local LLAgent = {} +function LLAgent.getID() + return leap.request('LLAgent', {op = 'getID'}).id +end + function LLAgent.getRegionPosition() return leap.request('LLAgent', {op = 'getPosition'}).region end @@ -95,6 +113,24 @@ function LLAgent.requestStand() leap.send('LLAgent', {op = 'requestStand'}) end +-- Get the nearby avatars in a range of provided "dist", +-- if "dist" is not specified, "RenderFarClip" setting is used +-- reply will contain "result" table with following fields: +-- "id", "global_pos", "region_pos", "name" +function LLAgent.getNearbyAvatarsList(...) + local args = mapargs('dist', ...) + args.op = 'getNearbyAvatarsList' + return result(leap.request('LLAgent', args)) +end + +-- reply will contain "result" table with following fields: +-- "id", "global_pos", "region_pos" +function LLAgent.getNearbyObjectsList(...) + local args = mapargs('dist', ...) + args.op = 'getNearbyObjectsList' + return result(leap.request('LLAgent', args)) +end + -- *************************************************************************** -- Autopilot -- *************************************************************************** |