aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2012-05-21 07:32:27 +0200
committerMelanie2012-05-21 07:32:27 +0200
commit7305d2e0ef843de24477e8f41af3091c880d811a (patch)
treea47dcb2bb8202146ced7ae2ae609c7bbcc8aeebb /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentFix setting positions of attachments. The recent security fix regarding (diff)
parent missing update script events call (diff)
downloadopensim-SC-7305d2e0ef843de24477e8f41af3091c880d811a.zip
opensim-SC-7305d2e0ef843de24477e8f41af3091c880d811a.tar.gz
opensim-SC-7305d2e0ef843de24477e8f41af3091c880d811a.tar.bz2
opensim-SC-7305d2e0ef843de24477e8f41af3091c880d811a.tar.xz
Merge branch 'ubitwork' into avination
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs133
1 files changed, 82 insertions, 51 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ebddf21..5a3b518 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2032,7 +2032,7 @@ namespace OpenSim.Region.Framework.Scenes
2032// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 2032// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
2033 2033
2034 if (PhysicsActor != null) 2034 if (PhysicsActor != null)
2035 m_sitAvatarHeight = PhysicsActor.Size.Z; 2035 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
2036 2036
2037 bool canSit = false; 2037 bool canSit = false;
2038 pos = part.AbsolutePosition + offset; 2038 pos = part.AbsolutePosition + offset;
@@ -4098,6 +4098,7 @@ namespace OpenSim.Region.Framework.Scenes
4098 4098
4099 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) 4099 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
4100 { 4100 {
4101 /*
4101 lock(m_collisionEventLock) 4102 lock(m_collisionEventLock)
4102 { 4103 {
4103 if (m_collisionEventFlag) 4104 if (m_collisionEventFlag)
@@ -4107,76 +4108,106 @@ namespace OpenSim.Region.Framework.Scenes
4107 4108
4108 Util.FireAndForget(delegate(object x) 4109 Util.FireAndForget(delegate(object x)
4109 { 4110 {
4111 */
4110 try 4112 try
4111 { 4113 {
4112 List<uint> thisHitColliders = new List<uint>(); 4114 List<uint> thisHitColliders = new List<uint>();
4113 List<uint> endedColliders = new List<uint>(); 4115 List<uint> endedColliders = new List<uint>();
4114 List<uint> startedColliders = new List<uint>(); 4116 List<uint> startedColliders = new List<uint>();
4117 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
4118 CollisionForSoundInfo soundinfo;
4119 ContactPoint curcontact;
4115 4120
4116 foreach (uint localid in coldata.Keys) 4121 if (coldata.Count == 0)
4117 { 4122 {
4118 thisHitColliders.Add(localid); 4123 if (m_lastColliders.Count == 0)
4119 if (!m_lastColliders.Contains(localid)) 4124 return; // nothing to do
4120 { 4125
4121 startedColliders.Add(localid); 4126 foreach (uint localID in m_lastColliders)
4122 }
4123 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4124 }
4125
4126 // calculate things that ended colliding
4127 foreach (uint localID in m_lastColliders)
4128 {
4129 if (!thisHitColliders.Contains(localID))
4130 { 4127 {
4131 endedColliders.Add(localID); 4128 endedColliders.Add(localID);
4132 } 4129 }
4133 } 4130 m_lastColliders.Clear();
4134 //add the items that started colliding this time to the last colliders list.
4135 foreach (uint localID in startedColliders)
4136 {
4137 m_lastColliders.Add(localID);
4138 }
4139 // remove things that ended colliding from the last colliders list
4140 foreach (uint localID in endedColliders)
4141 {
4142 m_lastColliders.Remove(localID);
4143 } 4131 }
4144 4132
4145 // do event notification 4133 else
4146 if (startedColliders.Count > 0)
4147 { 4134 {
4148 CollisionSounds.AvatarCollisionSound(this, startedColliders); 4135 foreach (uint id in coldata.Keys)
4149
4150 ColliderArgs StartCollidingMessage = new ColliderArgs();
4151 List<DetectedObject> colliding = new List<DetectedObject>();
4152 foreach (uint localId in startedColliders)
4153 { 4136 {
4154 if (localId == 0) 4137 thisHitColliders.Add(id);
4155 continue; 4138 if (!m_lastColliders.Contains(id))
4139 {
4140 startedColliders.Add(id);
4141 curcontact = coldata[id];
4142 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
4143 {
4144 soundinfo = new CollisionForSoundInfo();
4145 soundinfo.colliderID = id;
4146 soundinfo.position = curcontact.Position;
4147 soundinfo.relativeVel = curcontact.RelativeSpeed;
4148 soundinfolist.Add(soundinfo);
4149 }
4150 }
4151 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4152 }
4156 4153
4157 SceneObjectPart obj = Scene.GetSceneObjectPart(localId); 4154 // calculate things that ended colliding
4158 string data = ""; 4155 foreach (uint localID in m_lastColliders)
4159 if (obj != null) 4156 {
4157 if (!thisHitColliders.Contains(localID))
4160 { 4158 {
4161 DetectedObject detobj = new DetectedObject(); 4159 endedColliders.Add(localID);
4162 detobj.keyUUID = obj.UUID;
4163 detobj.nameStr = obj.Name;
4164 detobj.ownerUUID = obj.OwnerID;
4165 detobj.posVector = obj.AbsolutePosition;
4166 detobj.rotQuat = obj.GetWorldRotation();
4167 detobj.velVector = obj.Velocity;
4168 detobj.colliderType = 0;
4169 detobj.groupUUID = obj.GroupID;
4170 colliding.Add(detobj);
4171 } 4160 }
4172 } 4161 }
4162 //add the items that started colliding this time to the last colliders list.
4163 foreach (uint localID in startedColliders)
4164 {
4165 m_lastColliders.Add(localID);
4166 }
4167 // remove things that ended colliding from the last colliders list
4168 foreach (uint localID in endedColliders)
4169 {
4170 m_lastColliders.Remove(localID);
4171 }
4173 4172
4174 if (colliding.Count > 0) 4173 if (soundinfolist.Count > 0)
4174 CollisionSounds.AvatarCollisionSound(this, soundinfolist);
4175
4176 // do event notification
4177 if (startedColliders.Count > 0)
4175 { 4178 {
4176 StartCollidingMessage.Colliders = colliding;
4177 4179
4178 foreach (SceneObjectGroup att in GetAttachments()) 4180 ColliderArgs StartCollidingMessage = new ColliderArgs();
4179 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); 4181 List<DetectedObject> colliding = new List<DetectedObject>();
4182 foreach (uint localId in startedColliders)
4183 {
4184 if (localId == 0)
4185 continue;
4186
4187 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
4188 string data = "";
4189 if (obj != null)
4190 {
4191 DetectedObject detobj = new DetectedObject();
4192 detobj.keyUUID = obj.UUID;
4193 detobj.nameStr = obj.Name;
4194 detobj.ownerUUID = obj.OwnerID;
4195 detobj.posVector = obj.AbsolutePosition;
4196 detobj.rotQuat = obj.GetWorldRotation();
4197 detobj.velVector = obj.Velocity;
4198 detobj.colliderType = 0;
4199 detobj.groupUUID = obj.GroupID;
4200 colliding.Add(detobj);
4201 }
4202 }
4203
4204 if (colliding.Count > 0)
4205 {
4206 StartCollidingMessage.Colliders = colliding;
4207
4208 foreach (SceneObjectGroup att in GetAttachments())
4209 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
4210 }
4180 } 4211 }
4181 } 4212 }
4182 4213
@@ -4257,7 +4288,7 @@ namespace OpenSim.Region.Framework.Scenes
4257 { 4288 {
4258 m_collisionEventFlag = false; 4289 m_collisionEventFlag = false;
4259 } 4290 }
4260 }); 4291// });
4261 } 4292 }
4262 4293
4263 private void TeleportFlagsDebug() { 4294 private void TeleportFlagsDebug() {