diff options
author | Justin Clark-Casey (justincc) | 2012-02-23 22:56:42 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-02-23 22:56:42 +0000 |
commit | 90ea00a1098c918d5eb5a2be2793b109c6622a35 (patch) | |
tree | 9c7749d7addeaa21aae6467a1fd016fba3e13986 | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-90ea00a1098c918d5eb5a2be2793b109c6622a35.zip opensim-SC-90ea00a1098c918d5eb5a2be2793b109c6622a35.tar.gz opensim-SC-90ea00a1098c918d5eb5a2be2793b109c6622a35.tar.bz2 opensim-SC-90ea00a1098c918d5eb5a2be2793b109c6622a35.tar.xz |
Try to resolve some problems with viewers crashing after hitting parcel banlines or freezing on the banline.
This involves
1) On forcible teleport, call m_scene.RequestTeleportLocation() rather than ScenePresence.Teleport() - only EntityTransferModule now should call SP.Teleport()
2) When avatar is being forcibly moved due to banlines, use a 'stop movement' tolerance of 0.2 to requested position rather than 1
This prevents the avatar sometimes being stuck to banlines until they teleport somewhere else.
This aims to fix some problems in http://opensimulator.org/mantis/view.php?id=5822
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 27 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 |
3 files changed, 41 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1c503aa..f6d4b40 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
94 | 94 | ||
95 | // caches ExtendedLandData | 95 | // caches ExtendedLandData |
96 | private Cache parcelInfoCache; | 96 | private Cache parcelInfoCache; |
97 | private Dictionary<UUID, Vector3> forcedPosition = | 97 | |
98 | new Dictionary<UUID, Vector3>(); | 98 | /// <summary> |
99 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | ||
100 | /// </summary> | ||
101 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | ||
99 | 102 | ||
100 | #region INonSharedRegionModule Members | 103 | #region INonSharedRegionModule Members |
101 | 104 | ||
@@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
224 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | 227 | //When the avatar walks into a ban line on the ground, it prevents getting stuck |
225 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | 228 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; |
226 | 229 | ||
227 | |||
228 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | 230 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines |
229 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | 231 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) |
230 | { | 232 | { |
231 | Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | 233 | // m_log.DebugFormat( |
234 | // "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", | ||
235 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
236 | |||
232 | forcedPosition.Remove(remoteClient.AgentId); | 237 | forcedPosition.Remove(remoteClient.AgentId); |
233 | } | 238 | } |
234 | //if we are far away, teleport | 239 | //if we are far away, teleport |
235 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | 240 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) |
236 | { | 241 | { |
237 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | 242 | Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; |
238 | clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); | 243 | // m_log.DebugFormat( |
244 | // "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", | ||
245 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); | ||
246 | |||
247 | m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, | ||
248 | forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); | ||
249 | |||
239 | forcedPosition.Remove(remoteClient.AgentId); | 250 | forcedPosition.Remove(remoteClient.AgentId); |
240 | } | 251 | } |
241 | else | 252 | else |
242 | { | 253 | { |
254 | // m_log.DebugFormat( | ||
255 | // "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", | ||
256 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
257 | |||
243 | //Forces them toward the forced position we want if they aren't there yet | 258 | //Forces them toward the forced position we want if they aren't there yet |
244 | agentData.UseClientAgentPosition = true; | 259 | agentData.UseClientAgentPosition = true; |
245 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | 260 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6187803..cf6e6af 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4699,7 +4699,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4699 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4699 | Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4700 | if (nearestPoint != null) | 4700 | if (nearestPoint != null) |
4701 | { | 4701 | { |
4702 | Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); | 4702 | // m_log.DebugFormat( |
4703 | // "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", | ||
4704 | // avatar.Name, nearestPoint, nearestParcel.LandData.Name); | ||
4705 | |||
4703 | return nearestPoint.Value; | 4706 | return nearestPoint.Value; |
4704 | } | 4707 | } |
4705 | 4708 | ||
@@ -4709,12 +4712,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
4709 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); | 4712 | nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); |
4710 | if (nearestPoint != null) | 4713 | if (nearestPoint != null) |
4711 | { | 4714 | { |
4712 | Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); | 4715 | // m_log.DebugFormat( |
4716 | // "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); | ||
4717 | |||
4713 | return nearestPoint.Value; | 4718 | return nearestPoint.Value; |
4714 | } | 4719 | } |
4715 | 4720 | ||
4716 | //Ultimate backup if we have no idea where they are | 4721 | //Ultimate backup if we have no idea where they are |
4717 | Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); | 4722 | // m_log.DebugFormat( |
4723 | // "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); | ||
4724 | |||
4718 | return avatar.lastKnownAllowedPosition; | 4725 | return avatar.lastKnownAllowedPosition; |
4719 | } | 4726 | } |
4720 | 4727 | ||
@@ -5120,7 +5127,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5120 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); | 5127 | // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); |
5121 | 5128 | ||
5122 | Vector3 agent_control_v3 = new Vector3(); | 5129 | Vector3 agent_control_v3 = new Vector3(); |
5123 | presence.HandleMoveToTargetUpdate(ref agent_control_v3); | 5130 | presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); |
5124 | presence.AddNewMovement(agent_control_v3); | 5131 | presence.AddNewMovement(agent_control_v3); |
5125 | } | 5132 | } |
5126 | } | 5133 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cfdf9f..40c8d06 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | /// <summary> | 1050 | /// <summary> |
1051 | /// | 1051 | /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. |
1052 | /// </summary> | 1052 | /// </summary> |
1053 | /// <param name="pos"></param> | 1053 | /// <param name="pos"></param> |
1054 | public void Teleport(Vector3 pos) | 1054 | public void Teleport(Vector3 pos) |
@@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1522 | } | 1522 | } |
1523 | else if (bAllowUpdateMoveToPosition) | 1523 | else if (bAllowUpdateMoveToPosition) |
1524 | { | 1524 | { |
1525 | if (HandleMoveToTargetUpdate(ref agent_control_v3)) | 1525 | // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a |
1526 | // certain position. It's only check for tolerance on returning to that position is 0.2 | ||
1527 | // rather than 1, at which point it removes its force target. | ||
1528 | if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3)) | ||
1526 | update_movementflag = true; | 1529 | update_movementflag = true; |
1527 | } | 1530 | } |
1528 | } | 1531 | } |
@@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1584 | /// </remarks> | 1587 | /// </remarks> |
1585 | /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> | 1588 | /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> |
1586 | /// <returns>True if movement has been updated in some way. False otherwise.</returns> | 1589 | /// <returns>True if movement has been updated in some way. False otherwise.</returns> |
1587 | public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) | 1590 | public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3) |
1588 | { | 1591 | { |
1589 | // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); | 1592 | // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); |
1590 | 1593 | ||
@@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1601 | // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); | 1604 | // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); |
1602 | 1605 | ||
1603 | // Check the error term of the current position in relation to the target position | 1606 | // Check the error term of the current position in relation to the target position |
1604 | if (distanceToTarget <= 1) | 1607 | if (distanceToTarget <= tolerance) |
1605 | { | 1608 | { |
1606 | // We are close enough to the target | 1609 | // We are close enough to the target |
1607 | AbsolutePosition = MoveToPositionTarget; | 1610 | AbsolutePosition = MoveToPositionTarget; |
@@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1777 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); | 1780 | // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); |
1778 | 1781 | ||
1779 | Vector3 agent_control_v3 = new Vector3(); | 1782 | Vector3 agent_control_v3 = new Vector3(); |
1780 | HandleMoveToTargetUpdate(ref agent_control_v3); | 1783 | HandleMoveToTargetUpdate(1, ref agent_control_v3); |
1781 | AddNewMovement(agent_control_v3); | 1784 | AddNewMovement(agent_control_v3); |
1782 | } | 1785 | } |
1783 | 1786 | ||