Skip to content

Commit

Permalink
Support "LLTeleportHandler" "teleport" regionname="home".
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-goodspeed committed Sep 12, 2024
1 parent 499c626 commit a68bb4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion indra/newview/llurldispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ class LLTeleportHandler : public LLCommandHandler, public LLEventAPI
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);
Expand Down Expand Up @@ -328,7 +330,12 @@ class LLTeleportHandler : public LLCommandHandler, public LLEventAPI
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(
Expand Down
3 changes: 2 additions & 1 deletion indra/newview/scripts/lua/require/LLAgent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a68bb4e

Please sign in to comment.