HG Landmarks now working.
parent
995b893e4c
commit
e33cedfd42
|
@ -35,6 +35,7 @@ namespace OpenSim.Framework
|
|||
public Vector3 Position;
|
||||
public ulong RegionHandle;
|
||||
public UUID RegionID;
|
||||
public string Gatekeeper = string.Empty;
|
||||
public int Version;
|
||||
|
||||
public AssetLandmark(AssetBase a)
|
||||
|
@ -51,6 +52,8 @@ namespace OpenSim.Framework
|
|||
string[] parts = temp.Split('\n');
|
||||
int.TryParse(parts[0].Substring(17, 1), out Version);
|
||||
UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
|
||||
if (parts.Length >= 5)
|
||||
Gatekeeper = parts[4].Replace("gatekeeper ", "");
|
||||
// The position is a vector with spaces as separators ("10.3 32.5 43").
|
||||
// Parse each scalar separately to take into account the system's culture setting.
|
||||
string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' ');
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace OpenSim.Framework
|
|||
IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags);
|
||||
|
||||
public delegate void TeleportLandmarkRequest(
|
||||
IClientAPI remoteClient, UUID regionID, Vector3 position);
|
||||
IClientAPI remoteClient, AssetLandmark lm);
|
||||
|
||||
public delegate void DisconnectUser();
|
||||
|
||||
|
|
|
@ -8301,6 +8301,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
AssetLandmark lm;
|
||||
if (lmid != UUID.Zero)
|
||||
{
|
||||
|
||||
//AssetBase lma = m_assetCache.GetAsset(lmid, false);
|
||||
AssetBase lma = m_assetService.Get(lmid.ToString());
|
||||
|
||||
|
@ -8341,13 +8342,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
TeleportLandmarkRequest handlerTeleportLandmarkRequest = OnTeleportLandmarkRequest;
|
||||
if (handlerTeleportLandmarkRequest != null)
|
||||
{
|
||||
handlerTeleportLandmarkRequest(this, lm.RegionID, lm.Position);
|
||||
handlerTeleportLandmarkRequest(this, lm);
|
||||
}
|
||||
else
|
||||
{
|
||||
//no event handler so cancel request
|
||||
|
||||
|
||||
TeleportCancelPacket tpCancel = (TeleportCancelPacket)PacketPool.Instance.GetPacket(PacketType.TeleportCancel);
|
||||
tpCancel.Info.AgentID = tpReq.Info.AgentID;
|
||||
tpCancel.Info.SessionID = tpReq.Info.SessionID;
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
protected bool m_Enabled = false;
|
||||
protected Scene m_aScene;
|
||||
protected List<Scene> m_Scenes = new List<Scene>();
|
||||
protected List<UUID> m_agentsInTransit;
|
||||
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
||||
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
||||
|
@ -96,6 +97,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
if (m_aScene == null)
|
||||
m_aScene = scene;
|
||||
|
||||
m_Scenes.Add(scene);
|
||||
scene.RegisterModuleInterface<IEntityTransferModule>(this);
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
}
|
||||
|
@ -103,6 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected virtual void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportHomeRequest += TeleportHome;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
|
@ -118,6 +121,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
return;
|
||||
if (scene == m_aScene)
|
||||
m_aScene = null;
|
||||
|
||||
m_Scenes.Remove(scene);
|
||||
}
|
||||
|
||||
public virtual void RegionLoaded(Scene scene)
|
||||
|
@ -127,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Agent Teleports
|
||||
|
@ -556,6 +560,29 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
#endregion
|
||||
|
||||
#region Landmark Teleport
|
||||
/// <summary>
|
||||
/// Tries to teleport agent to landmark.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="position"></param>
|
||||
public virtual void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
|
||||
{
|
||||
GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
// can't find the region: Tell viewer and abort
|
||||
remoteClient.SendTeleportFailed("The teleport destination could not be found.");
|
||||
return;
|
||||
}
|
||||
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
|
||||
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Teleport Home
|
||||
|
||||
public virtual void TeleportHome(UUID id, IClientAPI client)
|
||||
|
|
|
@ -87,6 +87,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
protected override void OnNewClient(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportHomeRequest += TeleportHome;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
|
||||
}
|
||||
|
||||
|
@ -228,6 +229,58 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to teleport agent to landmark.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="position"></param>
|
||||
public override void RequestTeleportLandmark(IClientAPI remoteClient, AssetLandmark lm)
|
||||
{
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
GridRegion info = m_aScene.GridService.GetRegionByUUID(UUID.Zero, lm.RegionID);
|
||||
|
||||
// Local region?
|
||||
if (info != null)
|
||||
{
|
||||
((Scene)(remoteClient.Scene)).RequestTeleportLocation(remoteClient, info.RegionHandle, lm.Position,
|
||||
Vector3.Zero, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Foreign region
|
||||
Scene scene = (Scene)(remoteClient.Scene);
|
||||
GatekeeperServiceConnector gConn = new GatekeeperServiceConnector();
|
||||
GridRegion gatekeeper = new GridRegion();
|
||||
gatekeeper.ServerURI = lm.Gatekeeper;
|
||||
GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID));
|
||||
if (finalDestination != null)
|
||||
{
|
||||
ScenePresence sp = scene.GetScenePresence(remoteClient.AgentId);
|
||||
IEntityTransferModule transferMod = scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
||||
if (transferMod != null && sp != null && eq != null)
|
||||
transferMod.DoTeleport(sp, gatekeeper, finalDestination, lm.Position,
|
||||
Vector3.UnitX, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaLandmark), eq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// can't find the region: Tell viewer and abort
|
||||
remoteClient.SendTeleportFailed("The teleport destination could not be found.");
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IUserAgentVerificationModule
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
suffix = " @ " + m_ThisGatekeeper;
|
||||
Vector3 pos = presence.AbsolutePosition;
|
||||
return String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\ngatekeeper {5}",
|
||||
return String.Format("Landmark version 2\nregion_id {0}\nlocal_pos {1} {2} {3}\nregion_handle {4}\ngatekeeper {5}\n",
|
||||
presence.Scene.RegionInfo.RegionID,
|
||||
pos.X, pos.Y, pos.Z,
|
||||
presence.RegionHandle,
|
||||
|
|
|
@ -2749,7 +2749,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportLocationRequest += RequestTeleportLocation;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
}
|
||||
|
||||
public virtual void SubscribeToClientScriptEvents(IClientAPI client)
|
||||
|
@ -2875,7 +2874,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
|
||||
{
|
||||
client.OnTeleportLocationRequest -= RequestTeleportLocation;
|
||||
client.OnTeleportLandmarkRequest -= RequestTeleportLandmark;
|
||||
//client.OnTeleportLandmarkRequest -= RequestTeleportLandmark;
|
||||
//client.OnTeleportHomeRequest -= TeleportClientHome;
|
||||
}
|
||||
|
||||
|
@ -3925,26 +3924,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to teleport agent to landmark.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="position"></param>
|
||||
public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position)
|
||||
{
|
||||
GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
// can't find the region: Tell viewer and abort
|
||||
remoteClient.SendTeleportFailed("The teleport destination could not be found.");
|
||||
return;
|
||||
}
|
||||
|
||||
RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark));
|
||||
}
|
||||
|
||||
public bool CrossAgentToNewRegion(ScenePresence agent, bool isFlying)
|
||||
{
|
||||
if (m_teleportModule != null)
|
||||
|
|
Loading…
Reference in New Issue