Do not allow a script to attach a prim if its being sat upon.

This prevents a stack overflow where a get position on the avatar will refer to the attachment which will in turn refer back to the avatar.
This required recording of all sitting avatars on a prim which is done separately from recording the sit target avatar.
Recording HashSet is null if there are no sitting avatars in order to save memory.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-07-09 21:24:32 +01:00
parent 1a2ab7bc69
commit 2eaa6d5ace
7 changed files with 227 additions and 24 deletions

View File

@@ -3401,6 +3401,20 @@ namespace OpenSim.Region.Framework.Scenes
return count;
}
/// <summary>
/// Gets the number of sitting avatars.
/// </summary>
/// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
/// <returns></returns>
public int GetSittingAvatarsCount()
{
int count = 0;
Array.ForEach<SceneObjectPart>(m_parts.GetArray(), p => count += p.GetSittingAvatarsCount());
return count;
}
public override string ToString()
{
return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition);