aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs35
1 files changed, 29 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 35e7c45..15795e5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -647,6 +647,18 @@ namespace OpenSim.Region.Framework.Scenes
647 /// </remarks> 647 /// </remarks>
648 public UUID FromFolderID { get; set; } 648 public UUID FromFolderID { get; set; }
649 649
650 /// <summary>
651 /// IDs of all avatars sat on this scene object.
652 /// </summary>
653 /// <remarks>
654 /// We need this so that we can maintain a linkset wide ordering of avatars sat on different parts.
655 /// This must be locked before it is read or written.
656 /// SceneObjectPart sitting avatar add/remove code also locks on this object to avoid race conditions.
657 /// No avatar should appear more than once in this list.
658 /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
659 /// </remarks>
660 protected internal List<UUID> m_sittingAvatars = new List<UUID>();
661
650 #endregion 662 #endregion
651 663
652// ~SceneObjectGroup() 664// ~SceneObjectGroup()
@@ -3564,17 +3576,28 @@ namespace OpenSim.Region.Framework.Scenes
3564 } 3576 }
3565 3577
3566 /// <summary> 3578 /// <summary>
3579 /// Get a copy of the list of sitting avatars on all prims of this object.
3580 /// </summary>
3581 /// <remarks>
3582 /// This is sorted by the order in which avatars sat down. If an avatar stands up then all avatars that sat
3583 /// down after it move one place down the list.
3584 /// </remarks>
3585 /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
3586 public List<UUID> GetSittingAvatars()
3587 {
3588 lock (m_sittingAvatars)
3589 return new List<UUID>(m_sittingAvatars);
3590 }
3591
3592 /// <summary>
3567 /// Gets the number of sitting avatars. 3593 /// Gets the number of sitting avatars.
3568 /// </summary> 3594 /// </summary>
3569 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> 3595 /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
3570 /// <returns></returns> 3596 /// <returns></returns>
3571 public int GetSittingAvatarsCount() 3597 public int GetSittingAvatarsCount()
3572 { 3598 {
3573 int count = 0; 3599 lock (m_sittingAvatars)
3574 3600 return m_sittingAvatars.Count;
3575 Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
3576
3577 return count;
3578 } 3601 }
3579 3602
3580 public override string ToString() 3603 public override string ToString()
@@ -3583,7 +3606,7 @@ namespace OpenSim.Region.Framework.Scenes
3583 } 3606 }
3584 3607
3585 #region ISceneObject 3608 #region ISceneObject
3586 3609
3587 public virtual ISceneObject CloneForNewScene() 3610 public virtual ISceneObject CloneForNewScene()
3588 { 3611 {
3589 SceneObjectGroup sog = Copy(false); 3612 SceneObjectGroup sog = Copy(false);