aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs20
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 389c2c6..2594b1b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4703,10 +4703,14 @@ namespace OpenSim.Region.Framework.Scenes
4703// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); 4703// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags);
4704 } 4704 }
4705 4705
4706 // Subscribe for physics collision events if needed for scripts and sounds 4706 /// <summary>
4707 /// Subscribe for physics collision events if needed for scripts and sounds
4708 /// </summary>
4707 public void SubscribeForCollisionEvents() 4709 public void SubscribeForCollisionEvents()
4708 { 4710 {
4709 if (PhysActor != null) 4711 PhysicsActor pa = PhysActor;
4712
4713 if (pa != null)
4710 { 4714 {
4711 if ( 4715 if (
4712 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4716 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
@@ -4724,20 +4728,20 @@ namespace OpenSim.Region.Framework.Scenes
4724 (CollisionSound != UUID.Zero) 4728 (CollisionSound != UUID.Zero)
4725 ) 4729 )
4726 { 4730 {
4727 if (!PhysActor.SubscribedEvents()) 4731 if (!pa.SubscribedEvents())
4728 { 4732 {
4729 // If not already subscribed for event, set up for a collision event. 4733 // If not already subscribed for event, set up for a collision event.
4730 PhysActor.OnCollisionUpdate += PhysicsCollision; 4734 pa.OnCollisionUpdate += PhysicsCollision;
4731 PhysActor.SubscribeEvents(1000); 4735 pa.SubscribeEvents(1000);
4732 } 4736 }
4733 } 4737 }
4734 else 4738 else
4735 { 4739 {
4736 // There is no need to be subscribed to collisions so, if subscribed, remove subscription 4740 // There is no need to be subscribed to collisions so, if subscribed, remove subscription
4737 if (PhysActor.SubscribedEvents()) 4741 if (pa.SubscribedEvents())
4738 { 4742 {
4739 PhysActor.OnCollisionUpdate -= PhysicsCollision; 4743 pa.OnCollisionUpdate -= PhysicsCollision;
4740 PhysActor.UnSubscribeEvents(); 4744 pa.UnSubscribeEvents();
4741 } 4745 }
4742 } 4746 }
4743 } 4747 }