Fix a regression to GetSittingAvatars(). Return List<ScenePresence> once more.
parent
a81a1865b5
commit
b412db72be
|
@ -2631,12 +2631,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
group.StopScriptInstances();
|
group.StopScriptInstances();
|
||||||
|
|
||||||
List<UUID> avatars = group.GetSittingAvatars();
|
List<ScenePresence> avatars = group.GetSittingAvatars();
|
||||||
foreach (UUID av in avatars)
|
foreach (ScenePresence av in avatars)
|
||||||
{
|
{
|
||||||
ScenePresence p = GetScenePresence(av);
|
av.StandUp();
|
||||||
if (p != null && p.ParentUUID == UUID.Zero)
|
|
||||||
p.StandUp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectPart[] partList = group.Parts;
|
SceneObjectPart[] partList = group.Parts;
|
||||||
|
|
|
@ -1067,7 +1067,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// No avatar should appear more than once in this list.
|
/// No avatar should appear more than once in this list.
|
||||||
/// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
|
/// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected internal List<UUID> m_sittingAvatars = new List<UUID>();
|
protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -2348,7 +2348,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// new group as no sitting avatars
|
// new group as no sitting avatars
|
||||||
dupe.m_linkedAvatars = new List<ScenePresence>();
|
dupe.m_linkedAvatars = new List<ScenePresence>();
|
||||||
dupe.m_sittingAvatars = new List<UUID>();
|
dupe.m_sittingAvatars = new List<ScenePresence>();
|
||||||
|
|
||||||
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed);
|
||||||
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
|
dupe.m_rootPart.LinkNum = m_rootPart.LinkNum;
|
||||||
|
@ -4821,10 +4821,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// down after it move one place down the list.
|
/// down after it move one place down the list.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
|
/// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns>
|
||||||
public List<UUID> GetSittingAvatars()
|
public List<ScenePresence> GetSittingAvatars()
|
||||||
{
|
{
|
||||||
lock (m_sittingAvatars)
|
lock (m_sittingAvatars)
|
||||||
return new List<UUID>(m_sittingAvatars);
|
return new List<ScenePresence>(m_sittingAvatars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1419,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <value>
|
/// <value>
|
||||||
/// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene.
|
/// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene.
|
||||||
/// </value>
|
/// </value>
|
||||||
private HashSet<UUID> m_sittingAvatars;
|
private HashSet<ScenePresence> m_sittingAvatars;
|
||||||
|
|
||||||
public virtual UUID RegionID
|
public virtual UUID RegionID
|
||||||
{
|
{
|
||||||
|
@ -2212,7 +2212,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
|
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
|
||||||
dupe.Shape.ExtraParams = extraP;
|
dupe.Shape.ExtraParams = extraP;
|
||||||
|
|
||||||
dupe.m_sittingAvatars = new HashSet<UUID>();
|
dupe.m_sittingAvatars = new HashSet<ScenePresence>();
|
||||||
|
|
||||||
// safeguard actual copy is done in sog.copy
|
// safeguard actual copy is done in sog.copy
|
||||||
dupe.KeyframeMotion = null;
|
dupe.KeyframeMotion = null;
|
||||||
|
@ -5543,19 +5543,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// true if the avatar was not already recorded, false otherwise.
|
/// true if the avatar was not already recorded, false otherwise.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
/// <param name='avatarId'></param>
|
/// <param name='avatarId'></param>
|
||||||
protected internal bool AddSittingAvatar(UUID id)
|
protected internal bool AddSittingAvatar(ScenePresence sp)
|
||||||
{
|
{
|
||||||
lock (ParentGroup.m_sittingAvatars)
|
lock (ParentGroup.m_sittingAvatars)
|
||||||
{
|
{
|
||||||
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
|
||||||
SitTargetAvatar = id;
|
SitTargetAvatar = sp.UUID;
|
||||||
|
|
||||||
if (m_sittingAvatars == null)
|
if (m_sittingAvatars == null)
|
||||||
m_sittingAvatars = new HashSet<UUID>();
|
m_sittingAvatars = new HashSet<ScenePresence>();
|
||||||
|
|
||||||
if (m_sittingAvatars.Add(id))
|
if (m_sittingAvatars.Add(sp))
|
||||||
{
|
{
|
||||||
ParentGroup.m_sittingAvatars.Add(id);
|
ParentGroup.m_sittingAvatars.Add(sp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5572,22 +5572,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// true if the avatar was present and removed, false if it was not present.
|
/// true if the avatar was present and removed, false if it was not present.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
/// <param name='avatarId'></param>
|
/// <param name='avatarId'></param>
|
||||||
protected internal bool RemoveSittingAvatar(UUID id)
|
protected internal bool RemoveSittingAvatar(ScenePresence sp)
|
||||||
{
|
{
|
||||||
lock (ParentGroup.m_sittingAvatars)
|
lock (ParentGroup.m_sittingAvatars)
|
||||||
{
|
{
|
||||||
if (SitTargetAvatar == id)
|
if (SitTargetAvatar == sp.UUID)
|
||||||
SitTargetAvatar = UUID.Zero;
|
SitTargetAvatar = UUID.Zero;
|
||||||
|
|
||||||
if (m_sittingAvatars == null)
|
if (m_sittingAvatars == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_sittingAvatars.Remove(id))
|
if (m_sittingAvatars.Remove(sp))
|
||||||
{
|
{
|
||||||
if (m_sittingAvatars.Count == 0)
|
if (m_sittingAvatars.Count == 0)
|
||||||
m_sittingAvatars = null;
|
m_sittingAvatars = null;
|
||||||
|
|
||||||
ParentGroup.m_sittingAvatars.Remove(id);
|
ParentGroup.m_sittingAvatars.Remove(sp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5601,14 +5601,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
|
/// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks>
|
||||||
/// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
|
/// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
|
||||||
public HashSet<UUID> GetSittingAvatars()
|
public HashSet<ScenePresence> GetSittingAvatars()
|
||||||
{
|
{
|
||||||
lock (ParentGroup.m_sittingAvatars)
|
lock (ParentGroup.m_sittingAvatars)
|
||||||
{
|
{
|
||||||
if (m_sittingAvatars == null)
|
if (m_sittingAvatars == null)
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
return new HashSet<UUID>(m_sittingAvatars);
|
return new HashSet<ScenePresence>(m_sittingAvatars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2884,7 +2884,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
|
||||||
m_requestedSitTargetID = 0;
|
m_requestedSitTargetID = 0;
|
||||||
part.RemoveSittingAvatar(UUID);
|
part.RemoveSittingAvatar(this);
|
||||||
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
|
|
||||||
SendAvatarDataToAllAgents();
|
SendAvatarDataToAllAgents();
|
||||||
|
@ -2984,7 +2984,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
|
|
||||||
part.AddSittingAvatar(UUID);
|
part.AddSittingAvatar(this);
|
||||||
|
|
||||||
cameraAtOffset = part.GetCameraAtOffset();
|
cameraAtOffset = part.GetCameraAtOffset();
|
||||||
cameraEyeOffset = part.GetCameraEyeOffset();
|
cameraEyeOffset = part.GetCameraEyeOffset();
|
||||||
|
@ -3132,7 +3132,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
m_AngularVelocity = Vector3.Zero;
|
m_AngularVelocity = Vector3.Zero;
|
||||||
|
|
||||||
part.AddSittingAvatar(UUID);
|
part.AddSittingAvatar(this);
|
||||||
|
|
||||||
Vector3 cameraAtOffset = part.GetCameraAtOffset();
|
Vector3 cameraAtOffset = part.GetCameraAtOffset();
|
||||||
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
|
||||||
|
|
|
@ -98,9 +98,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
|
|
||||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||||
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
|
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
|
||||||
HashSet<UUID> sittingAvatars = part.GetSittingAvatars();
|
HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars();
|
||||||
Assert.That(sittingAvatars.Count, Is.EqualTo(1));
|
Assert.That(sittingAvatars.Count, Is.EqualTo(1));
|
||||||
Assert.That(sittingAvatars.Contains(m_sp.UUID));
|
Assert.That(sittingAvatars.Contains(m_sp));
|
||||||
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
|
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,9 +210,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Assert.That(m_sp.PhysicsActor, Is.Null);
|
Assert.That(m_sp.PhysicsActor, Is.Null);
|
||||||
|
|
||||||
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
|
Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1));
|
||||||
HashSet<UUID> sittingAvatars = part.GetSittingAvatars();
|
HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars();
|
||||||
Assert.That(sittingAvatars.Count, Is.EqualTo(1));
|
Assert.That(sittingAvatars.Count, Is.EqualTo(1));
|
||||||
Assert.That(sittingAvatars.Contains(m_sp.UUID));
|
Assert.That(sittingAvatars.Contains(m_sp));
|
||||||
|
|
||||||
m_sp.StandUp();
|
m_sp.StandUp();
|
||||||
|
|
||||||
|
|
|
@ -617,7 +617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
int actualPrimCount = part.ParentGroup.PrimCount;
|
int actualPrimCount = part.ParentGroup.PrimCount;
|
||||||
List<UUID> sittingAvatars = part.ParentGroup.GetSittingAvatars();
|
List<ScenePresence> sittingAvatars = part.ParentGroup.GetSittingAvatars();
|
||||||
int adjustedPrimCount = actualPrimCount + sittingAvatars.Count;
|
int adjustedPrimCount = actualPrimCount + sittingAvatars.Count;
|
||||||
|
|
||||||
// Special case for a single prim. In this case the linknum is zero. However, this will not match a single
|
// Special case for a single prim. In this case the linknum is zero. However, this will not match a single
|
||||||
|
@ -646,11 +646,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScenePresence sp = World.GetScenePresence(sittingAvatars[linknum - actualPrimCount - 1]);
|
return sittingAvatars[linknum - actualPrimCount - 1];
|
||||||
if (sp != null)
|
|
||||||
return sp;
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4146,7 +4142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(id => id == agentID) != null)
|
if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null)
|
||||||
{
|
{
|
||||||
// When agent is sitting, certain permissions are implicit if requested from sitting agent
|
// When agent is sitting, certain permissions are implicit if requested from sitting agent
|
||||||
implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
|
implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION |
|
||||||
|
@ -6915,11 +6911,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (UUID.TryParse(id, out key))
|
if (UUID.TryParse(id, out key))
|
||||||
{
|
{
|
||||||
ScenePresence av = World.GetScenePresence(key);
|
ScenePresence av = World.GetScenePresence(key);
|
||||||
List<UUID> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
|
List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars();
|
||||||
|
|
||||||
if (av != null)
|
if (av != null)
|
||||||
{
|
{
|
||||||
if (sittingAvatars.Contains(key))
|
if (sittingAvatars.Contains(av))
|
||||||
{
|
{
|
||||||
// if the avatar is sitting on this object, then
|
// if the avatar is sitting on this object, then
|
||||||
// we can unsit them. We don't want random scripts unsitting random people
|
// we can unsit them. We don't want random scripts unsitting random people
|
||||||
|
@ -10316,9 +10312,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetNumberOfPrims()
|
public LSL_Integer llGetNumberOfPrims()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
int avatarCount = m_host.ParentGroup.GetLinkedAvatars().Count;
|
|
||||||
|
|
||||||
return m_host.ParentGroup.PrimCount + avatarCount;
|
return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14457,7 +14452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
UUID userId = UUID.Zero;
|
UUID userId = UUID.Zero;
|
||||||
int msAvailable = 0;
|
int msAvailable = 0;
|
||||||
// Throttle per owner when attachment or "vehicle" (sat upon)
|
// Throttle per owner when attachment or "vehicle" (sat upon)
|
||||||
if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatars().Count > 0)
|
if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatarsCount() > 0)
|
||||||
{
|
{
|
||||||
userId = m_host.OwnerID;
|
userId = m_host.OwnerID;
|
||||||
msAvailable = m_msPerAvatarInCastRay;
|
msAvailable = m_msPerAvatarInCastRay;
|
||||||
|
|
Loading…
Reference in New Issue