* Fixed misspelling of field in GridService

* Moved TeleportClientHome to EntityTransferModule
slimupdates
Diva Canto 2010-01-18 09:14:19 -08:00
parent b5fcb5e872
commit bbbe9e73cc
5 changed files with 44 additions and 54 deletions

View File

@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
protected bool m_Enabled = false;
protected Scene m_aScene;
protected List<UUID> m_agentsInTransit;
@ -94,6 +94,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_aScene = scene;
scene.RegisterModuleInterface<IEntityTransferModule>(this);
scene.EventManager.OnNewClient += OnNewClient;
}
protected void OnNewClient(IClientAPI client)
{
client.OnTeleportHomeRequest += TeleportHome;
}
public virtual void Close()
@ -499,6 +505,33 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion
#region Teleport Home
public virtual void TeleportHome(UUID id, IClientAPI client)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
OpenSim.Services.Interfaces.PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(client.SessionId);
if (pinfo != null)
{
GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
if (regionInfo == null)
{
// can't find the Home region: Tell viewer and abort
client.SendTeleportFailed("Your home region could not be found.");
return;
}
// a little eekie that this goes back to Scene and with a forced cast, will fix that at some point...
((Scene)(client.Scene)).RequestTeleportLocation(
client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
(uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome));
}
}
#endregion
#region Agent Crossings
public void Cross(ScenePresence agent, bool isFlying)

View File

@ -47,7 +47,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private IHypergridService m_HypergridService;
private IHypergridService HyperGridService
{
@ -84,42 +83,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
public override void PostInitialise()
{
}
public override void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
if (m_aScene == null)
m_aScene = scene;
scene.RegisterModuleInterface<IEntityTransferModule>(this);
}
public override void Close()
{
if (!m_Enabled)
return;
}
public override void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
if (scene == m_aScene)
m_aScene = null;
}
public override void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
}
#endregion

View File

@ -30,6 +30,7 @@ using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
@ -39,6 +40,8 @@ namespace OpenSim.Region.Framework.Interfaces
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position,
Vector3 lookAt, uint teleportFlags);
void TeleportHome(UUID id, IClientAPI client);
void Cross(ScenePresence agent, bool isFlying);
void AgentArrivedAtDestination(UUID agent);

View File

@ -2558,7 +2558,6 @@ namespace OpenSim.Region.Framework.Scenes
{
client.OnTeleportLocationRequest += RequestTeleportLocation;
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
client.OnTeleportHomeRequest += TeleportClientHome;
}
public virtual void SubscribeToClientScriptEvents(IClientAPI client)
@ -2713,7 +2712,7 @@ namespace OpenSim.Region.Framework.Scenes
{
client.OnTeleportLocationRequest -= RequestTeleportLocation;
client.OnTeleportLandmarkRequest -= RequestTeleportLandmark;
client.OnTeleportHomeRequest -= TeleportClientHome;
//client.OnTeleportHomeRequest -= TeleportClientHome;
}
public virtual void UnSubscribeToClientScriptEvents(IClientAPI client)
@ -2760,20 +2759,12 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="client">The IClientAPI for the client</param>
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
{
OpenSim.Services.Interfaces.PresenceInfo pinfo = PresenceService.GetAgent(client.SessionId);
if (pinfo != null)
if (m_teleportModule != null)
m_teleportModule.TeleportHome(agentId, client);
else
{
GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, pinfo.HomeRegionID);
if (regionInfo == null)
{
// can't find the Home region: Tell viewer and abort
client.SendTeleportFailed("Your home-region could not be found.");
return;
}
RequestTeleportLocation(
client, regionInfo.RegionHandle, pinfo.HomePosition, pinfo.HomeLookAt,
(uint)(TPFlags.SetLastToTarget | TPFlags.ViaHome));
m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
client.SendTeleportFailed("Unable to perform teleports on this simulator.");
}
}

View File

@ -109,7 +109,7 @@ namespace OpenSim.Services.GridService
//
// Get it's flags
//
OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["Flags"]);
OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(region.Data["flags"]);
// Is this a reservation?
//