When an NPC is created, stop telling neighbouring regions to expect a child agent

bulletsim
Justin Clark-Casey (justincc) 2011-08-09 23:11:07 +01:00
parent 795c8e6c22
commit 92e96d394a
11 changed files with 32 additions and 30 deletions

View File

@ -786,7 +786,7 @@ namespace OpenSim.Framework
event DeRezObject OnDeRezObject; event DeRezObject OnDeRezObject;
event Action<IClientAPI> OnRegionHandShakeReply; event Action<IClientAPI> OnRegionHandShakeReply;
event GenericCall1 OnRequestWearables; event GenericCall1 OnRequestWearables;
event GenericCall1 OnCompleteMovementToRegion; event Action<IClientAPI, bool> OnCompleteMovementToRegion;
event UpdateAgent OnPreAgentUpdate; event UpdateAgent OnPreAgentUpdate;
event UpdateAgent OnAgentUpdate; event UpdateAgent OnAgentUpdate;
event AgentRequestSit OnAgentRequestSit; event AgentRequestSit OnAgentRequestSit;

View File

@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ObjectAttach OnObjectAttach; public event ObjectAttach OnObjectAttach;
public event ObjectDeselect OnObjectDetach; public event ObjectDeselect OnObjectDetach;
public event ObjectDrop OnObjectDrop; public event ObjectDrop OnObjectDrop;
public event GenericCall1 OnCompleteMovementToRegion; public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnPreAgentUpdate;
public event UpdateAgent OnAgentUpdate; public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit; public event AgentRequestSit OnAgentRequestSit;
@ -6195,10 +6195,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack)
{ {
GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
if (handlerCompleteMovementToRegion != null) if (handlerCompleteMovementToRegion != null)
{ {
handlerCompleteMovementToRegion(sender); handlerCompleteMovementToRegion(sender, true);
} }
handlerCompleteMovementToRegion = null; handlerCompleteMovementToRegion = null;

View File

@ -1065,10 +1065,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion #endregion
#region Enable Child Agent #region Enable Child Agent
/// <summary> /// <summary>
/// This informs a single neighbouring region about agent "avatar". /// This informs a single neighbouring region about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary> /// </summary>
/// <param name="sp"></param>
/// <param name="region"></param>
public void EnableChildAgent(ScenePresence sp, GridRegion region) public void EnableChildAgent(ScenePresence sp, GridRegion region)
{ {
m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName);
@ -1126,6 +1129,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// This informs all neighbouring regions about agent "avatar". /// This informs all neighbouring regions about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary> /// </summary>
/// <param name="sp"></param>
public void EnableChildAgents(ScenePresence sp) public void EnableChildAgents(ScenePresence sp)
{ {
List<GridRegion> neighbours = new List<GridRegion>(); List<GridRegion> neighbours = new List<GridRegion>();
@ -1312,7 +1316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Utils.LongToUInts(reg.RegionHandle, out x, out y); Utils.LongToUInts(reg.RegionHandle, out x, out y);
x = x / Constants.RegionSize; x = x / Constants.RegionSize;
y = y / Constants.RegionSize; y = y / Constants.RegionSize;
m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")");
string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);

View File

@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event DeRezObject OnDeRezObject; public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply; public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall1 OnRequestWearables; public event GenericCall1 OnRequestWearables;
public event GenericCall1 OnCompleteMovementToRegion; public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnPreAgentUpdate;
public event UpdateAgent OnAgentUpdate; public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit; public event AgentRequestSit OnAgentRequestSit;
@ -663,7 +663,7 @@ namespace OpenSim.Region.Examples.SimpleModule
if (OnCompleteMovementToRegion != null) if (OnCompleteMovementToRegion != null)
{ {
OnCompleteMovementToRegion(this); OnCompleteMovementToRegion(this, true);
} }
} }
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)

View File

@ -1144,10 +1144,14 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Complete Avatar's movement into the region. /// Complete Avatar's movement into the region.
/// This is called upon a very important packet sent from the client,
/// so it's client-controlled. Never call this method directly.
/// </summary> /// </summary>
public void CompleteMovement(IClientAPI client) /// <param name="client"></param>
/// <param name="enableNeighbourChildAgents">
/// If true, send notification to neighbour regions to expect
/// a child agent from the client. These neighbours can be some distance away, depending right now on the
/// configuration of DefaultDrawDistance in the [Startup] section of config
/// </param>
public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents)
{ {
// DateTime startTime = DateTime.Now; // DateTime startTime = DateTime.Now;
@ -1188,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes
SendInitialData(); SendInitialData();
// Create child agents in neighbouring regions // Create child agents in neighbouring regions
if (!m_isChildAgent) if (enableNeighbourChildAgents && !m_isChildAgent)
{ {
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)

View File

@ -677,7 +677,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event DeRezObject OnDeRezObject; public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply; public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall1 OnRequestWearables; public event GenericCall1 OnRequestWearables;
public event GenericCall1 OnCompleteMovementToRegion; public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnPreAgentUpdate;
public event UpdateAgent OnAgentUpdate; public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit; public event AgentRequestSit OnAgentRequestSit;
@ -913,7 +913,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
if (OnCompleteMovementToRegion != null) if (OnCompleteMovementToRegion != null)
{ {
OnCompleteMovementToRegion(this); OnCompleteMovementToRegion(this, true);
} }
} }

View File

@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event DeRezObject OnDeRezObject; public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply; public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall1 OnRequestWearables; public event GenericCall1 OnRequestWearables;
public event GenericCall1 OnCompleteMovementToRegion; public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnPreAgentUpdate;
public event UpdateAgent OnAgentUpdate; public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit; public event AgentRequestSit OnAgentRequestSit;
@ -745,12 +745,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
OnRegionHandShakeReply(this); OnRegionHandShakeReply(this);
} }
if (OnCompleteMovementToRegion != null)
{
OnCompleteMovementToRegion(this);
}
} }
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
{ {
} }

View File

@ -201,13 +201,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
m_log.DebugFormat( m_log.DebugFormat(
"[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
// Shouldn't call this - temporary. sp.CompleteMovement(npcAvatar, false);
sp.CompleteMovement(npcAvatar);
// sp.SendAppearanceToAllOtherAgents();
//
// // Send animations back to the avatar as well
// sp.Animator.SendAnimPack();
} }
else else
{ {

View File

@ -383,7 +383,7 @@ namespace OpenSim.Tests.Common
// Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
ScenePresence scp = scene.GetScenePresence(agentData.AgentID); ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
scp.CompleteMovement(client); scp.CompleteMovement(client, true);
//scp.MakeRootAgent(new Vector3(90, 90, 90), true); //scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return scp; return scp;

View File

@ -95,7 +95,7 @@ namespace OpenSim.Tests.Common.Mock
public event DeRezObject OnDeRezObject; public event DeRezObject OnDeRezObject;
public event Action<IClientAPI> OnRegionHandShakeReply; public event Action<IClientAPI> OnRegionHandShakeReply;
public event GenericCall1 OnRequestWearables; public event GenericCall1 OnRequestWearables;
public event GenericCall1 OnCompleteMovementToRegion; public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnPreAgentUpdate;
public event UpdateAgent OnAgentUpdate; public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit; public event AgentRequestSit OnAgentRequestSit;
@ -455,7 +455,7 @@ namespace OpenSim.Tests.Common.Mock
public void CompleteMovement() public void CompleteMovement()
{ {
OnCompleteMovementToRegion(this); OnCompleteMovementToRegion(this, true);
} }
public virtual void ActivateGesture(UUID assetId, UUID gestureId) public virtual void ActivateGesture(UUID assetId, UUID gestureId)
@ -759,9 +759,10 @@ namespace OpenSim.Tests.Common.Mock
if (OnCompleteMovementToRegion != null) if (OnCompleteMovementToRegion != null)
{ {
OnCompleteMovementToRegion(this); OnCompleteMovementToRegion(this, true);
} }
} }
public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
{ {
} }

View File

@ -1680,6 +1680,7 @@
<ReferencePath>../../../bin/</ReferencePath> <ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Web"/> <Reference name="System.Web"/>
@ -2063,6 +2064,7 @@
<Reference name="OpenMetaverseTypes" path="../../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../../bin/"/> <Reference name="OpenMetaverse" path="../../../../bin/"/>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="Nini" path="../../../../bin/"/> <Reference name="Nini" path="../../../../bin/"/>
@ -2717,6 +2719,7 @@
<ReferencePath>../../../bin/</ReferencePath> <ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/> <Reference name="System"/>
<Reference name="System.Core"/>
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="System.Xml"/> <Reference name="System.Xml"/>
<Reference name="System.Data"/> <Reference name="System.Data"/>