diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 830fe31..eb3af42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4272,10 +4272,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4272 | // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); | 4272 | // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); |
4273 | } | 4273 | } |
4274 | 4274 | ||
4275 | // Subscribe for physics collision events if needed for scripts and sounds | 4275 | /// <summary> |
4276 | /// Subscribe for physics collision events if needed for scripts and sounds | ||
4277 | /// </summary> | ||
4276 | public void SubscribeForCollisionEvents() | 4278 | public void SubscribeForCollisionEvents() |
4277 | { | 4279 | { |
4278 | if (PhysActor != null) | 4280 | PhysicsActor pa = PhysActor; |
4281 | |||
4282 | if (pa != null) | ||
4279 | { | 4283 | { |
4280 | if ( | 4284 | if ( |
4281 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || | 4285 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || |
@@ -4293,20 +4297,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4293 | (CollisionSound != UUID.Zero) | 4297 | (CollisionSound != UUID.Zero) |
4294 | ) | 4298 | ) |
4295 | { | 4299 | { |
4296 | if (!PhysActor.SubscribedEvents()) | 4300 | if (!pa.SubscribedEvents()) |
4297 | { | 4301 | { |
4298 | // If not already subscribed for event, set up for a collision event. | 4302 | // If not already subscribed for event, set up for a collision event. |
4299 | PhysActor.OnCollisionUpdate += PhysicsCollision; | 4303 | pa.OnCollisionUpdate += PhysicsCollision; |
4300 | PhysActor.SubscribeEvents(1000); | 4304 | pa.SubscribeEvents(1000); |
4301 | } | 4305 | } |
4302 | } | 4306 | } |
4303 | else | 4307 | else |
4304 | { | 4308 | { |
4305 | // There is no need to be subscribed to collisions so, if subscribed, remove subscription | 4309 | // There is no need to be subscribed to collisions so, if subscribed, remove subscription |
4306 | if (PhysActor.SubscribedEvents()) | 4310 | if (pa.SubscribedEvents()) |
4307 | { | 4311 | { |
4308 | PhysActor.OnCollisionUpdate -= PhysicsCollision; | 4312 | pa.OnCollisionUpdate -= PhysicsCollision; |
4309 | PhysActor.UnSubscribeEvents(); | 4313 | pa.UnSubscribeEvents(); |
4310 | } | 4314 | } |
4311 | } | 4315 | } |
4312 | } | 4316 | } |