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 b62667f..2a0d2ea 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() |
@@ -3313,13 +3316,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3313 | ParentGroup.SetAxisRotation(axis, rotate); | 3316 | ParentGroup.SetAxisRotation(axis, rotate); |
3314 | 3317 | ||
3315 | //Cannot use ScriptBaseClass constants as no referance to it currently. | 3318 | //Cannot use ScriptBaseClass constants as no referance to it currently. |
3316 | if (axis == 2)//STATUS_ROTATE_X | 3319 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0) |
3317 | STATUS_ROTATE_X = rotate; | 3320 | STATUS_ROTATE_X = rotate; |
3318 | 3321 | ||
3319 | if (axis == 4)//STATUS_ROTATE_Y | 3322 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0) |
3320 | STATUS_ROTATE_Y = rotate; | 3323 | STATUS_ROTATE_Y = rotate; |
3321 | 3324 | ||
3322 | if (axis == 8)//STATUS_ROTATE_Z | 3325 | if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0) |
3323 | STATUS_ROTATE_Z = rotate; | 3326 | STATUS_ROTATE_Z = rotate; |
3324 | } | 3327 | } |
3325 | 3328 | ||
@@ -4549,7 +4552,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4549 | if (ParentGroup.RootPart == this) | 4552 | if (ParentGroup.RootPart == this) |
4550 | AngularVelocity = new Vector3(0, 0, 0); | 4553 | AngularVelocity = new Vector3(0, 0, 0); |
4551 | } | 4554 | } |
4552 | else | 4555 | else if (SetVD != wasVD) |
4553 | { | 4556 | { |
4554 | if (ParentGroup.Scene.CollidablePrims) | 4557 | if (ParentGroup.Scene.CollidablePrims) |
4555 | { | 4558 | { |
@@ -5193,18 +5196,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
5193 | /// <param name='avatarId'></param> | 5196 | /// <param name='avatarId'></param> |
5194 | protected internal bool AddSittingAvatar(UUID avatarId) | 5197 | protected internal bool AddSittingAvatar(UUID avatarId) |
5195 | { | 5198 | { |
5196 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | 5199 | lock (ParentGroup.m_sittingAvatars) |
5197 | SitTargetAvatar = avatarId; | 5200 | { |
5201 | if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) | ||
5202 | SitTargetAvatar = avatarId; | ||
5203 | |||
5204 | if (m_sittingAvatars == null) | ||
5205 | m_sittingAvatars = new HashSet<UUID>(); | ||
5198 | 5206 | ||
5199 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5207 | if (m_sittingAvatars.Add(avatarId)) |
5208 | { | ||
5209 | ParentGroup.m_sittingAvatars.Add(avatarId); | ||
5200 | 5210 | ||
5201 | if (sittingAvatars == null) | 5211 | return true; |
5202 | sittingAvatars = new HashSet<UUID>(); | 5212 | } |
5203 | 5213 | ||
5204 | lock (sittingAvatars) | 5214 | return false; |
5205 | { | ||
5206 | m_sittingAvatars = sittingAvatars; | ||
5207 | return m_sittingAvatars.Add(avatarId); | ||
5208 | } | 5215 | } |
5209 | } | 5216 | } |
5210 | 5217 | ||
@@ -5218,27 +5225,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
5218 | /// <param name='avatarId'></param> | 5225 | /// <param name='avatarId'></param> |
5219 | protected internal bool RemoveSittingAvatar(UUID avatarId) | 5226 | protected internal bool RemoveSittingAvatar(UUID avatarId) |
5220 | { | 5227 | { |
5221 | if (SitTargetAvatar == avatarId) | 5228 | lock (ParentGroup.m_sittingAvatars) |
5222 | SitTargetAvatar = UUID.Zero; | 5229 | { |
5223 | 5230 | if (SitTargetAvatar == avatarId) | |
5224 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5231 | SitTargetAvatar = UUID.Zero; |
5225 | 5232 | ||
5226 | // This can occur under a race condition where another thread | 5233 | if (m_sittingAvatars == null) |
5227 | if (sittingAvatars == null) | 5234 | return false; |
5228 | return false; | ||
5229 | 5235 | ||
5230 | lock (sittingAvatars) | 5236 | if (m_sittingAvatars.Remove(avatarId)) |
5231 | { | ||
5232 | if (sittingAvatars.Remove(avatarId)) | ||
5233 | { | 5237 | { |
5234 | if (sittingAvatars.Count == 0) | 5238 | if (m_sittingAvatars.Count == 0) |
5235 | m_sittingAvatars = null; | 5239 | m_sittingAvatars = null; |
5236 | 5240 | ||
5241 | ParentGroup.m_sittingAvatars.Remove(avatarId); | ||
5242 | |||
5237 | return true; | 5243 | return true; |
5238 | } | 5244 | } |
5239 | } | ||
5240 | 5245 | ||
5241 | return false; | 5246 | return false; |
5247 | } | ||
5242 | } | 5248 | } |
5243 | 5249 | ||
5244 | /// <summary> | 5250 | /// <summary> |
@@ -5248,16 +5254,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5248 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> | 5254 | /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> |
5249 | public HashSet<UUID> GetSittingAvatars() | 5255 | public HashSet<UUID> GetSittingAvatars() |
5250 | { | 5256 | { |
5251 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5257 | lock (ParentGroup.m_sittingAvatars) |
5252 | |||
5253 | if (sittingAvatars == null) | ||
5254 | { | 5258 | { |
5255 | return null; | 5259 | if (m_sittingAvatars == null) |
5256 | } | 5260 | return null; |
5257 | else | 5261 | else |
5258 | { | 5262 | return new HashSet<UUID>(m_sittingAvatars); |
5259 | lock (sittingAvatars) | ||
5260 | return new HashSet<UUID>(sittingAvatars); | ||
5261 | } | 5263 | } |
5262 | } | 5264 | } |
5263 | 5265 | ||
@@ -5268,13 +5270,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
5268 | /// <returns></returns> | 5270 | /// <returns></returns> |
5269 | public int GetSittingAvatarsCount() | 5271 | public int GetSittingAvatarsCount() |
5270 | { | 5272 | { |
5271 | HashSet<UUID> sittingAvatars = m_sittingAvatars; | 5273 | lock (ParentGroup.m_sittingAvatars) |
5272 | 5274 | { | |
5273 | if (sittingAvatars == null) | 5275 | if (m_sittingAvatars == null) |
5274 | return 0; | 5276 | return 0; |
5275 | 5277 | else | |
5276 | lock (sittingAvatars) | 5278 | return m_sittingAvatars.Count; |
5277 | return sittingAvatars.Count; | 5279 | } |
5278 | } | 5280 | } |
5279 | } | 5281 | } |
5280 | } | 5282 | } \ No newline at end of file |