aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorRevolution2010-01-10 14:28:53 -0600
committerMelanie2010-01-10 19:58:18 +0000
commit038ec133e648ab99643f5738e4ab85e450e5aa45 (patch)
tree49615f146772b4bef04a75c85b401aa6b21e6393 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentFix a small bug in login disable code (diff)
downloadopensim-SC_OLD-038ec133e648ab99643f5738e4ab85e450e5aa45.zip
opensim-SC_OLD-038ec133e648ab99643f5738e4ab85e450e5aa45.tar.gz
opensim-SC_OLD-038ec133e648ab99643f5738e4ab85e450e5aa45.tar.bz2
opensim-SC_OLD-038ec133e648ab99643f5738e4ab85e450e5aa45.tar.xz
Adds land collision events.
CRs cleaned from patch Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs138
1 files changed, 128 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index cadb19f..a427f12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1853,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes
1853 // and build up list of colliders this time 1853 // and build up list of colliders this time
1854 foreach (uint localid in collissionswith.Keys) 1854 foreach (uint localid in collissionswith.Keys)
1855 { 1855 {
1856 if (localid != 0) 1856 thisHitColliders.Add(localid);
1857 if (!m_lastColliders.Contains(localid))
1857 { 1858 {
1858 thisHitColliders.Add(localid); 1859 startedColliders.Add(localid);
1859 if (!m_lastColliders.Contains(localid))
1860 {
1861 startedColliders.Add(localid);
1862 }
1863
1864 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1865 } 1860 }
1861 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1866 } 1862 }
1867 1863
1868 // calculate things that ended colliding 1864 // calculate things that ended colliding
@@ -1904,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1904 List<DetectedObject> colliding = new List<DetectedObject>(); 1900 List<DetectedObject> colliding = new List<DetectedObject>();
1905 foreach (uint localId in startedColliders) 1901 foreach (uint localId in startedColliders)
1906 { 1902 {
1903 if (localId == 0)
1904 return;
1907 // always running this check because if the user deletes the object it would return a null reference. 1905 // always running this check because if the user deletes the object it would return a null reference.
1908 if (m_parentGroup == null) 1906 if (m_parentGroup == null)
1909 return; 1907 return;
@@ -2039,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
2039 { 2037 {
2040 // always running this check because if the user deletes the object it would return a null reference. 2038 // always running this check because if the user deletes the object it would return a null reference.
2041 if (localId == 0) 2039 if (localId == 0)
2042 continue; 2040 return;
2043 2041
2044 if (m_parentGroup == null) 2042 if (m_parentGroup == null)
2045 return; 2043 return;
@@ -2171,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes
2171 foreach (uint localId in endedColliders) 2169 foreach (uint localId in endedColliders)
2172 { 2170 {
2173 if (localId == 0) 2171 if (localId == 0)
2174 continue; 2172 return;
2175 2173
2176 // always running this check because if the user deletes the object it would return a null reference. 2174 // always running this check because if the user deletes the object it would return a null reference.
2177 if (m_parentGroup == null) 2175 if (m_parentGroup == null)
@@ -2293,6 +2291,120 @@ namespace OpenSim.Region.Framework.Scenes
2293 } 2291 }
2294 } 2292 }
2295 } 2293 }
2294 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2295 {
2296 if (startedColliders.Count > 0)
2297 {
2298 ColliderArgs LandStartCollidingMessage = new ColliderArgs();
2299 List<DetectedObject> colliding = new List<DetectedObject>();
2300 foreach (uint localId in startedColliders)
2301 {
2302 if (localId == 0)
2303 {
2304 //Hope that all is left is ground!
2305 DetectedObject detobj = new DetectedObject();
2306 detobj.keyUUID = UUID.Zero;
2307 detobj.nameStr = "";
2308 detobj.ownerUUID = UUID.Zero;
2309 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2310 detobj.rotQuat = Quaternion.Identity;
2311 detobj.velVector = Vector3.Zero;
2312 detobj.colliderType = 0;
2313 detobj.groupUUID = UUID.Zero;
2314 colliding.Add(detobj);
2315 }
2316 }
2317
2318 if (colliding.Count > 0)
2319 {
2320 LandStartCollidingMessage.Colliders = colliding;
2321 // always running this check because if the user deletes the object it would return a null reference.
2322 if (m_parentGroup == null)
2323 return;
2324
2325 if (m_parentGroup.Scene == null)
2326 return;
2327
2328 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
2329 }
2330 }
2331 }
2332 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2333 {
2334 if (m_lastColliders.Count > 0)
2335 {
2336 ColliderArgs LandCollidingMessage = new ColliderArgs();
2337 List<DetectedObject> colliding = new List<DetectedObject>();
2338 foreach (uint localId in startedColliders)
2339 {
2340 if (localId == 0)
2341 {
2342 //Hope that all is left is ground!
2343 DetectedObject detobj = new DetectedObject();
2344 detobj.keyUUID = UUID.Zero;
2345 detobj.nameStr = "";
2346 detobj.ownerUUID = UUID.Zero;
2347 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2348 detobj.rotQuat = Quaternion.Identity;
2349 detobj.velVector = Vector3.Zero;
2350 detobj.colliderType = 0;
2351 detobj.groupUUID = UUID.Zero;
2352 colliding.Add(detobj);
2353 }
2354 }
2355
2356 if (colliding.Count > 0)
2357 {
2358 LandCollidingMessage.Colliders = colliding;
2359 // always running this check because if the user deletes the object it would return a null reference.
2360 if (m_parentGroup == null)
2361 return;
2362
2363 if (m_parentGroup.Scene == null)
2364 return;
2365
2366 m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
2367 }
2368 }
2369 }
2370 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2371 {
2372 if (endedColliders.Count > 0)
2373 {
2374 ColliderArgs LandEndCollidingMessage = new ColliderArgs();
2375 List<DetectedObject> colliding = new List<DetectedObject>();
2376 foreach (uint localId in startedColliders)
2377 {
2378 if (localId == 0)
2379 {
2380 //Hope that all is left is ground!
2381 DetectedObject detobj = new DetectedObject();
2382 detobj.keyUUID = UUID.Zero;
2383 detobj.nameStr = "";
2384 detobj.ownerUUID = UUID.Zero;
2385 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2386 detobj.rotQuat = Quaternion.Identity;
2387 detobj.velVector = Vector3.Zero;
2388 detobj.colliderType = 0;
2389 detobj.groupUUID = UUID.Zero;
2390 colliding.Add(detobj);
2391 }
2392 }
2393
2394 if (colliding.Count > 0)
2395 {
2396 LandEndCollidingMessage.Colliders = colliding;
2397 // always running this check because if the user deletes the object it would return a null reference.
2398 if (m_parentGroup == null)
2399 return;
2400
2401 if (m_parentGroup.Scene == null)
2402 return;
2403
2404 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
2405 }
2406 }
2407 }
2296 } 2408 }
2297 2409
2298 public void PhysicsOutOfBounds(Vector3 pos) 2410 public void PhysicsOutOfBounds(Vector3 pos)
@@ -3698,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes
3698 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3810 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3699 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3811 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3700 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 3812 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3813 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
3814 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
3815 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3701 (CollisionSound != UUID.Zero) 3816 (CollisionSound != UUID.Zero)
3702 ) 3817 )
3703 { 3818 {
@@ -3902,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes
3902 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4017 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3903 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4018 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3904 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4019 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4020 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4021 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4022 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3905 (CollisionSound != UUID.Zero) 4023 (CollisionSound != UUID.Zero)
3906 ) 4024 )
3907 { 4025 {