diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2594b1b..59a453a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4704,50 +4704,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4704 | } | 4704 | } |
4705 | 4705 | ||
4706 | /// <summary> | 4706 | /// <summary> |
4707 | /// Subscribe for physics collision events if needed for scripts and sounds | ||
4708 | /// </summary> | ||
4709 | public void SubscribeForCollisionEvents() | ||
4710 | { | ||
4711 | PhysicsActor pa = PhysActor; | ||
4712 | |||
4713 | if (pa != null) | ||
4714 | { | ||
4715 | if ( | ||
4716 | ((AggregateScriptEvents & scriptEvents.collision) != 0) || | ||
4717 | ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
4718 | ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || | ||
4719 | ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || | ||
4720 | ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || | ||
4721 | ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || | ||
4722 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.collision) != 0) || | ||
4723 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
4724 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.collision_start) != 0) || | ||
4725 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || | ||
4726 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.land_collision) != 0) || | ||
4727 | ((ParentGroup.RootPart.AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || | ||
4728 | (CollisionSound != UUID.Zero) | ||
4729 | ) | ||
4730 | { | ||
4731 | if (!pa.SubscribedEvents()) | ||
4732 | { | ||
4733 | // If not already subscribed for event, set up for a collision event. | ||
4734 | pa.OnCollisionUpdate += PhysicsCollision; | ||
4735 | pa.SubscribeEvents(1000); | ||
4736 | } | ||
4737 | } | ||
4738 | else | ||
4739 | { | ||
4740 | // There is no need to be subscribed to collisions so, if subscribed, remove subscription | ||
4741 | if (pa.SubscribedEvents()) | ||
4742 | { | ||
4743 | pa.OnCollisionUpdate -= PhysicsCollision; | ||
4744 | pa.UnSubscribeEvents(); | ||
4745 | } | ||
4746 | } | ||
4747 | } | ||
4748 | } | ||
4749 | |||
4750 | /// <summary> | ||
4751 | /// Adds this part to the physics scene. | 4707 | /// Adds this part to the physics scene. |
4752 | /// and sets the PhysActor property | 4708 | /// and sets the PhysActor property |
4753 | /// </summary> | 4709 | /// </summary> |
@@ -5205,7 +5161,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
5205 | { | 5161 | { |
5206 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; | 5162 | objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; |
5207 | } | 5163 | } |
5208 | 5164 | /* | |
5165 | PhysicsActor pa = PhysActor; | ||
5166 | if (pa != null) | ||
5167 | { | ||
5168 | if ( | ||
5169 | // ((AggregateScriptEvents & scriptEvents.collision) != 0) || | ||
5170 | // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || | ||
5171 | // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || | ||
5172 | // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || | ||
5173 | // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || | ||
5174 | // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || | ||
5175 | ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) | ||
5176 | ) | ||
5177 | { | ||
5178 | // subscribe to physics updates. | ||
5179 | pa.OnCollisionUpdate += PhysicsCollision; | ||
5180 | pa.SubscribeEvents(1000); | ||
5181 | } | ||
5182 | else | ||
5183 | { | ||
5184 | pa.UnSubscribeEvents(); | ||
5185 | pa.OnCollisionUpdate -= PhysicsCollision; | ||
5186 | } | ||
5187 | } | ||
5188 | */ | ||
5209 | UpdatePhysicsSubscribedEvents(); | 5189 | UpdatePhysicsSubscribedEvents(); |
5210 | 5190 | ||
5211 | //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) | 5191 | //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) |