aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorMelanie2010-01-10 19:59:49 +0000
committerMelanie2010-01-10 19:59:49 +0000
commit511481e8d983f3648d671e4da6ddac29f8a35632 (patch)
tree23b004de0dba7ec106a1809b7256e218e8c0a313 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parentMerge branch 'master' into careminster (diff)
parentClean CRs from previous patch (diff)
downloadopensim-SC-511481e8d983f3648d671e4da6ddac29f8a35632.zip
opensim-SC-511481e8d983f3648d671e4da6ddac29f8a35632.tar.gz
opensim-SC-511481e8d983f3648d671e4da6ddac29f8a35632.tar.bz2
opensim-SC-511481e8d983f3648d671e4da6ddac29f8a35632.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs272
1 files changed, 195 insertions, 77 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ff4abf9..7906138 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -139,15 +139,15 @@ namespace OpenSim.Region.Framework.Scenes
139 public uint TimeStampTerse; 139 public uint TimeStampTerse;
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID; 142 public UUID FromItemID;
143 143
144 [XmlIgnore] 144 [XmlIgnore]
145 public int STATUS_ROTATE_X; 145 public int STATUS_ROTATE_X;
146 146
147 [XmlIgnore] 147 [XmlIgnore]
148 public int STATUS_ROTATE_Y; 148 public int STATUS_ROTATE_Y;
149 149
150 [XmlIgnore] 150 [XmlIgnore]
151 public int STATUS_ROTATE_Z; 151 public int STATUS_ROTATE_Z;
152 152
153 [XmlIgnore] 153 [XmlIgnore]
@@ -1684,19 +1684,19 @@ namespace OpenSim.Region.Framework.Scenes
1684 return false; 1684 return false;
1685 1685
1686 return m_parentGroup.RootPart.DIE_AT_EDGE; 1686 return m_parentGroup.RootPart.DIE_AT_EDGE;
1687 } 1687 }
1688 1688
1689 public int GetAxisRotation(int axis) 1689 public int GetAxisRotation(int axis)
1690 { 1690 {
1691 //Cannot use ScriptBaseClass constants as no referance to it currently. 1691 //Cannot use ScriptBaseClass constants as no referance to it currently.
1692 if (axis == 2)//STATUS_ROTATE_X 1692 if (axis == 2)//STATUS_ROTATE_X
1693 return STATUS_ROTATE_X; 1693 return STATUS_ROTATE_X;
1694 if (axis == 4)//STATUS_ROTATE_Y 1694 if (axis == 4)//STATUS_ROTATE_Y
1695 return STATUS_ROTATE_Y; 1695 return STATUS_ROTATE_Y;
1696 if (axis == 8)//STATUS_ROTATE_Z 1696 if (axis == 8)//STATUS_ROTATE_Z
1697 return STATUS_ROTATE_Z; 1697 return STATUS_ROTATE_Z;
1698 1698
1699 return 0; 1699 return 0;
1700 } 1700 }
1701 1701
1702 public double GetDistanceTo(Vector3 a, Vector3 b) 1702 public double GetDistanceTo(Vector3 a, Vector3 b)
@@ -1862,16 +1862,12 @@ namespace OpenSim.Region.Framework.Scenes
1862 // and build up list of colliders this time 1862 // and build up list of colliders this time
1863 foreach (uint localid in collissionswith.Keys) 1863 foreach (uint localid in collissionswith.Keys)
1864 { 1864 {
1865 if (localid != 0) 1865 thisHitColliders.Add(localid);
1866 if (!m_lastColliders.Contains(localid))
1866 { 1867 {
1867 thisHitColliders.Add(localid); 1868 startedColliders.Add(localid);
1868 if (!m_lastColliders.Contains(localid))
1869 {
1870 startedColliders.Add(localid);
1871 }
1872
1873 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1874 } 1869 }
1870 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1875 } 1871 }
1876 1872
1877 // calculate things that ended colliding 1873 // calculate things that ended colliding
@@ -1913,6 +1909,8 @@ namespace OpenSim.Region.Framework.Scenes
1913 List<DetectedObject> colliding = new List<DetectedObject>(); 1909 List<DetectedObject> colliding = new List<DetectedObject>();
1914 foreach (uint localId in startedColliders) 1910 foreach (uint localId in startedColliders)
1915 { 1911 {
1912 if (localId == 0)
1913 return;
1916 // always running this check because if the user deletes the object it would return a null reference. 1914 // always running this check because if the user deletes the object it would return a null reference.
1917 if (m_parentGroup == null) 1915 if (m_parentGroup == null)
1918 return; 1916 return;
@@ -1945,24 +1943,24 @@ namespace OpenSim.Region.Framework.Scenes
1945 else 1943 else
1946 { 1944 {
1947 } 1945 }
1948 } 1946 }
1949 else 1947 else
1950 { 1948 {
1951 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1949 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1952 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 1950 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1953 if (!found) 1951 if (!found)
1954 { 1952 {
1955 DetectedObject detobj = new DetectedObject(); 1953 DetectedObject detobj = new DetectedObject();
1956 detobj.keyUUID = obj.UUID; 1954 detobj.keyUUID = obj.UUID;
1957 detobj.nameStr = obj.Name; 1955 detobj.nameStr = obj.Name;
1958 detobj.ownerUUID = obj._ownerID; 1956 detobj.ownerUUID = obj._ownerID;
1959 detobj.posVector = obj.AbsolutePosition; 1957 detobj.posVector = obj.AbsolutePosition;
1960 detobj.rotQuat = obj.GetWorldRotation(); 1958 detobj.rotQuat = obj.GetWorldRotation();
1961 detobj.velVector = obj.Velocity; 1959 detobj.velVector = obj.Velocity;
1962 detobj.colliderType = 0; 1960 detobj.colliderType = 0;
1963 detobj.groupUUID = obj._groupID; 1961 detobj.groupUUID = obj._groupID;
1964 colliding.Add(detobj); 1962 colliding.Add(detobj);
1965 } 1963 }
1966 } 1964 }
1967 } 1965 }
1968 else 1966 else
@@ -1974,7 +1972,7 @@ namespace OpenSim.Region.Framework.Scenes
1974 ScenePresence av = avlist[i]; 1972 ScenePresence av = avlist[i];
1975 1973
1976 if (av.LocalId == localId) 1974 if (av.LocalId == localId)
1977 { 1975 {
1978 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 1976 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
1979 { 1977 {
1980 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1978 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -1996,24 +1994,24 @@ namespace OpenSim.Region.Framework.Scenes
1996 else 1994 else
1997 { 1995 {
1998 } 1996 }
1999 } 1997 }
2000 else 1998 else
2001 { 1999 {
2002 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2000 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2003 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 2001 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2004 if (!found) 2002 if (!found)
2005 { 2003 {
2006 DetectedObject detobj = new DetectedObject(); 2004 DetectedObject detobj = new DetectedObject();
2007 detobj.keyUUID = av.UUID; 2005 detobj.keyUUID = av.UUID;
2008 detobj.nameStr = av.ControllingClient.Name; 2006 detobj.nameStr = av.ControllingClient.Name;
2009 detobj.ownerUUID = av.UUID; 2007 detobj.ownerUUID = av.UUID;
2010 detobj.posVector = av.AbsolutePosition; 2008 detobj.posVector = av.AbsolutePosition;
2011 detobj.rotQuat = av.Rotation; 2009 detobj.rotQuat = av.Rotation;
2012 detobj.velVector = av.Velocity; 2010 detobj.velVector = av.Velocity;
2013 detobj.colliderType = 0; 2011 detobj.colliderType = 0;
2014 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2012 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2015 colliding.Add(detobj); 2013 colliding.Add(detobj);
2016 } 2014 }
2017 } 2015 }
2018 2016
2019 } 2017 }
@@ -2048,7 +2046,7 @@ namespace OpenSim.Region.Framework.Scenes
2048 { 2046 {
2049 // always running this check because if the user deletes the object it would return a null reference. 2047 // always running this check because if the user deletes the object it would return a null reference.
2050 if (localId == 0) 2048 if (localId == 0)
2051 continue; 2049 return;
2052 2050
2053 if (m_parentGroup == null) 2051 if (m_parentGroup == null)
2054 return; 2052 return;
@@ -2110,7 +2108,7 @@ namespace OpenSim.Region.Framework.Scenes
2110 ScenePresence av = avlist[i]; 2108 ScenePresence av = avlist[i];
2111 2109
2112 if (av.LocalId == localId) 2110 if (av.LocalId == localId)
2113 { 2111 {
2114 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2112 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2115 { 2113 {
2116 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2114 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -2180,7 +2178,7 @@ namespace OpenSim.Region.Framework.Scenes
2180 foreach (uint localId in endedColliders) 2178 foreach (uint localId in endedColliders)
2181 { 2179 {
2182 if (localId == 0) 2180 if (localId == 0)
2183 continue; 2181 return;
2184 2182
2185 // always running this check because if the user deletes the object it would return a null reference. 2183 // always running this check because if the user deletes the object it would return a null reference.
2186 if (m_parentGroup == null) 2184 if (m_parentGroup == null)
@@ -2241,7 +2239,7 @@ namespace OpenSim.Region.Framework.Scenes
2241 ScenePresence av = avlist[i]; 2239 ScenePresence av = avlist[i];
2242 2240
2243 if (av.LocalId == localId) 2241 if (av.LocalId == localId)
2244 { 2242 {
2245 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2243 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2246 { 2244 {
2247 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2245 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -2301,7 +2299,121 @@ namespace OpenSim.Region.Framework.Scenes
2301 m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); 2299 m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage);
2302 } 2300 }
2303 } 2301 }
2304 } 2302 }
2303 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2304 {
2305 if (startedColliders.Count > 0)
2306 {
2307 ColliderArgs LandStartCollidingMessage = new ColliderArgs();
2308 List<DetectedObject> colliding = new List<DetectedObject>();
2309 foreach (uint localId in startedColliders)
2310 {
2311 if (localId == 0)
2312 {
2313 //Hope that all is left is ground!
2314 DetectedObject detobj = new DetectedObject();
2315 detobj.keyUUID = UUID.Zero;
2316 detobj.nameStr = "";
2317 detobj.ownerUUID = UUID.Zero;
2318 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2319 detobj.rotQuat = Quaternion.Identity;
2320 detobj.velVector = Vector3.Zero;
2321 detobj.colliderType = 0;
2322 detobj.groupUUID = UUID.Zero;
2323 colliding.Add(detobj);
2324 }
2325 }
2326
2327 if (colliding.Count > 0)
2328 {
2329 LandStartCollidingMessage.Colliders = colliding;
2330 // always running this check because if the user deletes the object it would return a null reference.
2331 if (m_parentGroup == null)
2332 return;
2333
2334 if (m_parentGroup.Scene == null)
2335 return;
2336
2337 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
2338 }
2339 }
2340 }
2341 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2342 {
2343 if (m_lastColliders.Count > 0)
2344 {
2345 ColliderArgs LandCollidingMessage = new ColliderArgs();
2346 List<DetectedObject> colliding = new List<DetectedObject>();
2347 foreach (uint localId in startedColliders)
2348 {
2349 if (localId == 0)
2350 {
2351 //Hope that all is left is ground!
2352 DetectedObject detobj = new DetectedObject();
2353 detobj.keyUUID = UUID.Zero;
2354 detobj.nameStr = "";
2355 detobj.ownerUUID = UUID.Zero;
2356 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2357 detobj.rotQuat = Quaternion.Identity;
2358 detobj.velVector = Vector3.Zero;
2359 detobj.colliderType = 0;
2360 detobj.groupUUID = UUID.Zero;
2361 colliding.Add(detobj);
2362 }
2363 }
2364
2365 if (colliding.Count > 0)
2366 {
2367 LandCollidingMessage.Colliders = colliding;
2368 // always running this check because if the user deletes the object it would return a null reference.
2369 if (m_parentGroup == null)
2370 return;
2371
2372 if (m_parentGroup.Scene == null)
2373 return;
2374
2375 m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
2376 }
2377 }
2378 }
2379 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2380 {
2381 if (endedColliders.Count > 0)
2382 {
2383 ColliderArgs LandEndCollidingMessage = new ColliderArgs();
2384 List<DetectedObject> colliding = new List<DetectedObject>();
2385 foreach (uint localId in startedColliders)
2386 {
2387 if (localId == 0)
2388 {
2389 //Hope that all is left is ground!
2390 DetectedObject detobj = new DetectedObject();
2391 detobj.keyUUID = UUID.Zero;
2392 detobj.nameStr = "";
2393 detobj.ownerUUID = UUID.Zero;
2394 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2395 detobj.rotQuat = Quaternion.Identity;
2396 detobj.velVector = Vector3.Zero;
2397 detobj.colliderType = 0;
2398 detobj.groupUUID = UUID.Zero;
2399 colliding.Add(detobj);
2400 }
2401 }
2402
2403 if (colliding.Count > 0)
2404 {
2405 LandEndCollidingMessage.Colliders = colliding;
2406 // always running this check because if the user deletes the object it would return a null reference.
2407 if (m_parentGroup == null)
2408 return;
2409
2410 if (m_parentGroup.Scene == null)
2411 return;
2412
2413 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
2414 }
2415 }
2416 }
2305 } 2417 }
2306 2418
2307 public void PhysicsOutOfBounds(Vector3 pos) 2419 public void PhysicsOutOfBounds(Vector3 pos)
@@ -2769,13 +2881,13 @@ namespace OpenSim.Region.Framework.Scenes
2769 if (m_parentGroup != null) 2881 if (m_parentGroup != null)
2770 { 2882 {
2771 m_parentGroup.SetAxisRotation(axis, rotate); 2883 m_parentGroup.SetAxisRotation(axis, rotate);
2772 } 2884 }
2773 //Cannot use ScriptBaseClass constants as no referance to it currently. 2885 //Cannot use ScriptBaseClass constants as no referance to it currently.
2774 if (axis == 2)//STATUS_ROTATE_X 2886 if (axis == 2)//STATUS_ROTATE_X
2775 STATUS_ROTATE_X = rotate; 2887 STATUS_ROTATE_X = rotate;
2776 if (axis == 4)//STATUS_ROTATE_Y 2888 if (axis == 4)//STATUS_ROTATE_Y
2777 STATUS_ROTATE_Y = rotate; 2889 STATUS_ROTATE_Y = rotate;
2778 if (axis == 8)//STATUS_ROTATE_Z 2890 if (axis == 8)//STATUS_ROTATE_Z
2779 STATUS_ROTATE_Z = rotate; 2891 STATUS_ROTATE_Z = rotate;
2780 } 2892 }
2781 2893
@@ -3709,6 +3821,9 @@ namespace OpenSim.Region.Framework.Scenes
3709 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3821 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3710 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3822 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3711 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 3823 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3824 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
3825 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
3826 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3712 (CollisionSound != UUID.Zero) 3827 (CollisionSound != UUID.Zero)
3713 ) 3828 )
3714 { 3829 {
@@ -3913,6 +4028,9 @@ namespace OpenSim.Region.Framework.Scenes
3913 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4028 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3914 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4029 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3915 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4030 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4031 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4032 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4033 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3916 (CollisionSound != UUID.Zero) 4034 (CollisionSound != UUID.Zero)
3917 ) 4035 )
3918 { 4036 {