Added a SendChildAgentDataUpdate call on Teleports, so that the agent at the destination will have all the necessary information.

0.6.2-post-fixes
diva 2008-12-31 00:18:24 +00:00
parent f08f11fe60
commit 5de40aaf46
3 changed files with 111 additions and 43 deletions

View File

@ -180,6 +180,24 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
// once we reach here... // once we reach here...
//avatar.Scene.RemoveCapsHandler(avatar.UUID); //avatar.Scene.RemoveCapsHandler(avatar.UUID);
string capsPath = String.Empty;
AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
agentCircuit.BaseFolder = UUID.Zero;
agentCircuit.InventoryFolder = UUID.Zero;
agentCircuit.startpos = position;
agentCircuit.child = true;
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{
// brand new agent, let's create a new caps seed
agentCircuit.CapsPath = Util.GetRandomCapsPath();
}
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
// Let's close some agents // Let's close some agents
if (isHyperLink) // close them all except this one if (isHyperLink) // close them all except this one
{ {
@ -190,30 +208,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
else // close just a few else // close just a few
avatar.CloseChildAgents(newRegionX, newRegionY); avatar.CloseChildAgents(newRegionX, newRegionY);
string capsPath = String.Empty;
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero;
agent.startpos = position;
agent.child = true;
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{
// brand new agent, let's create a new caps seed
agent.CapsPath = Util.GetRandomCapsPath();
}
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent))
{
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return;
}
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
{ {
// TODO Should construct this behind a method // TODO Should construct this behind a method
capsPath = capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/"; + "/CAPS/" + agentCircuit.CapsPath + "0000/";
if (eq != null) if (eq != null)
{ {
@ -237,9 +237,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
else else
{ {
// child agent already there // child agent already there
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); agentCircuit.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/"; + "/CAPS/" + agentCircuit.CapsPath + "0000/";
} }
//m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId, //m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
@ -256,10 +256,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
// return; // return;
//} //}
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
avatar.CopyTo(agent);
agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
avatar.MakeChildAgent(); avatar.MakeChildAgent();
m_log.DebugFormat( m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", agent.CapsPath, avatar.UUID); "[CAPS]: Sending new CAPS seed url {0} to client {1}", agentCircuit.CapsPath, avatar.UUID);
/// ///
@ -291,7 +298,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
// we send the attachments and close things here. // we send the attachments and close things here.
// It would be nice if the client would tell us when that whole thing is done, so we wouldn't have // It would be nice if the client would tell us when that whole thing is done, so we wouldn't have
// to use this Thread.Sleep voodoo // to use this Thread.Sleep voodoo
Thread.Sleep(3000); Thread.Sleep(4000);
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@ -303,7 +310,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
/// ///
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
{ {
Thread.Sleep(5000); Thread.Sleep(8000);
avatar.Close(); avatar.Close();
CloseConnection(avatar.UUID); CloseConnection(avatar.UUID);
} }

View File

@ -791,33 +791,34 @@ namespace OpenSim.Region.Environment.Scenes
//avatar.Scene.RemoveCapsHandler(avatar.UUID); //avatar.Scene.RemoveCapsHandler(avatar.UUID);
// Let's close some agents
avatar.CloseChildAgents(newRegionX, newRegionY);
string capsPath = String.Empty; string capsPath = String.Empty;
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = UUID.Zero; agentCircuit.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agentCircuit.InventoryFolder = UUID.Zero;
agent.startpos = position; agentCircuit.startpos = position;
agent.child = true; agentCircuit.child = true;
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// brand new agent, let's create a new caps seed // brand new agent, let's create a new caps seed
agent.CapsPath = Util.GetRandomCapsPath(); agentCircuit.CapsPath = Util.GetRandomCapsPath();
} }
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent)) // Let's create an agent there if one doesn't exist yet.
if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
{ {
avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports."); avatar.ControllingClient.SendTeleportFailed("Destination is not accepting teleports.");
return; return;
} }
// OK, it got this agent. Let's close some child agents
avatar.CloseChildAgents(newRegionX, newRegionY);
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
// TODO Should construct this behind a method // TODO Should construct this behind a method
capsPath = capsPath =
"http://" + reg.ExternalHostName + ":" + reg.HttpPort "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/"; + "/CAPS/" + agentCircuit.CapsPath + "0000/";
if (eq != null) if (eq != null)
{ {
@ -839,9 +840,9 @@ namespace OpenSim.Region.Environment.Scenes
} }
else else
{ {
agent.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle); agentCircuit.CapsPath = avatar.Scene.GetChildSeed(avatar.UUID, reg.RegionHandle);
capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort capsPath = "http://" + reg.ExternalHostName + ":" + reg.HttpPort
+ "/CAPS/" + agent.CapsPath + "0000/"; + "/CAPS/" + agentCircuit.CapsPath + "0000/";
} }
// Expect avatar crossing is a heavy-duty function at the destination. // Expect avatar crossing is a heavy-duty function at the destination.
@ -859,6 +860,13 @@ namespace OpenSim.Region.Environment.Scenes
// return; // return;
//} //}
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
avatar.CopyTo(agent);
agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
m_interregionCommsOut.SendChildAgentUpdate(reg.RegionHandle, agent);
avatar.MakeChildAgent(); avatar.MakeChildAgent();
m_log.DebugFormat( m_log.DebugFormat(
@ -885,7 +893,9 @@ namespace OpenSim.Region.Environment.Scenes
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before // trigers a whole shebang of things there, including MakeRoot. So let's wait plenty before
// we send the attachments and close things here. // we send the attachments and close things here.
Thread.Sleep(3000); // We need to change this part of the protocol. The receiving region should tell this region
// when it's ok to continue.
Thread.Sleep(4000);
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true); avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
@ -894,7 +904,7 @@ namespace OpenSim.Region.Environment.Scenes
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{ {
Thread.Sleep(5000); Thread.Sleep(8000);
avatar.Close(); avatar.Close();
CloseConnection(avatar.UUID); CloseConnection(avatar.UUID);
} }

View File

@ -2571,6 +2571,7 @@ namespace OpenSim.Region.Environment.Scenes
ControllingClient.SendAdminResponse(token, (uint)m_godlevel); ControllingClient.SendAdminResponse(token, (uint)m_godlevel);
} }
#region Child Agent Updates
/// <summary> /// <summary>
/// This updates important decision making data about a child agent /// This updates important decision making data about a child agent
/// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
@ -2581,22 +2582,34 @@ namespace OpenSim.Region.Environment.Scenes
if (!IsChildAgent) if (!IsChildAgent)
return; return;
//Console.WriteLine(" >>> ChildAgentDataUpdate <<<");
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize; int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize; int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
m_DrawDistance = cAgentData.Far; m_DrawDistance = cAgentData.Far;
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z); if (cAgentData.Position != new Vector3(-1, -1, -1)) // UGH!!
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
m_CameraCenter = cAgentData.Center; if (cAgentData.Center!= new Vector3(-1, -1, -1)) // UGH!
m_CameraCenter = cAgentData.Center;
// new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
m_godlevel = cAgentData.GodLevel; m_godlevel = cAgentData.GodLevel;
m_avHeight = cAgentData.Size.Z; if (cAgentData.Center != new Vector3(-1, -1, -1))
m_avHeight = cAgentData.Size.Z;
//SetHeight(cAgentData.AVHeight); //SetHeight(cAgentData.AVHeight);
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
// ugh!!!
m_AgentControlFlags = cAgentData.ControlFlags;
if (m_physicsActor != null)
{
m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
}
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true. // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
if (m_scene.m_seeIntoRegionFromNeighbor) if (m_scene.m_seeIntoRegionFromNeighbor)
@ -2607,6 +2620,44 @@ namespace OpenSim.Region.Environment.Scenes
//m_velocity = cAgentData.Velocity; //m_velocity = cAgentData.Velocity;
} }
public void CopyTo(AgentData cAgent)
{
cAgent.AgentID = UUID;
cAgent.RegionHandle = m_scene.RegionInfo.RegionHandle;
cAgent.AlwaysRun = m_setAlwaysRun;
cAgent.Size = new Vector3(0, 0, m_avHeight);
cAgent.Center = m_CameraCenter;
cAgent.Far = m_DrawDistance;
cAgent.GodLevel = (byte)m_godlevel;
cAgent.Position = AbsolutePosition;
cAgent.Velocity = Velocity;
// Throttles
float multiplier = 1;
int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
if (innacurateNeighbors != 0)
{
multiplier = 1f / (float)innacurateNeighbors;
}
if (multiplier <= 0f)
{
multiplier = 0.25f;
}
//m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
if ((m_physicsActor != null) && (m_physicsActor.Flying))
{
m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
}
cAgent.ControlFlags = m_AgentControlFlags;
// Groups???
// Visual Params???
// Animations???
}
#endregion Child Agent Updates
/// <summary> /// <summary>
/// Handles part of the PID controller function for moving an avatar. /// Handles part of the PID controller function for moving an avatar.
/// </summary> /// </summary>