diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 97 |
1 files changed, 46 insertions, 51 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ec6bb89..cf60c69 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -432,7 +432,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
432 | { | 432 | { |
433 | get | 433 | get |
434 | { | 434 | { |
435 | if (PhysicsActor != null && m_parentID == 0) | 435 | if (PhysicsActor != null) |
436 | { | 436 | { |
437 | m_pos = PhysicsActor.Position; | 437 | m_pos = PhysicsActor.Position; |
438 | 438 | ||
@@ -455,19 +455,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | // in the sim unless the avatar is on a sit target. While | 455 | // in the sim unless the avatar is on a sit target. While |
456 | // on a sit target, m_pos will contain the desired offset | 456 | // on a sit target, m_pos will contain the desired offset |
457 | // without the parent rotation applied. | 457 | // without the parent rotation applied. |
458 | if (ParentID != 0) | 458 | SceneObjectPart sitPart = ParentPart; |
459 | { | 459 | |
460 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); | 460 | if (sitPart != null) |
461 | if (part != null) | 461 | return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); |
462 | { | ||
463 | return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); | ||
464 | } | ||
465 | else | ||
466 | { | ||
467 | return ParentPosition + m_pos; | ||
468 | } | ||
469 | } | ||
470 | } | 462 | } |
463 | |||
471 | return m_pos; | 464 | return m_pos; |
472 | } | 465 | } |
473 | set | 466 | set |
@@ -484,7 +477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | } | 477 | } |
485 | } | 478 | } |
486 | 479 | ||
487 | // Don't update while sitting | 480 | // Don't update while sitting. The PhysicsActor above is null whilst sitting. |
488 | if (ParentID == 0) | 481 | if (ParentID == 0) |
489 | { | 482 | { |
490 | m_pos = value; | 483 | m_pos = value; |
@@ -511,6 +504,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
511 | // There is no offset position when not seated | 504 | // There is no offset position when not seated |
512 | if (ParentID == 0) | 505 | if (ParentID == 0) |
513 | return; | 506 | return; |
507 | |||
514 | m_pos = value; | 508 | m_pos = value; |
515 | } | 509 | } |
516 | } | 510 | } |
@@ -569,12 +563,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
569 | 563 | ||
570 | public bool IsChildAgent { get; set; } | 564 | public bool IsChildAgent { get; set; } |
571 | 565 | ||
572 | public uint ParentID | 566 | /// <summary> |
573 | { | 567 | /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. |
574 | get { return m_parentID; } | 568 | /// </summary> |
575 | set { m_parentID = value; } | 569 | public uint ParentID { get; set; } |
576 | } | 570 | |
577 | private uint m_parentID; | 571 | /// <summary> |
572 | /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null. | ||
573 | /// </summary> | ||
574 | /// <remarks> | ||
575 | /// If you use this property then you must take a reference since another thread could set it to null. | ||
576 | /// </remarks> | ||
577 | public SceneObjectPart ParentPart { get; set; } | ||
578 | 578 | ||
579 | public float Health | 579 | public float Health |
580 | { | 580 | { |
@@ -1751,36 +1751,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
1751 | 1751 | ||
1752 | if (ParentID != 0) | 1752 | if (ParentID != 0) |
1753 | { | 1753 | { |
1754 | SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); | 1754 | SceneObjectPart part = ParentPart; |
1755 | if (part != null) | 1755 | TaskInventoryDictionary taskIDict = part.TaskInventory; |
1756 | if (taskIDict != null) | ||
1756 | { | 1757 | { |
1757 | TaskInventoryDictionary taskIDict = part.TaskInventory; | 1758 | lock (taskIDict) |
1758 | if (taskIDict != null) | ||
1759 | { | 1759 | { |
1760 | lock (taskIDict) | 1760 | foreach (UUID taskID in taskIDict.Keys) |
1761 | { | 1761 | { |
1762 | foreach (UUID taskID in taskIDict.Keys) | 1762 | UnRegisterControlEventsToScript(LocalId, taskID); |
1763 | { | 1763 | taskIDict[taskID].PermsMask &= ~( |
1764 | UnRegisterControlEventsToScript(LocalId, taskID); | 1764 | 2048 | //PERMISSION_CONTROL_CAMERA |
1765 | taskIDict[taskID].PermsMask &= ~( | 1765 | 4); // PERMISSION_TAKE_CONTROLS |
1766 | 2048 | //PERMISSION_CONTROL_CAMERA | ||
1767 | 4); // PERMISSION_TAKE_CONTROLS | ||
1768 | } | ||
1769 | } | 1766 | } |
1770 | } | 1767 | } |
1768 | } | ||
1771 | 1769 | ||
1772 | // Reset sit target. | 1770 | // Reset sit target. |
1773 | if (part.SitTargetAvatar == UUID) | 1771 | if (part.SitTargetAvatar == UUID) |
1774 | part.SitTargetAvatar = UUID.Zero; | 1772 | part.SitTargetAvatar = UUID.Zero; |
1775 | 1773 | ||
1776 | ParentPosition = part.GetWorldPosition(); | 1774 | ParentPosition = part.GetWorldPosition(); |
1777 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); | 1775 | ControllingClient.SendClearFollowCamProperties(part.ParentUUID); |
1778 | } | ||
1779 | 1776 | ||
1780 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); | 1777 | m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); |
1781 | ParentPosition = Vector3.Zero; | 1778 | ParentPosition = Vector3.Zero; |
1782 | 1779 | ||
1783 | ParentID = 0; | 1780 | ParentID = 0; |
1781 | ParentPart = null; | ||
1784 | SendAvatarDataToAllAgents(); | 1782 | SendAvatarDataToAllAgents(); |
1785 | m_requestedSitTargetID = 0; | 1783 | m_requestedSitTargetID = 0; |
1786 | 1784 | ||
@@ -2206,19 +2204,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2206 | // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", | 2204 | // "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", |
2207 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); | 2205 | // Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); |
2208 | } | 2206 | } |
2209 | } | ||
2210 | else | ||
2211 | { | ||
2212 | return; | ||
2213 | } | ||
2214 | 2207 | ||
2215 | ParentID = m_requestedSitTargetID; | 2208 | ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
2209 | ParentID = m_requestedSitTargetID; | ||
2216 | 2210 | ||
2217 | Velocity = Vector3.Zero; | 2211 | Velocity = Vector3.Zero; |
2218 | RemoveFromPhysicalScene(); | 2212 | RemoveFromPhysicalScene(); |
2219 | 2213 | ||
2220 | Animator.TrySetMovementAnimation(sitAnimation); | 2214 | Animator.TrySetMovementAnimation(sitAnimation); |
2221 | SendAvatarDataToAllAgents(); | 2215 | SendAvatarDataToAllAgents(); |
2216 | } | ||
2222 | } | 2217 | } |
2223 | 2218 | ||
2224 | public void HandleAgentSitOnGround() | 2219 | public void HandleAgentSitOnGround() |
@@ -2298,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2298 | { | 2293 | { |
2299 | if (direc.Z > 2.0f) | 2294 | if (direc.Z > 2.0f) |
2300 | { | 2295 | { |
2301 | direc.Z *= 3.0f; | 2296 | direc.Z *= 2.6f; |
2302 | 2297 | ||
2303 | // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. | 2298 | // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. |
2304 | Animator.TrySetMovementAnimation("PREJUMP"); | 2299 | Animator.TrySetMovementAnimation("PREJUMP"); |
@@ -3831,7 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3831 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 3826 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
3832 | if (land != null) | 3827 | if (land != null) |
3833 | { | 3828 | { |
3834 | if (Scene.DEBUG) | 3829 | if (Scene.DebugTeleporting) |
3835 | TeleportFlagsDebug(); | 3830 | TeleportFlagsDebug(); |
3836 | 3831 | ||
3837 | // If we come in via login, landmark or map, we want to | 3832 | // If we come in via login, landmark or map, we want to |