aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
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
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')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs138
2 files changed, 156 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 753344d..4dd6f32 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -189,6 +189,10 @@ namespace OpenSim.Region.Framework.Scenes
189 public event ScriptColliding OnScriptColliding; 189 public event ScriptColliding OnScriptColliding;
190 public event ScriptColliding OnScriptCollidingEnd; 190 public event ScriptColliding OnScriptCollidingEnd;
191 191
192 public event ScriptColliding OnScriptLandColliderStart;
193 public event ScriptColliding OnScriptLandColliding;
194 public event ScriptColliding OnScriptLandColliderEnd;
195
192 public delegate void OnMakeChildAgentDelegate(ScenePresence presence); 196 public delegate void OnMakeChildAgentDelegate(ScenePresence presence);
193 public event OnMakeChildAgentDelegate OnMakeChildAgent; 197 public event OnMakeChildAgentDelegate OnMakeChildAgent;
194 198
@@ -439,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes
439 private ScriptColliding handlerCollidingStart = null; 443 private ScriptColliding handlerCollidingStart = null;
440 private ScriptColliding handlerColliding = null; 444 private ScriptColliding handlerColliding = null;
441 private ScriptColliding handlerCollidingEnd = null; 445 private ScriptColliding handlerCollidingEnd = null;
446 private ScriptColliding handlerLandCollidingStart = null;
447 private ScriptColliding handlerLandColliding = null;
448 private ScriptColliding handlerLandCollidingEnd = null;
442 private GetScriptRunning handlerGetScriptRunning = null; 449 private GetScriptRunning handlerGetScriptRunning = null;
443 450
444 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null; 451 private SunLindenHour handlerCurrentTimeAsLindenSunHour = null;
@@ -1034,6 +1041,27 @@ namespace OpenSim.Region.Framework.Scenes
1034 handlerCollidingEnd(localId, colliders); 1041 handlerCollidingEnd(localId, colliders);
1035 } 1042 }
1036 1043
1044 public void TriggerScriptLandCollidingStart(uint localId, ColliderArgs colliders)
1045 {
1046 handlerLandCollidingStart = OnScriptLandColliderStart;
1047 if (handlerLandCollidingStart != null)
1048 handlerLandCollidingStart(localId, colliders);
1049 }
1050
1051 public void TriggerScriptLandColliding(uint localId, ColliderArgs colliders)
1052 {
1053 handlerLandColliding = OnScriptLandColliding;
1054 if (handlerLandColliding != null)
1055 handlerLandColliding(localId, colliders);
1056 }
1057
1058 public void TriggerScriptLandCollidingEnd(uint localId, ColliderArgs colliders)
1059 {
1060 handlerLandCollidingEnd = OnScriptLandColliderEnd;
1061 if (handlerLandCollidingEnd != null)
1062 handlerLandCollidingEnd(localId, colliders);
1063 }
1064
1037 public void TriggerSetRootAgentScene(UUID agentID, Scene scene) 1065 public void TriggerSetRootAgentScene(UUID agentID, Scene scene)
1038 { 1066 {
1039 handlerSetRootAgentScene = OnSetRootAgentScene; 1067 handlerSetRootAgentScene = OnSetRootAgentScene;
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 {