From e4d68964ddee0ce26154d8d38c102a96e0adef10 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 21 May 2009 10:41:16 +0000 Subject: Added ITeleportModule interface, and added a hook into scene so if a module has registered this interface then that handles teleport requests rather the SceneCommunicationService. As by default there is no ITeleportModule registered, Teleports by default will still be handled by SceneCommunicationService. --- .../Region/Framework/Interfaces/ITeleportModule.cs | 14 ++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 26 +++++++++++----------- 2 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/Framework/Interfaces/ITeleportModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Interfaces/ITeleportModule.cs b/OpenSim/Region/Framework/Interfaces/ITeleportModule.cs new file mode 100644 index 0000000..5365094 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/ITeleportModule.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using OpenSim.Region.Framework.Scenes; + +namespace OpenSim.Region.Framework.Interfaces +{ + public interface ITeleportModule + { + void RequestTeleportToLocation(ScenePresence avatar, ulong regionHandle, Vector3 position, + Vector3 lookAt, uint teleportFlags); + } +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a650ec5..f18d542 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -147,6 +147,7 @@ namespace OpenSim.Region.Framework.Scenes protected IInterregionCommsOut m_interregionCommsOut; protected IInterregionCommsIn m_interregionCommsIn; protected IDialogModule m_dialogModule; + protected ITeleportModule m_teleportModule; protected ICapabilitiesModule m_capsModule; public ICapabilitiesModule CapsModule @@ -808,6 +809,7 @@ namespace OpenSim.Region.Framework.Scenes m_interregionCommsIn = RequestModuleInterface(); m_dialogModule = RequestModuleInterface(); m_capsModule = RequestModuleInterface(); + m_teleportModule = RequestModuleInterface(); } #endregion @@ -2819,8 +2821,16 @@ namespace OpenSim.Region.Framework.Scenes if (sp != null) { - m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, - position, lookAt, teleportFlags); + if (m_teleportModule != null) + { + m_teleportModule.RequestTeleportToLocation(sp, regionHandle, + position, lookAt, teleportFlags); + } + else + { + m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, + position, lookAt, teleportFlags); + } } } @@ -2841,17 +2851,7 @@ namespace OpenSim.Region.Framework.Scenes return; } - ScenePresence sp = null; - lock (m_scenePresences) - { - if (m_scenePresences.ContainsKey(remoteClient.AgentId)) - sp = m_scenePresences[remoteClient.AgentId]; - } - if (sp != null) - { - m_sceneGridService.RequestTeleportToLocation(sp, info.RegionHandle, - position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); - } + RequestTeleportLocation(remoteClient, info.RegionHandle, position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); } public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) -- cgit v1.1