Renamed IAgentTransferModule to IEntityTransferModule -- accounts for objects too.

slimupdates
Diva Canto 2010-01-15 17:14:48 -08:00
parent 8d5a5d6a4d
commit 4ac3c0e81b
5 changed files with 55 additions and 42 deletions

View File

@ -44,9 +44,9 @@ using OpenMetaverse;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
namespace OpenSim.Region.CoreModules.Agent.AgentTransfer namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
public class AgentTransferModule : ISharedRegionModule, IAgentTransferModule public class AgentTransferModule : ISharedRegionModule, IEntityTransferModule
{ {
#region ISharedRegionModule #region ISharedRegionModule
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -92,7 +92,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
if (m_aScene == null) if (m_aScene == null)
m_aScene = scene; m_aScene = scene;
scene.RegisterModuleInterface<IAgentTransferModule>(this); scene.RegisterModuleInterface<IEntityTransferModule>(this);
} }
public virtual void Close() public virtual void Close()
@ -192,6 +192,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8); uint oldRegionY = (((uint)(sp.Scene.RegionInfo.RegionHandle)) >> 8);
ulong destinationHandle = GetRegionHandle(reg); ulong destinationHandle = GetRegionHandle(reg);
GridRegion finalDestination = GetFinalDestination(reg);
if (eq == null) if (eq == null)
sp.ControllingClient.SendTeleportLocationStart(); sp.ControllingClient.SendTeleportLocationStart();
@ -235,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
agentCircuit.child = true; agentCircuit.child = true;
agentCircuit.Appearance = sp.Appearance; agentCircuit.Appearance = sp.Appearance;
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
@ -244,7 +245,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
string reason = String.Empty; string reason = String.Empty;
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason)) if (!m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason))
{ {
sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", sp.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
@ -255,7 +255,7 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
// OK, it got this agent. Let's close some child agents // OK, it got this agent. Let's close some child agents
sp.CloseChildAgents(newRegionX, newRegionY); sp.CloseChildAgents(newRegionX, newRegionY);
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
#region IP Translation for NAT #region IP Translation for NAT
IClientIPEndpoint ipepClient; IClientIPEndpoint ipepClient;
@ -427,6 +427,47 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
} }
} }
protected void KillEntity(Scene scene, uint localID)
{
scene.SendKillObject(localID);
}
protected virtual ulong GetRegionHandle(GridRegion region)
{
return region.RegionHandle;
}
protected virtual GridRegion GetFinalDestination(GridRegion region)
{
return region;
}
protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
{
return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY);
}
protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
{
return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY);
}
protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
{
if (s.TestBorderCross(pos, Cardinals.N))
return true;
if (s.TestBorderCross(pos, Cardinals.S))
return true;
if (s.TestBorderCross(pos, Cardinals.E))
return true;
if (s.TestBorderCross(pos, Cardinals.W))
return true;
return false;
}
#endregion #endregion
#region Enable Child Agent #region Enable Child Agent
@ -1115,20 +1156,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
#region Misc #region Misc
protected bool IsOutsideRegion(Scene s, Vector3 pos)
{
if (s.TestBorderCross(pos, Cardinals.N))
return true;
if (s.TestBorderCross(pos, Cardinals.S))
return true;
if (s.TestBorderCross(pos, Cardinals.E))
return true;
if (s.TestBorderCross(pos, Cardinals.W))
return true;
return false;
}
protected bool WaitForCallback(UUID id) protected bool WaitForCallback(UUID id)
{ {
@ -1167,20 +1194,6 @@ namespace OpenSim.Region.CoreModules.Agent.AgentTransfer
return false; return false;
} }
protected void KillEntity(Scene scene, uint localID)
{
scene.SendKillObject(localID);
}
protected virtual ulong GetRegionHandle(GridRegion region)
{
return region.RegionHandle;
}
protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
{
return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY);
}
#endregion #endregion

View File

@ -43,13 +43,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_sceneList = new List<Scene>(); private List<Scene> m_sceneList = new List<Scene>();
private IAgentTransferModule m_AgentTransferModule; private IEntityTransferModule m_AgentTransferModule;
protected IAgentTransferModule AgentTransferModule protected IEntityTransferModule AgentTransferModule
{ {
get get
{ {
if (m_AgentTransferModule == null) if (m_AgentTransferModule == null)
m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IAgentTransferModule>(); m_AgentTransferModule = m_sceneList[0].RequestModuleInterface<IEntityTransferModule>();
return m_AgentTransferModule; return m_AgentTransferModule;
} }
} }

View File

@ -34,7 +34,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
public interface IAgentTransferModule public interface IEntityTransferModule
{ {
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position, void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position,
Vector3 lookAt, uint teleportFlags); Vector3 lookAt, uint teleportFlags);

View File

@ -315,7 +315,7 @@ namespace OpenSim.Region.Framework.Scenes
protected IConfigSource m_config; protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser; protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule; protected IDialogModule m_dialogModule;
protected IAgentTransferModule m_teleportModule; protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule; protected ICapabilitiesModule m_capsModule;
public ICapabilitiesModule CapsModule public ICapabilitiesModule CapsModule
@ -1218,7 +1218,7 @@ namespace OpenSim.Region.Framework.Scenes
m_serialiser = RequestModuleInterface<IRegionSerialiserModule>(); m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
m_dialogModule = RequestModuleInterface<IDialogModule>(); m_dialogModule = RequestModuleInterface<IDialogModule>();
m_capsModule = RequestModuleInterface<ICapabilitiesModule>(); m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
m_teleportModule = RequestModuleInterface<IAgentTransferModule>(); m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
} }
#endregion #endregion

View File

@ -1110,7 +1110,7 @@ namespace OpenSim.Region.Framework.Scenes
// Create child agents in neighbouring regions // Create child agents in neighbouring regions
if (!m_isChildAgent) if (!m_isChildAgent)
{ {
IAgentTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IAgentTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); m_agentTransfer.EnableChildAgents(this);
else else
@ -2193,7 +2193,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scene.SceneGridService != null) if (m_scene.SceneGridService != null)
{ {
IAgentTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IAgentTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); m_agentTransfer.EnableChildAgents(this);
} }