summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/require/LLAgent.lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-09-16 20:29:53 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-09-26 12:29:56 +0300
commitb6cbad1cf6c6ae6293825da776ce2191175d4632 (patch)
treee5664ae54d51c731c71ca2fc17108a72d605b45f /indra/newview/scripts/lua/require/LLAgent.lua
parent27e282db0db95f590b69509f420a9b40977cf977 (diff)
Lua api for autopilot functions
Diffstat (limited to 'indra/newview/scripts/lua/require/LLAgent.lua')
-rw-r--r--indra/newview/scripts/lua/require/LLAgent.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua
index 5cee998fcd..7b12493acc 100644
--- a/indra/newview/scripts/lua/require/LLAgent.lua
+++ b/indra/newview/scripts/lua/require/LLAgent.lua
@@ -80,4 +80,53 @@ function LLAgent.teleport(...)
return leap.request('LLTeleportHandler', args).message
end
+function LLAgent.requestSit(...)
+ local args = mapargs('obj_uuid,position', ...)
+ args.op = 'requestSit'
+ return leap.request('LLAgent', args)
+end
+
+function LLAgent.requestStand()
+ leap.send('LLAgent', {op = 'requestStand'})
+end
+
+-- Start the autopilot to move to "target_global" location using specified parameters
+-- LLAgent.startAutoPilot{ target_global array of target global {x, y, z} position
+-- [, allow_flying] allow flying during autopilot [default: true]
+-- [, stop_distance] target maximum distance from target [default: autopilot guess]
+-- [, behavior_name] name of the autopilot behavior [default: (script name)]
+-- [, target_rotation] array of [x, y, z, w] quaternion values [default: no target]
+-- [, rotation_threshold] target maximum angle from target facing rotation [default: 0.03 radians]
+function LLAgent.startAutoPilot(...)
+ local args = mapargs('target_global,allow_flying,stop_distance,behavior_name,target_rotation,rotation_threshold', ...)
+ args.op = 'startAutoPilot'
+ leap.send('LLAgent', args)
+end
+
+-- Update target location for currently running autopilot
+function LLAgent.setAutoPilotTarget(target_global)
+ leap.send('LLAgent', {op = 'setAutoPilotTarget', target_global=target_global})
+end
+
+-- Start the autopilot to move to the specified target location
+-- either "leader_id" (uuid of target) or "avatar_name" (avatar full name) should be specified
+-- "allow_flying" [default: true], "stop_distance" [default: autopilot guess]
+function LLAgent.startFollowPilot(...)
+ local args = mapargs('leader_id,avatar_name,allow_flying,stop_distance', ...)
+ args.op = 'startFollowPilot'
+ return leap.request('LLAgent', args)
+end
+
+-- Stop the autopilot system: "user_cancel" indicates whether or not to act as though user canceled autopilot [default: false]
+function LLAgent.stopAutoPilot(...)
+ local args = mapargs('user_cancel', ...)
+ args.op = 'stopAutoPilot'
+ leap.send('LLAgent', args)
+end
+
+-- Get information about current state of the autopilot
+function LLAgent.getAutoPilot()
+ return leap.request('LLAgent', {op = 'getAutoPilot'})
+end
+
return LLAgent