several changes to llTeleport so it does HG lms

This commit is contained in:
UbitUmarov
2021-09-15 21:05:00 +01:00
parent 06c8893357
commit a3ab4db5fc
6 changed files with 49 additions and 24 deletions

View File

@@ -85,8 +85,7 @@ namespace OpenSim.Framework
public delegate void TeleportLocationRequest(
IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags);
public delegate void TeleportLandmarkRequest(
IClientAPI remoteClient, AssetLandmark lm);
public delegate void TeleportLandmarkRequest(IClientAPI remoteClient, AssetLandmark lm);
public delegate void TeleportCancel(IClientAPI remoteClient);

View File

@@ -1402,7 +1402,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
public void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
{
RequestTeleportLandmark(remoteClient, lm, Vector3.Zero);
}
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
{
GridRegion info = Scene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
@@ -1413,7 +1419,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
}
#endregion
@@ -2568,7 +2574,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(agentCircData.CapsPath);
string reason = String.Empty;
string reason = string.Empty;
EntityTransferContext ctx = new EntityTransferContext();
bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, null, out reason);

View File

@@ -541,14 +541,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Teleporting agent via landmark to {0} region {1} position {2}",
(lm.Gatekeeper == string.Empty) ? "local" : lm.Gatekeeper, lm.RegionID, lm.Position);
if (lm.Gatekeeper == string.Empty)
{
base.RequestTeleportLandmark(remoteClient, lm);
base.RequestTeleportLandmark(remoteClient, lm, lookAt);
return;
}
@@ -594,7 +594,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
DoTeleport(
sp, gatekeeper, finalDestination, lm.Position, Vector3.UnitX,
sp, gatekeeper, finalDestination, lm.Position, lookAt,
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
}
}

View File

@@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name='client'></param>
bool TeleportHome(UUID id, IClientAPI client);
void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt);
/// <summary>
/// Teleport an agent directly to a given region without checking whether the region should be substituted.
/// </summary>

View File

@@ -4996,6 +4996,20 @@ Label_GroupsDone:
EntityTransferModule.Teleport(sp, regionHandle, position, lookAt, teleportFlags);
}
public void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm, Vector3 lookAt)
{
if (EntityTransferModule == null)
{
m_log.DebugFormat("[SCENE]: Unable to perform teleports: no AgentTransferModule is active");
return;
}
ScenePresence sp = GetScenePresence(remoteClient.AgentId);
if (sp == null || sp.IsDeleted || sp.IsInTransit)
return;
EntityTransferModule.RequestTeleportLandmark(remoteClient, lm, lookAt);
}
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
{
if (EntityTransferModule != null)

View File

@@ -5063,14 +5063,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScenePresence presence = World.GetScenePresence(agentId);
if (presence != null && presence.PresenceType != PresenceType.Npc)
{
if (destination == String.Empty)
destination = World.RegionInfo.RegionName;
if (presence.ParentID != 0) // Sitting
return;
if (m_item.PermsGranter == agentId)
{
if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) != 0)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
return;
}
}
@@ -5078,19 +5079,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentGroup.AttachmentPoint != 0 && m_host.OwnerID == presence.UUID)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
return;
}
else
{
// agent must not be a god
if (presence.IsViewerUIGod) return;
// agent must be over the owners land
ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
}
// agent must not be a god
if (presence.IsViewerUIGod)
return;
// agent must be over the owners land
ILandObject agentLand = World.LandChannel.GetLandObject(presence.AbsolutePosition);
ILandObject objectLand = World.LandChannel.GetLandObject(m_host.AbsolutePosition);
if (m_host.OwnerID == objectLand.LandData.OwnerID && m_host.OwnerID == agentLand.LandData.OwnerID)
{
DoLLTeleport(presence, destination, targetPos, targetLookAt);
}
}
}
@@ -5135,11 +5136,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
UUID assetID = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, destination);
// The destinaion is not an asset ID and also doesn't name a landmark.
// The destination is not an asset ID and also doesn't name a landmark.
// Use it as a sim name
if (assetID == UUID.Zero)
{
World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
if(string.IsNullOrEmpty(destination))
World.RequestTeleportLocation(sp.ControllingClient, World.RegionInfo.RegionName, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
else
World.RequestTeleportLocation(sp.ControllingClient, destination, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
return;
}
@@ -5152,7 +5156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
AssetLandmark lm = new AssetLandmark(lma);
World.RequestTeleportLocation(sp.ControllingClient, lm.RegionHandle, targetPos, targetLookAt, (uint)TeleportFlags.ViaLocation);
World.RequestTeleportLandmark(sp.ControllingClient, lm, targetLookAt);
}
public void llTextBox(string agent, string message, int chatChannel)