diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1222ac6..6f36c0b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -68,14 +68,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
68 | public ScriptControlled eventControls; | 68 | public ScriptControlled eventControls; |
69 | } | 69 | } |
70 | 70 | ||
71 | public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); | 71 | public delegate void SendCoarseLocationsMethod(UUID scene, ScenePresence presence, List<Vector3> coarseLocations, List<UUID> avatarUUIDs); |
72 | 72 | ||
73 | public class ScenePresence : EntityBase, IScenePresence | 73 | public class ScenePresence : EntityBase, IScenePresence |
74 | { | 74 | { |
75 | // ~ScenePresence() | 75 | // ~ScenePresence() |
76 | // { | 76 | // { |
77 | // m_log.Debug("[SCENE PRESENCE] Destructor called"); | 77 | // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); |
78 | // } | 78 | // } |
79 | |||
79 | private void TriggerScenePresenceUpdated() | 80 | private void TriggerScenePresenceUpdated() |
80 | { | 81 | { |
81 | if (m_scene != null) | 82 | if (m_scene != null) |
@@ -186,7 +187,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
186 | /// </summary> | 187 | /// </summary> |
187 | public bool SitGround { get; private set; } | 188 | public bool SitGround { get; private set; } |
188 | 189 | ||
189 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; | 190 | private SendCoarseLocationsMethod m_sendCoarseLocationsMethod; |
190 | 191 | ||
191 | //private Vector3 m_requestedSitOffset = new Vector3(); | 192 | //private Vector3 m_requestedSitOffset = new Vector3(); |
192 | 193 | ||
@@ -537,7 +538,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
537 | { | 538 | { |
538 | try | 539 | try |
539 | { | 540 | { |
540 | PhysicsActor.Velocity = value; | 541 | PhysicsActor.TargetVelocity = value; |
541 | } | 542 | } |
542 | catch (Exception e) | 543 | catch (Exception e) |
543 | { | 544 | { |
@@ -695,7 +696,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
695 | AttachmentsSyncLock = new Object(); | 696 | AttachmentsSyncLock = new Object(); |
696 | AllowMovement = true; | 697 | AllowMovement = true; |
697 | IsChildAgent = true; | 698 | IsChildAgent = true; |
698 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 699 | m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; |
699 | Animator = new ScenePresenceAnimator(this); | 700 | Animator = new ScenePresenceAnimator(this); |
700 | PresenceType = type; | 701 | PresenceType = type; |
701 | DrawDistance = world.DefaultDrawDistance; | 702 | DrawDistance = world.DefaultDrawDistance; |
@@ -1697,8 +1698,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1697 | // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | 1698 | // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", |
1698 | // Name, pos, m_scene.RegionInfo.RegionName); | 1699 | // Name, pos, m_scene.RegionInfo.RegionName); |
1699 | 1700 | ||
1700 | if (pos.X < 0 || pos.X >= Constants.RegionSize | 1701 | // Allow move to another sub-region within a megaregion |
1701 | || pos.Y < 0 || pos.Y >= Constants.RegionSize | 1702 | Vector2 regionSize; |
1703 | IRegionCombinerModule regionCombinerModule = m_scene.RequestModuleInterface<IRegionCombinerModule>(); | ||
1704 | if (regionCombinerModule != null) | ||
1705 | regionSize = regionCombinerModule.GetSizeOfMegaregion(m_scene.RegionInfo.RegionID); | ||
1706 | else | ||
1707 | regionSize = new Vector2(Constants.RegionSize); | ||
1708 | |||
1709 | if (pos.X < 0 || pos.X >= regionSize.X | ||
1710 | || pos.Y < 0 || pos.Y >= regionSize.Y | ||
1702 | || pos.Z < 0) | 1711 | || pos.Z < 0) |
1703 | return; | 1712 | return; |
1704 | 1713 | ||
@@ -1712,7 +1721,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1712 | // pos.Z = AbsolutePosition.Z; | 1721 | // pos.Z = AbsolutePosition.Z; |
1713 | // } | 1722 | // } |
1714 | 1723 | ||
1715 | float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y]; | 1724 | // Get terrain height for sub-region in a megaregion if necessary |
1725 | int X = (int)((m_scene.RegionInfo.RegionLocX * Constants.RegionSize) + pos.X); | ||
1726 | int Y = (int)((m_scene.RegionInfo.RegionLocY * Constants.RegionSize) + pos.Y); | ||
1727 | UUID target_regionID = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, X, Y).RegionID; | ||
1728 | Scene targetScene = m_scene; | ||
1729 | |||
1730 | if (!SceneManager.Instance.TryGetScene(target_regionID, out targetScene)) | ||
1731 | targetScene = m_scene; | ||
1732 | |||
1733 | float terrainHeight = (float)targetScene.Heightmap[(int)(pos.X % Constants.RegionSize), (int)(pos.Y % Constants.RegionSize)]; | ||
1716 | pos.Z = Math.Max(terrainHeight, pos.Z); | 1734 | pos.Z = Math.Max(terrainHeight, pos.Z); |
1717 | 1735 | ||
1718 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is | 1736 | // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is |
@@ -2432,17 +2450,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2432 | 2450 | ||
2433 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2451 | public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2434 | { | 2452 | { |
2435 | SendCourseLocationsMethod d = m_sendCourseLocationsMethod; | 2453 | SendCoarseLocationsMethod d = m_sendCoarseLocationsMethod; |
2436 | if (d != null) | 2454 | if (d != null) |
2437 | { | 2455 | { |
2438 | d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); | 2456 | d.Invoke(m_scene.RegionInfo.originRegionID, this, coarseLocations, avatarUUIDs); |
2439 | } | 2457 | } |
2440 | } | 2458 | } |
2441 | 2459 | ||
2442 | public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) | 2460 | public void SetSendCoarseLocationMethod(SendCoarseLocationsMethod d) |
2443 | { | 2461 | { |
2444 | if (d != null) | 2462 | if (d != null) |
2445 | m_sendCourseLocationsMethod = d; | 2463 | m_sendCoarseLocationsMethod = d; |
2446 | } | 2464 | } |
2447 | 2465 | ||
2448 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2466 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
@@ -2646,7 +2664,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2646 | #region Significant Movement Method | 2664 | #region Significant Movement Method |
2647 | 2665 | ||
2648 | /// <summary> | 2666 | /// <summary> |
2649 | /// This checks for a significant movement and sends a courselocationchange update | 2667 | /// This checks for a significant movement and sends a coarselocationchange update |
2650 | /// </summary> | 2668 | /// </summary> |
2651 | protected void CheckForSignificantMovement() | 2669 | protected void CheckForSignificantMovement() |
2652 | { | 2670 | { |
@@ -3074,6 +3092,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3074 | cAgent.Anims = Animator.Animations.ToArray(); | 3092 | cAgent.Anims = Animator.Animations.ToArray(); |
3075 | } | 3093 | } |
3076 | catch { } | 3094 | catch { } |
3095 | cAgent.DefaultAnim = Animator.Animations.DefaultAnimation; | ||
3096 | cAgent.AnimState = Animator.Animations.ImplicitDefaultAnimation; | ||
3077 | 3097 | ||
3078 | if (Scene.AttachmentsModule != null) | 3098 | if (Scene.AttachmentsModule != null) |
3079 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); | 3099 | Scene.AttachmentsModule.CopyAttachments(this, cAgent); |
@@ -3145,6 +3165,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3145 | // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? | 3165 | // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? |
3146 | if (cAgent.Anims != null) | 3166 | if (cAgent.Anims != null) |
3147 | Animator.Animations.FromArray(cAgent.Anims); | 3167 | Animator.Animations.FromArray(cAgent.Anims); |
3168 | if (cAgent.DefaultAnim != null) | ||
3169 | Animator.Animations.SetDefaultAnimation(cAgent.DefaultAnim.AnimID, cAgent.DefaultAnim.SequenceNum, UUID.Zero); | ||
3170 | if (cAgent.AnimState != null) | ||
3171 | Animator.Animations.SetImplicitDefaultAnimation(cAgent.AnimState.AnimID, cAgent.AnimState.SequenceNum, UUID.Zero); | ||
3148 | 3172 | ||
3149 | if (Scene.AttachmentsModule != null) | 3173 | if (Scene.AttachmentsModule != null) |
3150 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); | 3174 | Scene.AttachmentsModule.CopyAttachments(cAgent, this); |