diff options
7 files changed, 236 insertions, 209 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c1b5781..258683d 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3761,24 +3761,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3761 | { | 3761 | { |
3762 | SceneObjectPart part = (SceneObjectPart)update.Entity; | 3762 | SceneObjectPart part = (SceneObjectPart)update.Entity; |
3763 | 3763 | ||
3764 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | ||
3765 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | ||
3766 | // safety measure. | ||
3767 | // | ||
3768 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | ||
3769 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | ||
3770 | // updates and kills on different threads with different scheduling strategies, hence this protection. | ||
3771 | // | ||
3772 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | ||
3773 | // after the root prim has been deleted. | ||
3774 | lock (m_killRecord) | ||
3775 | { | ||
3776 | if (m_killRecord.Contains(part.LocalId)) | ||
3777 | continue; | ||
3778 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) | ||
3779 | continue; | ||
3780 | } | ||
3781 | |||
3782 | if (part.ParentGroup.IsDeleted) | 3764 | if (part.ParentGroup.IsDeleted) |
3783 | continue; | 3765 | continue; |
3784 | 3766 | ||
@@ -3816,7 +3798,39 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3816 | // attachments until the avatar becomes root. | 3798 | // attachments until the avatar becomes root. |
3817 | if (sp.IsChildAgent) | 3799 | if (sp.IsChildAgent) |
3818 | continue; | 3800 | continue; |
3801 | |||
3802 | // If the object is an attachment we don't want it to be in the kill | ||
3803 | // record. Else attaching from inworld and subsequently dropping | ||
3804 | // it will no longer work. | ||
3805 | lock (m_killRecord) | ||
3806 | { | ||
3807 | m_killRecord.Remove(part.LocalId); | ||
3808 | m_killRecord.Remove(part.ParentGroup.RootPart.LocalId); | ||
3809 | } | ||
3819 | } | 3810 | } |
3811 | else | ||
3812 | { | ||
3813 | // Please do not remove this unless you can demonstrate on the OpenSim mailing list that a client | ||
3814 | // will never receive an update after a prim kill. Even then, keeping the kill record may be a good | ||
3815 | // safety measure. | ||
3816 | // | ||
3817 | // If a Linden Lab 1.23.5 client (and possibly later and earlier) receives an object update | ||
3818 | // after a kill, it will keep displaying the deleted object until relog. OpenSim currently performs | ||
3819 | // updates and kills on different threads with different scheduling strategies, hence this protection. | ||
3820 | // | ||
3821 | // This doesn't appear to apply to child prims - a client will happily ignore these updates | ||
3822 | // after the root prim has been deleted. | ||
3823 | // | ||
3824 | // We ignore this for attachments because attaching something from inworld breaks unless we do. | ||
3825 | lock (m_killRecord) | ||
3826 | { | ||
3827 | if (m_killRecord.Contains(part.LocalId)) | ||
3828 | continue; | ||
3829 | if (m_killRecord.Contains(part.ParentGroup.RootPart.LocalId)) | ||
3830 | continue; | ||
3831 | } | ||
3832 | } | ||
3833 | |||
3820 | if (part.ParentGroup.IsAttachment && m_disableFacelights) | 3834 | if (part.ParentGroup.IsAttachment && m_disableFacelights) |
3821 | { | 3835 | { |
3822 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && | 3836 | if (part.ParentGroup.RootPart.Shape.State != (byte)AttachmentPoint.LeftHand && |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7a91481..de40e59 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -638,19 +638,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
638 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 638 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
639 | // grp.Name, grp.LocalId, remoteClient.Name); | 639 | // grp.Name, grp.LocalId, remoteClient.Name); |
640 | 640 | ||
641 | Vector3 inventoryStoredPosition = new Vector3 | 641 | // Vector3 inventoryStoredPosition = new Vector3 |
642 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | 642 | // (((grp.AbsolutePosition.X > (int)Constants.RegionSize) |
643 | ? (float)Constants.RegionSize - 6 | 643 | // ? (float)Constants.RegionSize - 6 |
644 | : grp.AbsolutePosition.X) | 644 | // : grp.AbsolutePosition.X) |
645 | , | 645 | // , |
646 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) | 646 | // (grp.AbsolutePosition.Y > (int)Constants.RegionSize) |
647 | ? (float)Constants.RegionSize - 6 | 647 | // ? (float)Constants.RegionSize - 6 |
648 | : grp.AbsolutePosition.Y, | 648 | // : grp.AbsolutePosition.Y, |
649 | grp.AbsolutePosition.Z); | 649 | // grp.AbsolutePosition.Z); |
650 | 650 | // | |
651 | Vector3 originalPosition = grp.AbsolutePosition; | 651 | // Vector3 originalPosition = grp.AbsolutePosition; |
652 | 652 | // | |
653 | grp.AbsolutePosition = inventoryStoredPosition; | 653 | // grp.AbsolutePosition = inventoryStoredPosition; |
654 | 654 | ||
655 | // If we're being called from a script, then trying to serialize that same script's state will not complete | 655 | // If we're being called from a script, then trying to serialize that same script's state will not complete |
656 | // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if | 656 | // in any reasonable time period. Therefore, we'll avoid it. The worst that can happen is that if |
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
658 | // without state on relog. Arguably, this is what we want anyway. | 658 | // without state on relog. Arguably, this is what we want anyway. |
659 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); | 659 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, false); |
660 | 660 | ||
661 | grp.AbsolutePosition = originalPosition; | 661 | // grp.AbsolutePosition = originalPosition; |
662 | 662 | ||
663 | AssetBase asset = m_scene.CreateAsset( | 663 | AssetBase asset = m_scene.CreateAsset( |
664 | grp.GetPartName(grp.LocalId), | 664 | grp.GetPartName(grp.LocalId), |
@@ -686,21 +686,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
686 | else // oopsies | 686 | else // oopsies |
687 | item.Folder = UUID.Zero; | 687 | item.Folder = UUID.Zero; |
688 | 688 | ||
689 | // Nix the special bits we used to use for slam and the folded perms | ||
690 | uint allowablePermissionsMask = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move); | ||
691 | |||
689 | if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions()) | 692 | if ((sp.UUID != grp.RootPart.OwnerID) && m_scene.Permissions.PropagatePermissions()) |
690 | { | 693 | { |
691 | item.BasePermissions = grp.RootPart.NextOwnerMask; | 694 | item.BasePermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
692 | item.CurrentPermissions = grp.RootPart.NextOwnerMask; | 695 | item.CurrentPermissions = grp.RootPart.BaseMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
693 | item.NextPermissions = grp.RootPart.NextOwnerMask; | 696 | item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
694 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | 697 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
695 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | 698 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
696 | } | 699 | } |
697 | else | 700 | else |
698 | { | 701 | { |
699 | item.BasePermissions = grp.RootPart.BaseMask; | 702 | item.BasePermissions = grp.RootPart.BaseMask & allowablePermissionsMask; |
700 | item.CurrentPermissions = grp.RootPart.OwnerMask; | 703 | item.CurrentPermissions = grp.RootPart.OwnerMask & allowablePermissionsMask; |
701 | item.NextPermissions = grp.RootPart.NextOwnerMask; | 704 | item.NextPermissions = grp.RootPart.NextOwnerMask & allowablePermissionsMask; |
702 | item.EveryOnePermissions = grp.RootPart.EveryoneMask; | 705 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & allowablePermissionsMask; |
703 | item.GroupPermissions = grp.RootPart.GroupMask; | 706 | item.GroupPermissions = grp.RootPart.GroupMask & allowablePermissionsMask; |
704 | } | 707 | } |
705 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 708 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
706 | 709 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f7c6413..bb8d065 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2738,7 +2738,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2738 | 2738 | ||
2739 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 2739 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); |
2740 | if (!VolumeDetectActive) | 2740 | if (!VolumeDetectActive) |
2741 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); | 2741 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); |
2742 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); | 2742 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); |
2743 | 2743 | ||
2744 | if (startedColliders.Contains(0)) | 2744 | if (startedColliders.Contains(0)) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1adf13e..07b36b3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -4287,199 +4287,199 @@ namespace OpenSim.Region.Framework.Scenes | |||
4287 | } | 4287 | } |
4288 | } | 4288 | } |
4289 | 4289 | ||
4290 | private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) | 4290 | private DetectedObject CreateDetObject(SceneObjectPart obj) |
4291 | { | 4291 | { |
4292 | /* | 4292 | DetectedObject detobj = new DetectedObject(); |
4293 | lock(m_collisionEventLock) | 4293 | detobj.keyUUID = obj.UUID; |
4294 | { | 4294 | detobj.nameStr = obj.Name; |
4295 | if (m_collisionEventFlag) | 4295 | detobj.ownerUUID = obj.OwnerID; |
4296 | return; | 4296 | detobj.posVector = obj.AbsolutePosition; |
4297 | m_collisionEventFlag = true; | 4297 | detobj.rotQuat = obj.GetWorldRotation(); |
4298 | } | 4298 | detobj.velVector = obj.Velocity; |
4299 | detobj.colliderType = 0; | ||
4300 | detobj.groupUUID = obj.GroupID; | ||
4299 | 4301 | ||
4300 | Util.FireAndForget(delegate(object x) | 4302 | return detobj; |
4303 | } | ||
4304 | |||
4305 | private DetectedObject CreateDetObject(ScenePresence av) | ||
4306 | { | ||
4307 | DetectedObject detobj = new DetectedObject(); | ||
4308 | detobj.keyUUID = av.UUID; | ||
4309 | detobj.nameStr = av.ControllingClient.Name; | ||
4310 | detobj.ownerUUID = av.UUID; | ||
4311 | detobj.posVector = av.AbsolutePosition; | ||
4312 | detobj.rotQuat = av.Rotation; | ||
4313 | detobj.velVector = av.Velocity; | ||
4314 | detobj.colliderType = 0; | ||
4315 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
4316 | |||
4317 | return detobj; | ||
4318 | } | ||
4319 | |||
4320 | private DetectedObject CreateDetObjectForGround() | ||
4321 | { | ||
4322 | DetectedObject detobj = new DetectedObject(); | ||
4323 | detobj.keyUUID = UUID.Zero; | ||
4324 | detobj.nameStr = ""; | ||
4325 | detobj.ownerUUID = UUID.Zero; | ||
4326 | detobj.posVector = AbsolutePosition; | ||
4327 | detobj.rotQuat = Quaternion.Identity; | ||
4328 | detobj.velVector = Vector3.Zero; | ||
4329 | detobj.colliderType = 0; | ||
4330 | detobj.groupUUID = UUID.Zero; | ||
4331 | |||
4332 | return detobj; | ||
4333 | } | ||
4334 | |||
4335 | private ColliderArgs CreateColliderArgs(SceneObjectPart dest, List<uint> colliders) | ||
4336 | { | ||
4337 | ColliderArgs colliderArgs = new ColliderArgs(); | ||
4338 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
4339 | foreach (uint localId in colliders) | ||
4301 | { | 4340 | { |
4302 | */ | 4341 | if (localId == 0) |
4303 | try | 4342 | continue; |
4343 | |||
4344 | SceneObjectPart obj = m_scene.GetSceneObjectPart(localId); | ||
4345 | if (obj != null) | ||
4304 | { | 4346 | { |
4305 | List<uint> thisHitColliders = new List<uint>(); | 4347 | if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) |
4306 | List<uint> endedColliders = new List<uint>(); | 4348 | colliding.Add(CreateDetObject(obj)); |
4307 | List<uint> startedColliders = new List<uint>(); | 4349 | } |
4308 | List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); | 4350 | else |
4309 | CollisionForSoundInfo soundinfo; | 4351 | { |
4310 | ContactPoint curcontact; | 4352 | ScenePresence av = m_scene.GetScenePresence(localId); |
4311 | 4353 | if (av != null && (!av.IsChildAgent)) | |
4312 | if (coldata.Count == 0) | ||
4313 | { | 4354 | { |
4314 | if (m_lastColliders.Count == 0) | 4355 | if (!dest.CollisionFilteredOut(av.UUID, av.Name)) |
4315 | return; // nothing to do | 4356 | colliding.Add(CreateDetObject(av)); |
4316 | |||
4317 | foreach (uint localID in m_lastColliders) | ||
4318 | { | ||
4319 | endedColliders.Add(localID); | ||
4320 | } | ||
4321 | m_lastColliders.Clear(); | ||
4322 | } | 4357 | } |
4358 | } | ||
4359 | } | ||
4323 | 4360 | ||
4324 | else | 4361 | colliderArgs.Colliders = colliding; |
4325 | { | ||
4326 | foreach (uint id in coldata.Keys) | ||
4327 | { | ||
4328 | thisHitColliders.Add(id); | ||
4329 | if (!m_lastColliders.Contains(id)) | ||
4330 | { | ||
4331 | startedColliders.Add(id); | ||
4332 | curcontact = coldata[id]; | ||
4333 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | ||
4334 | { | ||
4335 | soundinfo = new CollisionForSoundInfo(); | ||
4336 | soundinfo.colliderID = id; | ||
4337 | soundinfo.position = curcontact.Position; | ||
4338 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
4339 | soundinfolist.Add(soundinfo); | ||
4340 | } | ||
4341 | } | ||
4342 | //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
4343 | } | ||
4344 | 4362 | ||
4345 | // calculate things that ended colliding | 4363 | return colliderArgs; |
4346 | foreach (uint localID in m_lastColliders) | 4364 | } |
4347 | { | ||
4348 | if (!thisHitColliders.Contains(localID)) | ||
4349 | { | ||
4350 | endedColliders.Add(localID); | ||
4351 | } | ||
4352 | } | ||
4353 | //add the items that started colliding this time to the last colliders list. | ||
4354 | foreach (uint localID in startedColliders) | ||
4355 | { | ||
4356 | m_lastColliders.Add(localID); | ||
4357 | } | ||
4358 | // remove things that ended colliding from the last colliders list | ||
4359 | foreach (uint localID in endedColliders) | ||
4360 | { | ||
4361 | m_lastColliders.Remove(localID); | ||
4362 | } | ||
4363 | |||
4364 | if (soundinfolist.Count > 0) | ||
4365 | CollisionSounds.AvatarCollisionSound(this, soundinfolist); | ||
4366 | 4365 | ||
4367 | // do event notification | 4366 | private delegate void ScriptCollidingNotification(uint localID, ColliderArgs message); |
4368 | if (startedColliders.Count > 0) | ||
4369 | { | ||
4370 | 4367 | ||
4371 | ColliderArgs StartCollidingMessage = new ColliderArgs(); | 4368 | private void SendCollisionEvent(SceneObjectGroup dest, scriptEvents ev, List<uint> colliders, ScriptCollidingNotification notify) |
4372 | List<DetectedObject> colliding = new List<DetectedObject>(); | 4369 | { |
4373 | foreach (uint localId in startedColliders) | 4370 | ColliderArgs CollidingMessage; |
4374 | { | ||
4375 | if (localId == 0) | ||
4376 | continue; | ||
4377 | 4371 | ||
4378 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | 4372 | if (colliders.Count > 0) |
4379 | string data = ""; | 4373 | { |
4380 | if (obj != null) | 4374 | if ((dest.RootPart.ScriptEvents & ev) != 0) |
4381 | { | 4375 | { |
4382 | DetectedObject detobj = new DetectedObject(); | 4376 | CollidingMessage = CreateColliderArgs(dest.RootPart, colliders); |
4383 | detobj.keyUUID = obj.UUID; | ||
4384 | detobj.nameStr = obj.Name; | ||
4385 | detobj.ownerUUID = obj.OwnerID; | ||
4386 | detobj.posVector = obj.AbsolutePosition; | ||
4387 | detobj.rotQuat = obj.GetWorldRotation(); | ||
4388 | detobj.velVector = obj.Velocity; | ||
4389 | detobj.colliderType = 0; | ||
4390 | detobj.groupUUID = obj.GroupID; | ||
4391 | colliding.Add(detobj); | ||
4392 | } | ||
4393 | } | ||
4394 | 4377 | ||
4395 | if (colliding.Count > 0) | 4378 | if (CollidingMessage.Colliders.Count > 0) |
4396 | { | 4379 | notify(dest.RootPart.LocalId, CollidingMessage); |
4397 | StartCollidingMessage.Colliders = colliding; | 4380 | } |
4381 | } | ||
4382 | } | ||
4398 | 4383 | ||
4399 | foreach (SceneObjectGroup att in GetAttachments()) | 4384 | private void SendLandCollisionEvent(SceneObjectGroup dest, scriptEvents ev, ScriptCollidingNotification notify) |
4400 | Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); | 4385 | { |
4401 | } | 4386 | if ((dest.RootPart.ScriptEvents & ev) != 0) |
4402 | } | 4387 | { |
4403 | } | 4388 | ColliderArgs LandCollidingMessage = new ColliderArgs(); |
4389 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
4404 | 4390 | ||
4405 | if (endedColliders.Count > 0) | 4391 | colliding.Add(CreateDetObjectForGround()); |
4406 | { | 4392 | LandCollidingMessage.Colliders = colliding; |
4407 | ColliderArgs EndCollidingMessage = new ColliderArgs(); | ||
4408 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
4409 | foreach (uint localId in endedColliders) | ||
4410 | { | ||
4411 | if (localId == 0) | ||
4412 | continue; | ||
4413 | 4393 | ||
4414 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | 4394 | notify(dest.RootPart.LocalId, LandCollidingMessage); |
4415 | string data = ""; | 4395 | } |
4416 | if (obj != null) | 4396 | } |
4417 | { | ||
4418 | DetectedObject detobj = new DetectedObject(); | ||
4419 | detobj.keyUUID = obj.UUID; | ||
4420 | detobj.nameStr = obj.Name; | ||
4421 | detobj.ownerUUID = obj.OwnerID; | ||
4422 | detobj.posVector = obj.AbsolutePosition; | ||
4423 | detobj.rotQuat = obj.GetWorldRotation(); | ||
4424 | detobj.velVector = obj.Velocity; | ||
4425 | detobj.colliderType = 0; | ||
4426 | detobj.groupUUID = obj.GroupID; | ||
4427 | colliding.Add(detobj); | ||
4428 | } | ||
4429 | } | ||
4430 | 4397 | ||
4431 | if (colliding.Count > 0) | 4398 | private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) |
4432 | { | 4399 | { |
4433 | EndCollidingMessage.Colliders = colliding; | 4400 | try |
4401 | { | ||
4402 | List<uint> thisHitColliders = new List<uint>(); | ||
4403 | List<uint> endedColliders = new List<uint>(); | ||
4404 | List<uint> startedColliders = new List<uint>(); | ||
4405 | List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); | ||
4406 | CollisionForSoundInfo soundinfo; | ||
4407 | ContactPoint curcontact; | ||
4408 | |||
4409 | if (coldata.Count == 0) | ||
4410 | { | ||
4411 | if (m_lastColliders.Count == 0) | ||
4412 | return; // nothing to do | ||
4434 | 4413 | ||
4435 | foreach (SceneObjectGroup att in GetAttachments()) | 4414 | foreach (uint localID in m_lastColliders) |
4436 | Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage); | 4415 | { |
4437 | } | 4416 | endedColliders.Add(localID); |
4438 | } | 4417 | } |
4418 | m_lastColliders.Clear(); | ||
4419 | } | ||
4439 | 4420 | ||
4440 | if (thisHitColliders.Count > 0) | 4421 | else |
4422 | { | ||
4423 | foreach (uint id in coldata.Keys) | ||
4441 | { | 4424 | { |
4442 | ColliderArgs CollidingMessage = new ColliderArgs(); | 4425 | thisHitColliders.Add(id); |
4443 | List<DetectedObject> colliding = new List<DetectedObject>(); | 4426 | if (!m_lastColliders.Contains(id)) |
4444 | foreach (uint localId in thisHitColliders) | ||
4445 | { | 4427 | { |
4446 | if (localId == 0) | 4428 | startedColliders.Add(id); |
4447 | continue; | 4429 | curcontact = coldata[id]; |
4448 | 4430 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | |
4449 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | ||
4450 | string data = ""; | ||
4451 | if (obj != null) | ||
4452 | { | 4431 | { |
4453 | DetectedObject detobj = new DetectedObject(); | 4432 | soundinfo = new CollisionForSoundInfo(); |
4454 | detobj.keyUUID = obj.UUID; | 4433 | soundinfo.colliderID = id; |
4455 | detobj.nameStr = obj.Name; | 4434 | soundinfo.position = curcontact.Position; |
4456 | detobj.ownerUUID = obj.OwnerID; | 4435 | soundinfo.relativeVel = curcontact.RelativeSpeed; |
4457 | detobj.posVector = obj.AbsolutePosition; | 4436 | soundinfolist.Add(soundinfo); |
4458 | detobj.rotQuat = obj.GetWorldRotation(); | ||
4459 | detobj.velVector = obj.Velocity; | ||
4460 | detobj.colliderType = 0; | ||
4461 | detobj.groupUUID = obj.GroupID; | ||
4462 | colliding.Add(detobj); | ||
4463 | } | 4437 | } |
4464 | } | 4438 | } |
4439 | //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
4440 | } | ||
4465 | 4441 | ||
4466 | if (colliding.Count > 0) | 4442 | // calculate things that ended colliding |
4443 | foreach (uint localID in m_lastColliders) | ||
4444 | { | ||
4445 | if (!thisHitColliders.Contains(localID)) | ||
4467 | { | 4446 | { |
4468 | CollidingMessage.Colliders = colliding; | 4447 | endedColliders.Add(localID); |
4469 | |||
4470 | lock (m_attachments) | ||
4471 | { | ||
4472 | foreach (SceneObjectGroup att in m_attachments) | ||
4473 | Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage); | ||
4474 | } | ||
4475 | } | 4448 | } |
4476 | } | 4449 | } |
4450 | //add the items that started colliding this time to the last colliders list. | ||
4451 | foreach (uint localID in startedColliders) | ||
4452 | { | ||
4453 | m_lastColliders.Add(localID); | ||
4454 | } | ||
4455 | // remove things that ended colliding from the last colliders list | ||
4456 | foreach (uint localID in endedColliders) | ||
4457 | { | ||
4458 | m_lastColliders.Remove(localID); | ||
4459 | } | ||
4460 | |||
4461 | if (soundinfolist.Count > 0) | ||
4462 | CollisionSounds.AvatarCollisionSound(this, soundinfolist); | ||
4477 | } | 4463 | } |
4478 | finally | 4464 | |
4465 | foreach (SceneObjectGroup att in GetAttachments()) | ||
4479 | { | 4466 | { |
4480 | m_collisionEventFlag = false; | 4467 | SendCollisionEvent(att, scriptEvents.collision_start, startedColliders, m_scene.EventManager.TriggerScriptCollidingStart); |
4468 | SendCollisionEvent(att, scriptEvents.collision , m_lastColliders , m_scene.EventManager.TriggerScriptColliding); | ||
4469 | SendCollisionEvent(att, scriptEvents.collision_end , endedColliders , m_scene.EventManager.TriggerScriptCollidingEnd); | ||
4470 | |||
4471 | if (startedColliders.Contains(0)) | ||
4472 | SendLandCollisionEvent(att, scriptEvents.land_collision_start, m_scene.EventManager.TriggerScriptLandCollidingStart); | ||
4473 | if (m_lastColliders.Contains(0)) | ||
4474 | SendLandCollisionEvent(att, scriptEvents.land_collision, m_scene.EventManager.TriggerScriptLandColliding); | ||
4475 | if (endedColliders.Contains(0)) | ||
4476 | SendLandCollisionEvent(att, scriptEvents.land_collision_end, m_scene.EventManager.TriggerScriptLandCollidingEnd); | ||
4481 | } | 4477 | } |
4482 | // }); | 4478 | } |
4479 | finally | ||
4480 | { | ||
4481 | m_collisionEventFlag = false; | ||
4482 | } | ||
4483 | } | 4483 | } |
4484 | 4484 | ||
4485 | private void TeleportFlagsDebug() { | 4485 | private void TeleportFlagsDebug() { |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 093bc3c..6e4e41f 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -1118,6 +1118,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1118 | if (CollisionEventsThisFrame == null) | 1118 | if (CollisionEventsThisFrame == null) |
1119 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1119 | CollisionEventsThisFrame = new CollisionEventUpdate(); |
1120 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | 1120 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
1121 | _parent_scene.AddCollisionEventReporting(this); | ||
1121 | } | 1122 | } |
1122 | 1123 | ||
1123 | public void SendCollisions() | 1124 | public void SendCollisions() |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 5109a6a..9a40ab5 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -1621,12 +1621,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1621 | 1621 | ||
1622 | if (Body != IntPtr.Zero) | 1622 | if (Body != IntPtr.Zero) |
1623 | { | 1623 | { |
1624 | d.BodyDestroy(Body); | 1624 | // d.BodyDestroy(Body); |
1625 | Body = IntPtr.Zero; | 1625 | // Body = IntPtr.Zero; |
1626 | // do a more complet destruction | ||
1627 | DestroyBody(); | ||
1626 | m_log.Warn("[PHYSICS]: MakeBody called having a body"); | 1628 | m_log.Warn("[PHYSICS]: MakeBody called having a body"); |
1627 | } | 1629 | } |
1628 | 1630 | ||
1629 | |||
1630 | if (d.GeomGetBody(prim_geom) != IntPtr.Zero) | 1631 | if (d.GeomGetBody(prim_geom) != IntPtr.Zero) |
1631 | { | 1632 | { |
1632 | d.GeomSetBody(prim_geom, IntPtr.Zero); | 1633 | d.GeomSetBody(prim_geom, IntPtr.Zero); |
@@ -3320,6 +3321,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3320 | 3321 | ||
3321 | protected void changeBuilding(bool newbuilding) | 3322 | protected void changeBuilding(bool newbuilding) |
3322 | { | 3323 | { |
3324 | // Check if we need to do anything | ||
3325 | if (newbuilding == m_building) | ||
3326 | return; | ||
3327 | |||
3323 | if ((bool)newbuilding) | 3328 | if ((bool)newbuilding) |
3324 | { | 3329 | { |
3325 | m_building = true; | 3330 | m_building = true; |
@@ -4066,4 +4071,4 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4066 | public Vector3 value; | 4071 | public Vector3 value; |
4067 | } | 4072 | } |
4068 | } | 4073 | } |
4069 | } \ No newline at end of file | 4074 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 03f4108..2700495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -1272,6 +1272,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1272 | if (!allow) | 1272 | if (!allow) |
1273 | return; | 1273 | return; |
1274 | 1274 | ||
1275 | if (m_host.ParentGroup.RootPart.PhysActor != null && | ||
1276 | m_host.ParentGroup.RootPart.PhysActor.IsPhysical) | ||
1277 | return; | ||
1278 | |||
1275 | m_host.ScriptSetPhysicsStatus(true); | 1279 | m_host.ScriptSetPhysicsStatus(true); |
1276 | } | 1280 | } |
1277 | else | 1281 | else |