aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2011-11-05 23:37:43 +0000
committerMelanie2011-11-05 23:37:43 +0000
commit89a1d7c37c2097a4aede038feadab9dc945faa61 (patch)
tree4d74ba835261572303203ea56485effd1c74e1f8 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMerge branch 'master' into bigmerge (diff)
downloadopensim-SC_OLD-89a1d7c37c2097a4aede038feadab9dc945faa61.zip
opensim-SC_OLD-89a1d7c37c2097a4aede038feadab9dc945faa61.tar.gz
opensim-SC_OLD-89a1d7c37c2097a4aede038feadab9dc945faa61.tar.bz2
opensim-SC_OLD-89a1d7c37c2097a4aede038feadab9dc945faa61.tar.xz
Break out the parts of ScenePresence that differ from core
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs287
1 files changed, 146 insertions, 141 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f3af808..0e29b60 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3403,147 +3403,7 @@ namespace OpenSim.Region.Framework.Scenes
3403 } 3403 }
3404 } 3404 }
3405 3405
3406 List<uint> thisHitColliders = new List<uint>(); 3406 RaiseCollisionScriptEvents(coldata);
3407 List<uint> endedColliders = new List<uint>();
3408 List<uint> startedColliders = new List<uint>();
3409
3410 foreach (uint localid in coldata.Keys)
3411 {
3412 thisHitColliders.Add(localid);
3413 if (!m_lastColliders.Contains(localid))
3414 {
3415 startedColliders.Add(localid);
3416 }
3417 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
3418 }
3419
3420 // calculate things that ended colliding
3421 foreach (uint localID in m_lastColliders)
3422 {
3423 if (!thisHitColliders.Contains(localID))
3424 {
3425 endedColliders.Add(localID);
3426 }
3427 }
3428 //add the items that started colliding this time to the last colliders list.
3429 foreach (uint localID in startedColliders)
3430 {
3431 m_lastColliders.Add(localID);
3432 }
3433 // remove things that ended colliding from the last colliders list
3434 foreach (uint localID in endedColliders)
3435 {
3436 m_lastColliders.Remove(localID);
3437 }
3438
3439 // do event notification
3440 if (startedColliders.Count > 0)
3441 {
3442 ColliderArgs StartCollidingMessage = new ColliderArgs();
3443 List<DetectedObject> colliding = new List<DetectedObject>();
3444 foreach (uint localId in startedColliders)
3445 {
3446 if (localId == 0)
3447 continue;
3448
3449 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
3450 string data = "";
3451 if (obj != null)
3452 {
3453 DetectedObject detobj = new DetectedObject();
3454 detobj.keyUUID = obj.UUID;
3455 detobj.nameStr = obj.Name;
3456 detobj.ownerUUID = obj.OwnerID;
3457 detobj.posVector = obj.AbsolutePosition;
3458 detobj.rotQuat = obj.GetWorldRotation();
3459 detobj.velVector = obj.Velocity;
3460 detobj.colliderType = 0;
3461 detobj.groupUUID = obj.GroupID;
3462 colliding.Add(detobj);
3463 }
3464 }
3465
3466 if (colliding.Count > 0)
3467 {
3468 StartCollidingMessage.Colliders = colliding;
3469
3470 foreach (SceneObjectGroup att in GetAttachments())
3471 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
3472 }
3473 }
3474
3475 if (endedColliders.Count > 0)
3476 {
3477 ColliderArgs EndCollidingMessage = new ColliderArgs();
3478 List<DetectedObject> colliding = new List<DetectedObject>();
3479 foreach (uint localId in endedColliders)
3480 {
3481 if (localId == 0)
3482 continue;
3483
3484 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
3485 string data = "";
3486 if (obj != null)
3487 {
3488 DetectedObject detobj = new DetectedObject();
3489 detobj.keyUUID = obj.UUID;
3490 detobj.nameStr = obj.Name;
3491 detobj.ownerUUID = obj.OwnerID;
3492 detobj.posVector = obj.AbsolutePosition;
3493 detobj.rotQuat = obj.GetWorldRotation();
3494 detobj.velVector = obj.Velocity;
3495 detobj.colliderType = 0;
3496 detobj.groupUUID = obj.GroupID;
3497 colliding.Add(detobj);
3498 }
3499 }
3500
3501 if (colliding.Count > 0)
3502 {
3503 EndCollidingMessage.Colliders = colliding;
3504
3505 foreach (SceneObjectGroup att in GetAttachments())
3506 Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage);
3507 }
3508 }
3509
3510 if (thisHitColliders.Count > 0)
3511 {
3512 ColliderArgs CollidingMessage = new ColliderArgs();
3513 List<DetectedObject> colliding = new List<DetectedObject>();
3514 foreach (uint localId in thisHitColliders)
3515 {
3516 if (localId == 0)
3517 continue;
3518
3519 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
3520 string data = "";
3521 if (obj != null)
3522 {
3523 DetectedObject detobj = new DetectedObject();
3524 detobj.keyUUID = obj.UUID;
3525 detobj.nameStr = obj.Name;
3526 detobj.ownerUUID = obj.OwnerID;
3527 detobj.posVector = obj.AbsolutePosition;
3528 detobj.rotQuat = obj.GetWorldRotation();
3529 detobj.velVector = obj.Velocity;
3530 detobj.colliderType = 0;
3531 detobj.groupUUID = obj.GroupID;
3532 colliding.Add(detobj);
3533 }
3534 }
3535
3536 if (colliding.Count > 0)
3537 {
3538 CollidingMessage.Colliders = colliding;
3539
3540 lock (m_attachments)
3541 {
3542 foreach (SceneObjectGroup att in m_attachments)
3543 Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
3544 }
3545 }
3546 }
3547 3407
3548 if (Invulnerable) 3408 if (Invulnerable)
3549 return; 3409 return;
@@ -4037,5 +3897,150 @@ namespace OpenSim.Region.Framework.Scenes
4037 land.SendLandUpdateToClient(ControllingClient); 3897 land.SendLandUpdateToClient(ControllingClient);
4038 } 3898 }
4039 } 3899 }
3900
3901 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
3902 {
3903 List<uint> thisHitColliders = new List<uint>();
3904 List<uint> endedColliders = new List<uint>();
3905 List<uint> startedColliders = new List<uint>();
3906
3907 foreach (uint localid in coldata.Keys)
3908 {
3909 thisHitColliders.Add(localid);
3910 if (!m_lastColliders.Contains(localid))
3911 {
3912 startedColliders.Add(localid);
3913 }
3914 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
3915 }
3916
3917 // calculate things that ended colliding
3918 foreach (uint localID in m_lastColliders)
3919 {
3920 if (!thisHitColliders.Contains(localID))
3921 {
3922 endedColliders.Add(localID);
3923 }
3924 }
3925 //add the items that started colliding this time to the last colliders list.
3926 foreach (uint localID in startedColliders)
3927 {
3928 m_lastColliders.Add(localID);
3929 }
3930 // remove things that ended colliding from the last colliders list
3931 foreach (uint localID in endedColliders)
3932 {
3933 m_lastColliders.Remove(localID);
3934 }
3935
3936 // do event notification
3937 if (startedColliders.Count > 0)
3938 {
3939 ColliderArgs StartCollidingMessage = new ColliderArgs();
3940 List<DetectedObject> colliding = new List<DetectedObject>();
3941 foreach (uint localId in startedColliders)
3942 {
3943 if (localId == 0)
3944 continue;
3945
3946 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
3947 string data = "";
3948 if (obj != null)
3949 {
3950 DetectedObject detobj = new DetectedObject();
3951 detobj.keyUUID = obj.UUID;
3952 detobj.nameStr = obj.Name;
3953 detobj.ownerUUID = obj.OwnerID;
3954 detobj.posVector = obj.AbsolutePosition;
3955 detobj.rotQuat = obj.GetWorldRotation();
3956 detobj.velVector = obj.Velocity;
3957 detobj.colliderType = 0;
3958 detobj.groupUUID = obj.GroupID;
3959 colliding.Add(detobj);
3960 }
3961 }
3962
3963 if (colliding.Count > 0)
3964 {
3965 StartCollidingMessage.Colliders = colliding;
3966
3967 foreach (SceneObjectGroup att in GetAttachments())
3968 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
3969 }
3970 }
3971
3972 if (endedColliders.Count > 0)
3973 {
3974 ColliderArgs EndCollidingMessage = new ColliderArgs();
3975 List<DetectedObject> colliding = new List<DetectedObject>();
3976 foreach (uint localId in endedColliders)
3977 {
3978 if (localId == 0)
3979 continue;
3980
3981 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
3982 string data = "";
3983 if (obj != null)
3984 {
3985 DetectedObject detobj = new DetectedObject();
3986 detobj.keyUUID = obj.UUID;
3987 detobj.nameStr = obj.Name;
3988 detobj.ownerUUID = obj.OwnerID;
3989 detobj.posVector = obj.AbsolutePosition;
3990 detobj.rotQuat = obj.GetWorldRotation();
3991 detobj.velVector = obj.Velocity;
3992 detobj.colliderType = 0;
3993 detobj.groupUUID = obj.GroupID;
3994 colliding.Add(detobj);
3995 }
3996 }
3997
3998 if (colliding.Count > 0)
3999 {
4000 EndCollidingMessage.Colliders = colliding;
4001
4002 foreach (SceneObjectGroup att in GetAttachments())
4003 Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage);
4004 }
4005 }
4006
4007 if (thisHitColliders.Count > 0)
4008 {
4009 ColliderArgs CollidingMessage = new ColliderArgs();
4010 List<DetectedObject> colliding = new List<DetectedObject>();
4011 foreach (uint localId in thisHitColliders)
4012 {
4013 if (localId == 0)
4014 continue;
4015
4016 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
4017 string data = "";
4018 if (obj != null)
4019 {
4020 DetectedObject detobj = new DetectedObject();
4021 detobj.keyUUID = obj.UUID;
4022 detobj.nameStr = obj.Name;
4023 detobj.ownerUUID = obj.OwnerID;
4024 detobj.posVector = obj.AbsolutePosition;
4025 detobj.rotQuat = obj.GetWorldRotation();
4026 detobj.velVector = obj.Velocity;
4027 detobj.colliderType = 0;
4028 detobj.groupUUID = obj.GroupID;
4029 colliding.Add(detobj);
4030 }
4031 }
4032
4033 if (colliding.Count > 0)
4034 {
4035 CollidingMessage.Colliders = colliding;
4036
4037 lock (m_attachments)
4038 {
4039 foreach (SceneObjectGroup att in m_attachments)
4040 Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage);
4041 }
4042 }
4043 }
4044 }
4040 } 4045 }
4041} 4046}