Fixed problems if an avatar tries to cross regions when the previous cross hasn't completed yet
This caused the client to stop responding, and even the simulators to have problems. The solution is to disallow crossing before the previous cross has completed.bullet-2.82
parent
b481711fa6
commit
4c5d7d4683
|
@ -568,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar alreasy in transit {0} to {1}", av.Name, val);
|
||||
m_log.DebugFormat("[SCENE OBJECT]: Not crossing avatar {0} to {1} because it's already in transit", av.Name, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1692,6 +1692,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
|
||||
client.Name, Scene.Name, AbsolutePosition);
|
||||
|
||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); // Get this ahead of time because IsInTransit modifies 'm_AgentControlFlags'
|
||||
|
||||
IsInTransit = true;
|
||||
try
|
||||
{
|
||||
// Make sure it's not a login agent. We don't want to wait for updates during login
|
||||
if (PresenceType != PresenceType.Npc && (m_teleportFlags & TeleportFlags.ViaLogin) == 0)
|
||||
{
|
||||
|
@ -1720,7 +1725,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
AbsolutePosition = pos;
|
||||
}
|
||||
|
||||
bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
|
||||
if (!MakeRootAgent(AbsolutePosition, flying))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
|
@ -1774,7 +1778,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
|
||||
if (m_agentTransfer != null)
|
||||
{
|
||||
// Note: this call can take a while, because it notifies each of the simulator's neighbours.
|
||||
// It's important that we don't allow the avatar to cross regions meanwhile, as that will
|
||||
// cause serious errors. We've prevented that from happening by setting IsInTransit=true.
|
||||
m_agentTransfer.EnableChildAgents(this);
|
||||
}
|
||||
|
||||
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
|
||||
if (friendsModule != null)
|
||||
|
@ -1794,7 +1803,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
|
||||
// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsInTransit = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3588,8 +3601,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero)
|
||||
return;
|
||||
|
||||
if (!IsInTransit)
|
||||
{
|
||||
if (IsInTransit)
|
||||
return;
|
||||
|
||||
Vector3 pos2 = AbsolutePosition;
|
||||
Vector3 origPosition = pos2;
|
||||
Vector3 vel = Velocity;
|
||||
|
@ -3602,10 +3616,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
pos2.Z = pos2.Z + (vel.Z * timeStep);
|
||||
|
||||
if (!IsInTransit)
|
||||
{
|
||||
if (!m_scene.PositionIsInCurrentRegion(pos2))
|
||||
{
|
||||
if (m_scene.PositionIsInCurrentRegion(pos2))
|
||||
return;
|
||||
|
||||
m_log.DebugFormat("{0} CheckForBorderCrossing: position outside region. {1} in {2} at pos {3}",
|
||||
LogHeader, Name, Scene.Name, pos2);
|
||||
|
||||
|
@ -3633,21 +3646,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This constant has been inferred from experimentation
|
||||
// I'm not sure what this value should be, so I tried a few values.
|
||||
timeStep = 0.04f;
|
||||
pos2 = AbsolutePosition;
|
||||
pos2.X = pos2.X + (vel.X * timeStep);
|
||||
pos2.Y = pos2.Y + (vel.Y * timeStep);
|
||||
// Don't touch the Z
|
||||
m_pos = pos2;
|
||||
m_log.DebugFormat("[SCENE PRESENCE]: In transit m_pos={0}", m_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Given a position, make sure it is within the current region.
|
||||
// If just outside some border, the returned position will be just inside the border on that side.
|
||||
|
|
Loading…
Reference in New Issue