mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
HG Landmarks now working.
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user