Added a SendChildAgentDataUpdate call on Teleports, so that the agent at the destination will have all the necessary information.
parent
f08f11fe60
commit
5de40aaf46
|
@ -180,6 +180,24 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
// once we reach here...
|
||||
//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
|
||||
if (isHyperLink) // close them all except this one
|
||||
{
|
||||
|
@ -190,30 +208,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
else // close just a few
|
||||
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)
|
||||
{
|
||||
// TODO Should construct this behind a method
|
||||
capsPath =
|
||||
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
|
||||
+ "/CAPS/" + agent.CapsPath + "0000/";
|
||||
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
|
||||
|
||||
if (eq != null)
|
||||
{
|
||||
|
@ -237,9 +237,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
else
|
||||
{
|
||||
// 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
|
||||
+ "/CAPS/" + agent.CapsPath + "0000/";
|
||||
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
|
||||
}
|
||||
|
||||
//m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
|
||||
|
@ -256,10 +256,17 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
// 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();
|
||||
|
||||
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.
|
||||
// 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
|
||||
Thread.Sleep(3000);
|
||||
Thread.Sleep(4000);
|
||||
|
||||
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
|
||||
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
|
||||
|
@ -303,7 +310,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
|
|||
///
|
||||
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY) || isHyperLink)
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
Thread.Sleep(8000);
|
||||
avatar.Close();
|
||||
CloseConnection(avatar.UUID);
|
||||
}
|
||||
|
|
|
@ -791,33 +791,34 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//avatar.Scene.RemoveCapsHandler(avatar.UUID);
|
||||
|
||||
|
||||
// Let's close some agents
|
||||
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;
|
||||
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
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
|
||||
// OK, it got this agent. Let's close some child agents
|
||||
avatar.CloseChildAgents(newRegionX, newRegionY);
|
||||
|
||||
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
// TODO Should construct this behind a method
|
||||
capsPath =
|
||||
"http://" + reg.ExternalHostName + ":" + reg.HttpPort
|
||||
+ "/CAPS/" + agent.CapsPath + "0000/";
|
||||
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
|
||||
|
||||
if (eq != null)
|
||||
{
|
||||
|
@ -839,9 +840,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
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
|
||||
+ "/CAPS/" + agent.CapsPath + "0000/";
|
||||
+ "/CAPS/" + agentCircuit.CapsPath + "0000/";
|
||||
}
|
||||
|
||||
// Expect avatar crossing is a heavy-duty function at the destination.
|
||||
|
@ -859,6 +860,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// 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();
|
||||
|
||||
m_log.DebugFormat(
|
||||
|
@ -885,7 +893,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// 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
|
||||
// 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
|
||||
avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle, true);
|
||||
|
@ -894,7 +904,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
Thread.Sleep(8000);
|
||||
avatar.Close();
|
||||
CloseConnection(avatar.UUID);
|
||||
}
|
||||
|
|
|
@ -2571,6 +2571,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
ControllingClient.SendAdminResponse(token, (uint)m_godlevel);
|
||||
}
|
||||
|
||||
#region Child Agent Updates
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
@ -2581,23 +2582,35 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if (!IsChildAgent)
|
||||
return;
|
||||
|
||||
//Console.WriteLine(" >>> ChildAgentDataUpdate <<<");
|
||||
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
|
||||
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
|
||||
|
||||
m_DrawDistance = cAgentData.Far;
|
||||
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
|
||||
if (cAgentData.Center!= new Vector3(-1, -1, -1)) // UGH!
|
||||
m_CameraCenter = cAgentData.Center;
|
||||
// new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
|
||||
|
||||
|
||||
m_godlevel = cAgentData.GodLevel;
|
||||
if (cAgentData.Center != new Vector3(-1, -1, -1))
|
||||
m_avHeight = cAgentData.Size.Z;
|
||||
//SetHeight(cAgentData.AVHeight);
|
||||
|
||||
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.
|
||||
if (m_scene.m_seeIntoRegionFromNeighbor)
|
||||
m_pendingObjects = null;
|
||||
|
@ -2607,6 +2620,44 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
//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>
|
||||
/// Handles part of the PID controller function for moving an avatar.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue