summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-12 12:27:08 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-12 12:27:08 -0400
commita68bb4eb27573a9313169799a188dda3ae765666 (patch)
tree65a867dce9a205141e2ad037d8dfb4014a4e2d74 /indra/newview
parent499c62637f487b673bac86be566588a8ccde388d (diff)
Support "LLTeleportHandler" "teleport" regionname="home".
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llurldispatcher.cpp9
-rw-r--r--indra/newview/scripts/lua/require/LLAgent.lua3
2 files changed, 10 insertions, 2 deletions
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 39a9f0f8bc..166542324d 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -289,6 +289,8 @@ public:
LLEventAPI::add("teleport",
"Teleport to specified [\"regionname\"] at\n"
"specified region-relative [\"x\"], [\"y\"], [\"z\"].\n"
+ "If [\"regionname\"] is \"home\", ignore [\"x\"], [\"y\"], [\"z\"]\n"
+ "and teleport home.\n"
"If [\"regionname\"] omitted, teleport to GLOBAL\n"
"coordinates [\"x\"], [\"y\"], [\"z\"].",
&LLTeleportHandler::from_event);
@@ -328,7 +330,12 @@ public:
void from_event(const LLSD& params) const
{
Response response(LLSD(), params);
- if (params.has("regionname"))
+ if (params["regionname"].asString() == "home")
+ {
+ gAgent.teleportHome();
+ response["message"] = "Teleporting home";
+ }
+ else if (params.has("regionname"))
{
// region specified, coordinates (if any) are region-local
LLVector3 local_pos(
diff --git a/indra/newview/scripts/lua/require/LLAgent.lua b/indra/newview/scripts/lua/require/LLAgent.lua
index 9eebede59f..5cee998fcd 100644
--- a/indra/newview/scripts/lua/require/LLAgent.lua
+++ b/indra/newview/scripts/lua/require/LLAgent.lua
@@ -72,11 +72,12 @@ function LLAgent.getAnimationInfo(item_id)
end
-- Teleport to specified "regionname" at specified region-relative "x", "y", "z".
+-- If "regionname" is "home", ignore "x", "y", "z" and teleport home.
-- If "regionname" omitted, teleport to GLOBAL coordinates "x", "y", "z".
function LLAgent.teleport(...)
local args = mapargs('regionname,x,y,z', ...)
args.op = 'teleport'
- return leap.request('LLTeleportHandler', args)
+ return leap.request('LLTeleportHandler', args).message
end
return LLAgent