summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerparcelmgr.cpp
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2024-10-31 13:38:41 +0200
committerGitHub <noreply@github.com>2024-10-31 13:38:41 +0200
commit559e2c1bb223e82f29a00a0cf1556e56073dde3a (patch)
treefebccd7b15a8f86145d5deb3a2902adc8ea023cf /indra/newview/llviewerparcelmgr.cpp
parentfcd8b53a573800f11bf0c5585acf89811e731740 (diff)
#2962 allow the script to ‘wait’ for a teleport finished/failed event
Diffstat (limited to 'indra/newview/llviewerparcelmgr.cpp')
-rw-r--r--indra/newview/llviewerparcelmgr.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 8c24b2438b..d92341eb96 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1750,6 +1750,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
{
instance->mTeleportFinishedSignal(instance->mTeleportInProgressPosition, false);
}
+ instance->postTeleportFinished(instance->mTeleportWithinRegion);
+ instance->mTeleportWithinRegion = false;
}
parcel->setParcelEnvironmentVersion(parcel_environment_version);
LL_DEBUGS("ENVIRONMENT") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL;
@@ -2709,6 +2711,8 @@ void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos
// Local teleport. We already have the agent parcel data.
// Emit the signal immediately.
getInstance()->mTeleportFinishedSignal(new_pos, local);
+
+ postTeleportFinished(true);
}
else
{
@@ -2717,12 +2721,14 @@ void LLViewerParcelMgr::onTeleportFinished(bool local, const LLVector3d& new_pos
// Let's wait for the update and then emit the signal.
mTeleportInProgressPosition = new_pos;
mTeleportInProgress = true;
+ mTeleportWithinRegion = local;
}
}
void LLViewerParcelMgr::onTeleportFailed()
{
mTeleportFailedSignal();
+ LLEventPumps::instance().obtain("LLTeleport").post(llsd::map("success", false));
}
bool LLViewerParcelMgr::getTeleportInProgress()
@@ -2730,3 +2736,17 @@ bool LLViewerParcelMgr::getTeleportInProgress()
return mTeleportInProgress // case where parcel data arrives after teleport
|| gAgent.getTeleportState() > LLAgent::TELEPORT_NONE; // For LOCAL, no mTeleportInProgress
}
+
+void LLViewerParcelMgr::postTeleportFinished(bool local)
+{
+ auto post = []() { LLEventPumps::instance().obtain("LLTeleport").post(llsd::map("success", true)); };
+ if (local)
+ {
+ static LLCachedControl<F32> teleport_local_delay(gSavedSettings, "TeleportLocalDelay");
+ LL::Timers::instance().scheduleAfter(post, teleport_local_delay + 0.5f);
+ }
+ else
+ {
+ post();
+ }
+}