diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ff4ae85..f21058b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1342 | public UUID SitTargetAvatar { get; set; } | 1342 | public UUID SitTargetAvatar { get; set; } |
1343 | 1343 | ||
1344 | /// <summary> | 1344 | /// <summary> |
1345 | /// IDs of all avatars start on this object part. | 1345 | /// IDs of all avatars sat on this part. |
1346 | /// </summary> | 1346 | /// </summary> |
1347 | /// <remarks> | 1347 | /// <remarks> |
1348 | /// We need to track this so that we can stop sat upon prims from being attached. | 1348 | /// We need to track this so that we can stop sat upon prims from being attached. |
@@ -2431,11 +2431,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2431 | public int GetAxisRotation(int axis) | 2431 | public int GetAxisRotation(int axis) |
2432 | { | 2432 | { |
2433 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 2433 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
2434 | if (axis == 2)//STATUS_ROTATE_X | 2434 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) |
2435 | return STATUS_ROTATE_X; | 2435 | return STATUS_ROTATE_X; |
2436 | if (axis == 4)//STATUS_ROTATE_Y | 2436 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) |
2437 | return STATUS_ROTATE_Y; | 2437 | return STATUS_ROTATE_Y; |
2438 | if (axis == 8)//STATUS_ROTATE_Z | 2438 | if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) |
2439 | return STATUS_ROTATE_Z; | 2439 | return STATUS_ROTATE_Z; |
2440 | 2440 | ||
2441 | return 0; | 2441 | return 0; |
@@ -2895,11 +2895,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2895 | 2895 | ||
2896 | public void PhysicsOutOfBounds(Vector3 pos) | 2896 | public void PhysicsOutOfBounds(Vector3 pos) |
2897 | { | 2897 | { |
2898 | m_log.Error("[PHYSICS]: Physical Object went out of bounds."); | 2898 | // Note: This is only being called on the root prim at this time. |
2899 | |||
2900 | m_log.ErrorFormat( | ||
2901 | "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.", | ||
2902 | Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition); | ||
2899 | 2903 | ||
2900 | RemFlag(PrimFlags.Physics); | 2904 | RemFlag(PrimFlags.Physics); |
2901 | DoPhysicsPropertyUpdate(false, true); | 2905 | DoPhysicsPropertyUpdate(false, true); |
2902 | //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); | ||
2903 | } | 2906 | } |
2904 | 2907 | ||
2905 | public void PhysicsRequestingTerseUpdate() | 2908 | public void PhysicsRequestingTerseUpdate() |
@@ -3322,13 +3325,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3322 | ParentGroup.SetAxisRotation(axis, rotate); | 3325 | ParentGroup.SetAxisRotation(axis, rotate); |
3323 | 3326 | ||
3324 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 3327 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
3325 | if (axis == 2)//STATUS_ROTATE_X | 3328 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0) |
3326 | STATUS_ROTATE_X = rotate; | 3329 | STATUS_ROTATE_X = rotate; |
3327 | 3330 | ||
3328 | if (axis == 4)//STATUS_ROTATE_Y | 3331 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0) |
3329 | STATUS_ROTATE_Y = rotate; | 3332 | STATUS_ROTATE_Y = rotate; |
3330 | 3333 | ||
3331 | if (axis == 8)//STATUS_ROTATE_Z | 3334 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0) |
3332 | STATUS_ROTATE_Z = rotate; | 3335 | STATUS_ROTATE_Z = rotate; |
3333 | } | 3336 | } |
3334 | 3337 | ||
@@ -4558,7 +4561,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4558 | if (ParentGroup.RootPart == this) | 4561 | if (ParentGroup.RootPart == this) |
4559 | AngularVelocity = new Vector3(0, 0, 0); | 4562 | AngularVelocity = new Vector3(0, 0, 0); |
4560 | } | 4563 | } |
4561 | else | 4564 | else if (SetVD != wasVD) |
4562 | { | 4565 | { |
4563 | if (ParentGroup.Scene.CollidablePrims) | 4566 | if (ParentGroup.Scene.CollidablePrims) |
4564 | { | 4567 | { |
@@ -5202,18 +5205,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5202 | /// <param name='avatarId'></param> | 5205 | /// <param name='avatarId'></param> |
5203 | protected internal bool AddSittingAvatar(UUID avatarId) | 5206 | protected internal bool AddSittingAvatar(UUID avatarId) |
5204 | { | 5207 | { |
5205 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5208 | lock (ParentGroup.m_sittingAvatars) |
5206 | SitTargetAvatar = avatarId; | 5209 | { |
5210 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | ||
5211 | SitTargetAvatar = avatarId; | ||
5212 | |||
5213 | if (m_sittingAvatars == null) | ||
5214 | m_sittingAvatars = new HashSet<UUID>(); | ||
5207 | 5215 | ||
5208 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5216 | if (m_sittingAvatars.Add(avatarId)) |
5217 | { | ||
5218 | ParentGroup.m_sittingAvatars.Add(avatarId); | ||
5209 | 5219 | ||
5210 | if (sittingAvatars == null) | 5220 | return true; |
5211 | sittingAvatars = new HashSet<UUID>(); | 5221 | } |
5212 | 5222 | ||
5213 | lock (sittingAvatars) | 5223 | return false; |
5214 | { | ||
5215 | m_sittingAvatars = sittingAvatars; | ||
5216 | return m_sittingAvatars.Add(avatarId); | ||
5217 | } | 5224 | } |
5218 | } | 5225 | } |
5219 | 5226 | ||
@@ -5227,27 +5234,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5227 | /// <param name='avatarId'></param> | 5234 | /// <param name='avatarId'></param> |
5228 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5235 | protected internal bool RemoveSittingAvatar(UUID avatarId) |
5229 | { | 5236 | { |
5230 | if (SitTargetAvatar == avatarId) | 5237 | lock (ParentGroup.m_sittingAvatars) |
5231 | SitTargetAvatar = UUID.Zero; | 5238 | { |
5232 | 5239 | if (SitTargetAvatar == avatarId) | |
5233 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5240 | SitTargetAvatar = UUID.Zero; |
5234 | 5241 | ||
5235 | // This can occur under a race condition where another thread | 5242 | if (m_sittingAvatars == null) |
5236 | if (sittingAvatars == null) | 5243 | return false; |
5237 | return false; | ||
5238 | 5244 | ||
5239 | lock (sittingAvatars) | 5245 | if (m_sittingAvatars.Remove(avatarId)) |
5240 | { | ||
5241 | if (sittingAvatars.Remove(avatarId)) | ||
5242 | { | 5246 | { |
5243 | if (sittingAvatars.Count == 0) | 5247 | if (m_sittingAvatars.Count == 0) |
5244 | m_sittingAvatars = null; | 5248 | m_sittingAvatars = null; |
5245 | 5249 | ||
5250 | ParentGroup.m_sittingAvatars.Remove(avatarId); | ||
5251 | |||
5246 | return true; | 5252 | return true; |
5247 | } | 5253 | } |
5248 | } | ||
5249 | 5254 | ||
5250 | return false; | 5255 | return false; |
5256 | } | ||
5251 | } | 5257 | } |
5252 | 5258 | ||
5253 | /// <summary> | 5259 | /// <summary> |
@@ -5257,16 +5263,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5257 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5263 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5258 | public HashSet<UUID> GetSittingAvatars() | 5264 | public HashSet<UUID> GetSittingAvatars() |
5259 | { | 5265 | { |
5260 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5266 | lock (ParentGroup.m_sittingAvatars) |
5261 | |||
5262 | if (sittingAvatars == null) | ||
5263 | { | 5267 | { |
5264 | return null; | 5268 | if (m_sittingAvatars == null) |
5265 | } | 5269 | return null; |
5266 | else | 5270 | else |
5267 | { | 5271 | return new HashSet<UUID>(m_sittingAvatars); |
5268 | lock (sittingAvatars) | ||
5269 | return new HashSet<UUID>(sittingAvatars); | ||
5270 | } | 5272 | } |
5271 | } | 5273 | } |
5272 | 5274 | ||
@@ -5277,13 +5279,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5277 | /// <returns></returns> | 5279 | /// <returns></returns> |
5278 | public int GetSittingAvatarsCount() | 5280 | public int GetSittingAvatarsCount() |
5279 | { | 5281 | { |
5280 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5282 | lock (ParentGroup.m_sittingAvatars) |
5281 | 5283 | { | |
5282 | if (sittingAvatars == null) | 5284 | if (m_sittingAvatars == null) |
5283 | return 0; | 5285 | return 0; |
5284 | 5286 | else | |
5285 | lock (sittingAvatars) | 5287 | return m_sittingAvatars.Count; |
5286 | return sittingAvatars.Count; | 5288 | } |
5287 | } | 5289 | } |
5288 | } | 5290 | } |
5289 | } | 5291 | } \ No newline at end of file |