diff options
author | Kevin Cozens | 2015-09-21 10:58:35 -0400 |
---|---|---|
committer | Kevin Cozens | 2015-09-21 11:00:34 -0400 |
commit | b412db72be9c7a3833550119ba4d1c04b995d188 (patch) | |
tree | 506ca226d36275d9e802249d1bf1f7cbeee6eee4 /OpenSim/Region | |
parent | coment out lludp debug things that only fill up the help screen (diff) | |
download | opensim-SC-b412db72be9c7a3833550119ba4d1c04b995d188.zip opensim-SC-b412db72be9c7a3833550119ba4d1c04b995d188.tar.gz opensim-SC-b412db72be9c7a3833550119ba4d1c04b995d188.tar.bz2 opensim-SC-b412db72be9c7a3833550119ba4d1c04b995d188.tar.xz |
Fix a regression to GetSittingAvatars(). Return List<ScenePresence> once more.
Diffstat (limited to '')
6 files changed, 37 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index db64eb7..74cc161 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2631,12 +2631,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2631 | else | 2631 | else |
2632 | group.StopScriptInstances(); | 2632 | group.StopScriptInstances(); |
2633 | 2633 | ||
2634 | List<UUID> avatars = group.GetSittingAvatars(); | 2634 | List<ScenePresence> avatars = group.GetSittingAvatars(); |
2635 | foreach (UUID av in avatars) | 2635 | foreach (ScenePresence av in avatars) |
2636 | { | 2636 | { |
2637 | ScenePresence p = GetScenePresence(av); | 2637 | av.StandUp(); |
2638 | if (p != null && p.ParentUUID == UUID.Zero) | ||
2639 | p.StandUp(); | ||
2640 | } | 2638 | } |
2641 | 2639 | ||
2642 | SceneObjectPart[] partList = group.Parts; | 2640 | SceneObjectPart[] partList = group.Parts; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e860862..dcbaeb7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1067,7 +1067,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1067 | /// No avatar should appear more than once in this list. | 1067 | /// No avatar should appear more than once in this list. |
1068 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. | 1068 | /// Do not manipulate this list directly - use the Add/Remove sitting avatar methods on SceneObjectPart. |
1069 | /// </remarks> | 1069 | /// </remarks> |
1070 | protected internal List<UUID> m_sittingAvatars = new List<UUID>(); | 1070 | protected internal List<ScenePresence> m_sittingAvatars = new List<ScenePresence>(); |
1071 | 1071 | ||
1072 | #endregion | 1072 | #endregion |
1073 | 1073 | ||
@@ -2348,7 +2348,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2348 | 2348 | ||
2349 | // new group as no sitting avatars | 2349 | // new group as no sitting avatars |
2350 | dupe.m_linkedAvatars = new List<ScenePresence>(); | 2350 | dupe.m_linkedAvatars = new List<ScenePresence>(); |
2351 | dupe.m_sittingAvatars = new List<UUID>(); | 2351 | dupe.m_sittingAvatars = new List<ScenePresence>(); |
2352 | 2352 | ||
2353 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); | 2353 | dupe.CopyRootPart(m_rootPart, OwnerID, GroupID, userExposed); |
2354 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; | 2354 | dupe.m_rootPart.LinkNum = m_rootPart.LinkNum; |
@@ -4821,10 +4821,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4821 | /// down after it move one place down the list. | 4821 | /// down after it move one place down the list. |
4822 | /// </remarks> | 4822 | /// </remarks> |
4823 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> | 4823 | /// <returns>A list of the sitting avatars. Returns an empty list if there are no sitting avatars.</returns> |
4824 | public List<UUID> GetSittingAvatars() | 4824 | public List<ScenePresence> GetSittingAvatars() |
4825 | { | 4825 | { |
4826 | lock (m_sittingAvatars) | 4826 | lock (m_sittingAvatars) |
4827 | return new List<UUID>(m_sittingAvatars); | 4827 | return new List<ScenePresence>(m_sittingAvatars); |
4828 | } | 4828 | } |
4829 | 4829 | ||
4830 | /// <summary> | 4830 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ea96d9e..d1a6692 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1419,7 +1419,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1419 | /// <value> | 1419 | /// <value> |
1420 | /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. | 1420 | /// null if there are no sitting avatars. This is to save us create a hashset for every prim in a scene. |
1421 | /// </value> | 1421 | /// </value> |
1422 | private HashSet<UUID> m_sittingAvatars; | 1422 | private HashSet<ScenePresence> m_sittingAvatars; |
1423 | 1423 | ||
1424 | public virtual UUID RegionID | 1424 | public virtual UUID RegionID |
1425 | { | 1425 | { |
@@ -2212,7 +2212,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2212 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 2212 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
2213 | dupe.Shape.ExtraParams = extraP; | 2213 | dupe.Shape.ExtraParams = extraP; |
2214 | 2214 | ||
2215 | dupe.m_sittingAvatars = new HashSet<UUID>(); | 2215 | dupe.m_sittingAvatars = new HashSet<ScenePresence>(); |
2216 | 2216 | ||
2217 | // safeguard actual copy is done in sog.copy | 2217 | // safeguard actual copy is done in sog.copy |
2218 | dupe.KeyframeMotion = null; | 2218 | dupe.KeyframeMotion = null; |
@@ -5543,19 +5543,19 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5543 | /// true if the avatar was not already recorded, false otherwise. | 5543 | /// true if the avatar was not already recorded, false otherwise. |
5544 | /// </returns> | 5544 | /// </returns> |
5545 | /// <param name='avatarId'></param> | 5545 | /// <param name='avatarId'></param> |
5546 | protected internal bool AddSittingAvatar(UUID id) | 5546 | protected internal bool AddSittingAvatar(ScenePresence sp) |
5547 | { | 5547 | { |
5548 | lock (ParentGroup.m_sittingAvatars) | 5548 | lock (ParentGroup.m_sittingAvatars) |
5549 | { | 5549 | { |
5550 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5550 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) |
5551 | SitTargetAvatar = id; | 5551 | SitTargetAvatar = sp.UUID; |
5552 | 5552 | ||
5553 | if (m_sittingAvatars == null) | 5553 | if (m_sittingAvatars == null) |
5554 | m_sittingAvatars = new HashSet<UUID>(); | 5554 | m_sittingAvatars = new HashSet<ScenePresence>(); |
5555 | 5555 | ||
5556 | if (m_sittingAvatars.Add(id)) | 5556 | if (m_sittingAvatars.Add(sp)) |
5557 | { | 5557 | { |
5558 | ParentGroup.m_sittingAvatars.Add(id); | 5558 | ParentGroup.m_sittingAvatars.Add(sp); |
5559 | 5559 | ||
5560 | return true; | 5560 | return true; |
5561 | } | 5561 | } |
@@ -5572,22 +5572,22 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5572 | /// true if the avatar was present and removed, false if it was not present. | 5572 | /// true if the avatar was present and removed, false if it was not present. |
5573 | /// </returns> | 5573 | /// </returns> |
5574 | /// <param name='avatarId'></param> | 5574 | /// <param name='avatarId'></param> |
5575 | protected internal bool RemoveSittingAvatar(UUID id) | 5575 | protected internal bool RemoveSittingAvatar(ScenePresence sp) |
5576 | { | 5576 | { |
5577 | lock (ParentGroup.m_sittingAvatars) | 5577 | lock (ParentGroup.m_sittingAvatars) |
5578 | { | 5578 | { |
5579 | if (SitTargetAvatar == id) | 5579 | if (SitTargetAvatar == sp.UUID) |
5580 | SitTargetAvatar = UUID.Zero; | 5580 | SitTargetAvatar = UUID.Zero; |
5581 | 5581 | ||
5582 | if (m_sittingAvatars == null) | 5582 | if (m_sittingAvatars == null) |
5583 | return false; | 5583 | return false; |
5584 | 5584 | ||
5585 | if (m_sittingAvatars.Remove(id)) | 5585 | if (m_sittingAvatars.Remove(sp)) |
5586 | { | 5586 | { |
5587 | if (m_sittingAvatars.Count == 0) | 5587 | if (m_sittingAvatars.Count == 0) |
5588 | m_sittingAvatars = null; | 5588 | m_sittingAvatars = null; |
5589 | 5589 | ||
5590 | ParentGroup.m_sittingAvatars.Remove(id); | 5590 | ParentGroup.m_sittingAvatars.Remove(sp); |
5591 | 5591 | ||
5592 | return true; | 5592 | return true; |
5593 | } | 5593 | } |
@@ -5601,14 +5601,14 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter | |||
5601 | /// </summary> | 5601 | /// </summary> |
5602 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> | 5602 | /// <remarks>This applies to all sitting avatars whether there is a sit target set or not.</remarks> |
5603 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5603 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5604 | public HashSet<UUID> GetSittingAvatars() | 5604 | public HashSet<ScenePresence> GetSittingAvatars() |
5605 | { | 5605 | { |
5606 | lock (ParentGroup.m_sittingAvatars) | 5606 | lock (ParentGroup.m_sittingAvatars) |
5607 | { | 5607 | { |
5608 | if (m_sittingAvatars == null) | 5608 | if (m_sittingAvatars == null) |
5609 | return null; | 5609 | return null; |
5610 | else | 5610 | else |
5611 | return new HashSet<UUID>(m_sittingAvatars); | 5611 | return new HashSet<ScenePresence>(m_sittingAvatars); |
5612 | } | 5612 | } |
5613 | } | 5613 | } |
5614 | 5614 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f63fa71..974dd62 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2884,7 +2884,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2884 | { | 2884 | { |
2885 | 2885 | ||
2886 | m_requestedSitTargetID = 0; | 2886 | m_requestedSitTargetID = 0; |
2887 | part.RemoveSittingAvatar(UUID); | 2887 | part.RemoveSittingAvatar(this); |
2888 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); | 2888 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
2889 | 2889 | ||
2890 | SendAvatarDataToAllAgents(); | 2890 | SendAvatarDataToAllAgents(); |
@@ -2984,7 +2984,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2984 | 2984 | ||
2985 | Velocity = Vector3.Zero; | 2985 | Velocity = Vector3.Zero; |
2986 | 2986 | ||
2987 | part.AddSittingAvatar(UUID); | 2987 | part.AddSittingAvatar(this); |
2988 | 2988 | ||
2989 | cameraAtOffset = part.GetCameraAtOffset(); | 2989 | cameraAtOffset = part.GetCameraAtOffset(); |
2990 | cameraEyeOffset = part.GetCameraEyeOffset(); | 2990 | cameraEyeOffset = part.GetCameraEyeOffset(); |
@@ -3132,7 +3132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3132 | Velocity = Vector3.Zero; | 3132 | Velocity = Vector3.Zero; |
3133 | m_AngularVelocity = Vector3.Zero; | 3133 | m_AngularVelocity = Vector3.Zero; |
3134 | 3134 | ||
3135 | part.AddSittingAvatar(UUID); | 3135 | part.AddSittingAvatar(this); |
3136 | 3136 | ||
3137 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); | 3137 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); |
3138 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); | 3138 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 64f11cd..8b194e6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs | |||
@@ -98,9 +98,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
98 | 98 | ||
99 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); | 99 | Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); |
100 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | 100 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); |
101 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | 101 | HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); |
102 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | 102 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); |
103 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | 103 | Assert.That(sittingAvatars.Contains(m_sp)); |
104 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); | 104 | Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId)); |
105 | } | 105 | } |
106 | 106 | ||
@@ -210,9 +210,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
210 | Assert.That(m_sp.PhysicsActor, Is.Null); | 210 | Assert.That(m_sp.PhysicsActor, Is.Null); |
211 | 211 | ||
212 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); | 212 | Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(1)); |
213 | HashSet<UUID> sittingAvatars = part.GetSittingAvatars(); | 213 | HashSet<ScenePresence> sittingAvatars = part.GetSittingAvatars(); |
214 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); | 214 | Assert.That(sittingAvatars.Count, Is.EqualTo(1)); |
215 | Assert.That(sittingAvatars.Contains(m_sp.UUID)); | 215 | Assert.That(sittingAvatars.Contains(m_sp)); |
216 | 216 | ||
217 | m_sp.StandUp(); | 217 | m_sp.StandUp(); |
218 | 218 | ||
@@ -246,4 +246,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
246 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); | 246 | Assert.That(m_sp.PhysicsActor, Is.Not.Null); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } \ No newline at end of file | 249 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3f523a4..337e862 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -24,7 +24,7 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
@@ -617,7 +617,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
617 | } | 617 | } |
618 | 618 | ||
619 | int actualPrimCount = part.ParentGroup.PrimCount; | 619 | int actualPrimCount = part.ParentGroup.PrimCount; |
620 | List<UUID> sittingAvatars = part.ParentGroup.GetSittingAvatars(); | 620 | List<ScenePresence> sittingAvatars = part.ParentGroup.GetSittingAvatars(); |
621 | int adjustedPrimCount = actualPrimCount + sittingAvatars.Count; | 621 | int adjustedPrimCount = actualPrimCount + sittingAvatars.Count; |
622 | 622 | ||
623 | // Special case for a single prim. In this case the linknum is zero. However, this will not match a single | 623 | // 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 | |||
646 | } | 646 | } |
647 | else | 647 | else |
648 | { | 648 | { |
649 | ScenePresence sp = World.GetScenePresence(sittingAvatars[linknum - actualPrimCount - 1]); | 649 | return sittingAvatars[linknum - actualPrimCount - 1]; |
650 | if (sp != null) | ||
651 | return sp; | ||
652 | else | ||
653 | return null; | ||
654 | } | 650 | } |
655 | } | 651 | } |
656 | else | 652 | else |
@@ -4146,7 +4142,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4146 | } | 4142 | } |
4147 | else | 4143 | else |
4148 | { | 4144 | { |
4149 | if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(id => id == agentID) != null) | 4145 | if (m_host.ParentGroup.GetSittingAvatars().SingleOrDefault(sp => sp.UUID == agentID) != null) |
4150 | { | 4146 | { |
4151 | // When agent is sitting, certain permissions are implicit if requested from sitting agent | 4147 | // When agent is sitting, certain permissions are implicit if requested from sitting agent |
4152 | implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | | 4148 | implicitPerms = ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | |
@@ -6915,11 +6911,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6915 | if (UUID.TryParse(id, out key)) | 6911 | if (UUID.TryParse(id, out key)) |
6916 | { | 6912 | { |
6917 | ScenePresence av = World.GetScenePresence(key); | 6913 | ScenePresence av = World.GetScenePresence(key); |
6918 | List<UUID> sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); | 6914 | List<ScenePresence> sittingAvatars = m_host.ParentGroup.GetSittingAvatars(); |
6919 | 6915 | ||
6920 | if (av != null) | 6916 | if (av != null) |
6921 | { | 6917 | { |
6922 | if (sittingAvatars.Contains(key)) | 6918 | if (sittingAvatars.Contains(av)) |
6923 | { | 6919 | { |
6924 | // if the avatar is sitting on this object, then | 6920 | // if the avatar is sitting on this object, then |
6925 | // we can unsit them. We don't want random scripts unsitting random people | 6921 | // we can unsit them. We don't want random scripts unsitting random people |
@@ -10316,9 +10312,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10316 | public LSL_Integer llGetNumberOfPrims() | 10312 | public LSL_Integer llGetNumberOfPrims() |
10317 | { | 10313 | { |
10318 | m_host.AddScriptLPS(1); | 10314 | m_host.AddScriptLPS(1); |
10319 | int avatarCount = m_host.ParentGroup.GetLinkedAvatars().Count; | 10315 | |
10320 | 10316 | return m_host.ParentGroup.PrimCount + m_host.ParentGroup.GetSittingAvatarsCount(); | |
10321 | return m_host.ParentGroup.PrimCount + avatarCount; | ||
10322 | } | 10317 | } |
10323 | 10318 | ||
10324 | /// <summary> | 10319 | /// <summary> |
@@ -14457,7 +14452,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
14457 | UUID userId = UUID.Zero; | 14452 | UUID userId = UUID.Zero; |
14458 | int msAvailable = 0; | 14453 | int msAvailable = 0; |
14459 | // Throttle per owner when attachment or "vehicle" (sat upon) | 14454 | // Throttle per owner when attachment or "vehicle" (sat upon) |
14460 | if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatars().Count > 0) | 14455 | if (m_host.ParentGroup.IsAttachment || m_host.ParentGroup.GetSittingAvatarsCount() > 0) |
14461 | { | 14456 | { |
14462 | userId = m_host.OwnerID; | 14457 | userId = m_host.OwnerID; |
14463 | msAvailable = m_msPerAvatarInCastRay; | 14458 | msAvailable = m_msPerAvatarInCastRay; |