aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs334
1 files changed, 271 insertions, 63 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6b562e5..1e1eee2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -107,6 +107,9 @@ namespace OpenSim.Region.Framework.Scenes
107 [XmlIgnore] 107 [XmlIgnore]
108 public bool DIE_AT_EDGE; 108 public bool DIE_AT_EDGE;
109 109
110 [XmlIgnore]
111 public Dictionary<int, string> m_CollisionFilter;
112
110 // TODO: This needs to be persisted in next XML version update! 113 // TODO: This needs to be persisted in next XML version update!
111 [XmlIgnore] 114 [XmlIgnore]
112 public readonly int[] PayPrice = {-2,-2,-2,-2,-2}; 115 public readonly int[] PayPrice = {-2,-2,-2,-2,-2};
@@ -456,6 +459,15 @@ namespace OpenSim.Region.Framework.Scenes
456 ParentGroup.HasGroupChanged = true; 459 ParentGroup.HasGroupChanged = true;
457 } 460 }
458 } 461 }
462
463 public Dictionary<int, string> CollisionFilter
464 {
465 get { return m_CollisionFilter; }
466 set
467 {
468 m_CollisionFilter = value;
469 }
470 }
459 471
460 public ulong RegionHandle 472 public ulong RegionHandle
461 { 473 {
@@ -1883,20 +1895,52 @@ namespace OpenSim.Region.Framework.Scenes
1883 1895
1884 if (m_parentGroup.Scene == null) 1896 if (m_parentGroup.Scene == null)
1885 return; 1897 return;
1886 1898 #region collision Filter
1887 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 1899 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
1888 if (obj != null) 1900 if (obj != null)
1889 { 1901 {
1890 DetectedObject detobj = new DetectedObject(); 1902 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1891 detobj.keyUUID = obj.UUID; 1903 {
1892 detobj.nameStr = obj.Name; 1904 string data = "";
1893 detobj.ownerUUID = obj._ownerID; 1905 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1894 detobj.posVector = obj.AbsolutePosition; 1906 //If it is 1, it is to accept ONLY collisions from this object
1895 detobj.rotQuat = obj.GetWorldRotation(); 1907 if(data != "")
1896 detobj.velVector = obj.Velocity; 1908 {
1897 detobj.colliderType = 0; 1909 DetectedObject detobj = new DetectedObject();
1898 detobj.groupUUID = obj._groupID; 1910 detobj.keyUUID = obj.UUID;
1899 colliding.Add(detobj); 1911 detobj.nameStr = obj.Name;
1912 detobj.ownerUUID = obj._ownerID;
1913 detobj.posVector = obj.AbsolutePosition;
1914 detobj.rotQuat = obj.GetWorldRotation();
1915 detobj.velVector = obj.Velocity;
1916 detobj.colliderType = 0;
1917 detobj.groupUUID = obj._groupID;
1918 colliding.Add(detobj);
1919 }
1920 //If it is 0, it is to not accept collisions from this object
1921 else
1922 {
1923 }
1924 }
1925 else
1926 {
1927 string data = "";
1928 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1929 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1930 if(data == "")
1931 {
1932 DetectedObject detobj = new DetectedObject();
1933 detobj.keyUUID = obj.UUID;
1934 detobj.nameStr = obj.Name;
1935 detobj.ownerUUID = obj._ownerID;
1936 detobj.posVector = obj.AbsolutePosition;
1937 detobj.rotQuat = obj.GetWorldRotation();
1938 detobj.velVector = obj.Velocity;
1939 detobj.colliderType = 0;
1940 detobj.groupUUID = obj._groupID;
1941 colliding.Add(detobj);
1942 }
1943 }
1900 } 1944 }
1901 else 1945 else
1902 { 1946 {
@@ -1908,19 +1952,52 @@ namespace OpenSim.Region.Framework.Scenes
1908 1952
1909 if (av.LocalId == localId) 1953 if (av.LocalId == localId)
1910 { 1954 {
1911 DetectedObject detobj = new DetectedObject(); 1955 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1912 detobj.keyUUID = av.UUID; 1956 {
1913 detobj.nameStr = av.ControllingClient.Name; 1957 string data = "";
1914 detobj.ownerUUID = av.UUID; 1958 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1915 detobj.posVector = av.AbsolutePosition; 1959 //If it is 1, it is to accept ONLY collisions from this avatar
1916 detobj.rotQuat = av.Rotation; 1960 if(data != "")
1917 detobj.velVector = av.Velocity; 1961 {
1918 detobj.colliderType = 0; 1962 DetectedObject detobj = new DetectedObject();
1919 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1963 detobj.keyUUID = av.UUID;
1920 colliding.Add(detobj); 1964 detobj.nameStr = av.ControllingClient.Name;
1965 detobj.ownerUUID = av.UUID;
1966 detobj.posVector = av.AbsolutePosition;
1967 detobj.rotQuat = av.Rotation;
1968 detobj.velVector = av.Velocity;
1969 detobj.colliderType = 0;
1970 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
1971 colliding.Add(detobj);
1972 }
1973 //If it is 0, it is to not accept collisions from this avatar
1974 else
1975 {
1976 }
1977 }
1978 else
1979 {
1980 string data = "";
1981 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1982 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1983 if(data == "")
1984 {
1985 DetectedObject detobj = new DetectedObject();
1986 detobj.keyUUID = av.UUID;
1987 detobj.nameStr = av.ControllingClient.Name;
1988 detobj.ownerUUID = av.UUID;
1989 detobj.posVector = av.AbsolutePosition;
1990 detobj.rotQuat = av.Rotation;
1991 detobj.velVector = av.Velocity;
1992 detobj.colliderType = 0;
1993 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
1994 colliding.Add(detobj);
1995 }
1996 }
1921 } 1997 }
1922 } 1998 }
1923 } 1999 }
2000 #endregion
1924 } 2001 }
1925 if (colliding.Count > 0) 2002 if (colliding.Count > 0)
1926 { 2003 {
@@ -1954,41 +2031,105 @@ namespace OpenSim.Region.Framework.Scenes
1954 2031
1955 if (m_parentGroup.Scene == null) 2032 if (m_parentGroup.Scene == null)
1956 return; 2033 return;
1957 2034 #region collision Filter
1958 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2035 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
1959 if (obj != null) 2036 if (obj != null)
1960 { 2037 {
1961 DetectedObject detobj = new DetectedObject(); 2038 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1962 detobj.keyUUID = obj.UUID; 2039 {
1963 detobj.nameStr = obj.Name; 2040 string data = "";
1964 detobj.ownerUUID = obj._ownerID; 2041 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1965 detobj.posVector = obj.AbsolutePosition; 2042 //If it is 1, it is to accept ONLY collisions from this object
1966 detobj.rotQuat = obj.GetWorldRotation(); 2043 if(data != "")
1967 detobj.velVector = obj.Velocity; 2044 {
1968 detobj.colliderType = 0; 2045 DetectedObject detobj = new DetectedObject();
1969 detobj.groupUUID = obj._groupID; 2046 detobj.keyUUID = obj.UUID;
1970 colliding.Add(detobj); 2047 detobj.nameStr = obj.Name;
2048 detobj.ownerUUID = obj._ownerID;
2049 detobj.posVector = obj.AbsolutePosition;
2050 detobj.rotQuat = obj.GetWorldRotation();
2051 detobj.velVector = obj.Velocity;
2052 detobj.colliderType = 0;
2053 detobj.groupUUID = obj._groupID;
2054 colliding.Add(detobj);
2055 }
2056 //If it is 0, it is to not accept collisions from this object
2057 else
2058 {
2059 }
2060 }
2061 else
2062 {
2063 string data = "";
2064 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2065 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2066 if(data == "")
2067 {
2068 DetectedObject detobj = new DetectedObject();
2069 detobj.keyUUID = obj.UUID;
2070 detobj.nameStr = obj.Name;
2071 detobj.ownerUUID = obj._ownerID;
2072 detobj.posVector = obj.AbsolutePosition;
2073 detobj.rotQuat = obj.GetWorldRotation();
2074 detobj.velVector = obj.Velocity;
2075 detobj.colliderType = 0;
2076 detobj.groupUUID = obj._groupID;
2077 colliding.Add(detobj);
2078 }
2079 }
1971 } 2080 }
1972 else 2081 else
1973 { 2082 {
1974 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); 2083 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
1975 2084
1976 for (int i = 0; i < avlist.Length; i++) 2085 for (int i = 0; i < avlist.Length; i++)
1977 { 2086 {
1978 ScenePresence av = avlist[i]; 2087 ScenePresence av = avlist[i];
1979 2088
1980 if (av.LocalId == localId) 2089 if (av.LocalId == localId)
1981 { 2090 {
1982 DetectedObject detobj = new DetectedObject(); 2091 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1983 detobj.keyUUID = av.UUID; 2092 {
1984 detobj.nameStr = av.Name; 2093 string data = "";
1985 detobj.ownerUUID = av.UUID; 2094 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1986 detobj.posVector = av.AbsolutePosition; 2095 //If it is 1, it is to accept ONLY collisions from this avatar
1987 detobj.rotQuat = av.Rotation; 2096 if(data != "")
1988 detobj.velVector = av.Velocity; 2097 {
1989 detobj.colliderType = 0; 2098 DetectedObject detobj = new DetectedObject();
1990 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2099 detobj.keyUUID = av.UUID;
1991 colliding.Add(detobj); 2100 detobj.nameStr = av.ControllingClient.Name;
2101 detobj.ownerUUID = av.UUID;
2102 detobj.posVector = av.AbsolutePosition;
2103 detobj.rotQuat = av.Rotation;
2104 detobj.velVector = av.Velocity;
2105 detobj.colliderType = 0;
2106 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2107 colliding.Add(detobj);
2108 }
2109 //If it is 0, it is to not accept collisions from this avatar
2110 else
2111 {
2112 }
2113 }
2114 else
2115 {
2116 string data = "";
2117 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2118 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2119 if(data == "")
2120 {
2121 DetectedObject detobj = new DetectedObject();
2122 detobj.keyUUID = av.UUID;
2123 detobj.nameStr = av.ControllingClient.Name;
2124 detobj.ownerUUID = av.UUID;
2125 detobj.posVector = av.AbsolutePosition;
2126 detobj.rotQuat = av.Rotation;
2127 detobj.velVector = av.Velocity;
2128 detobj.colliderType = 0;
2129 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2130 colliding.Add(detobj);
2131 }
2132 }
1992 } 2133 }
1993 } 2134 }
1994 } 2135 }
@@ -2006,6 +2147,7 @@ namespace OpenSim.Region.Framework.Scenes
2006 m_parentGroup.Scene.EventManager.TriggerScriptColliding(LocalId, CollidingMessage); 2147 m_parentGroup.Scene.EventManager.TriggerScriptColliding(LocalId, CollidingMessage);
2007 } 2148 }
2008 } 2149 }
2150 #endregion
2009 } 2151 }
2010 2152
2011 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_end) != 0) 2153 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_end) != 0)
@@ -2024,19 +2166,52 @@ namespace OpenSim.Region.Framework.Scenes
2024 return; 2166 return;
2025 if (m_parentGroup.Scene == null) 2167 if (m_parentGroup.Scene == null)
2026 return; 2168 return;
2169 #region collision Filter
2027 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2170 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2028 if (obj != null) 2171 if (obj != null)
2029 { 2172 {
2030 DetectedObject detobj = new DetectedObject(); 2173 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2031 detobj.keyUUID = obj.UUID; 2174 {
2032 detobj.nameStr = obj.Name; 2175 string data = "";
2033 detobj.ownerUUID = obj._ownerID; 2176 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2034 detobj.posVector = obj.AbsolutePosition; 2177 //If it is 1, it is to accept ONLY collisions from this object
2035 detobj.rotQuat = obj.GetWorldRotation(); 2178 if(data != "")
2036 detobj.velVector = obj.Velocity; 2179 {
2037 detobj.colliderType = 0; 2180 DetectedObject detobj = new DetectedObject();
2038 detobj.groupUUID = obj._groupID; 2181 detobj.keyUUID = obj.UUID;
2039 colliding.Add(detobj); 2182 detobj.nameStr = obj.Name;
2183 detobj.ownerUUID = obj._ownerID;
2184 detobj.posVector = obj.AbsolutePosition;
2185 detobj.rotQuat = obj.GetWorldRotation();
2186 detobj.velVector = obj.Velocity;
2187 detobj.colliderType = 0;
2188 detobj.groupUUID = obj._groupID;
2189 colliding.Add(detobj);
2190 }
2191 //If it is 0, it is to not accept collisions from this object
2192 else
2193 {
2194 }
2195 }
2196 else
2197 {
2198 string data = "";
2199 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2200 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2201 if(data == "")
2202 {
2203 DetectedObject detobj = new DetectedObject();
2204 detobj.keyUUID = obj.UUID;
2205 detobj.nameStr = obj.Name;
2206 detobj.ownerUUID = obj._ownerID;
2207 detobj.posVector = obj.AbsolutePosition;
2208 detobj.rotQuat = obj.GetWorldRotation();
2209 detobj.velVector = obj.Velocity;
2210 detobj.colliderType = 0;
2211 detobj.groupUUID = obj._groupID;
2212 colliding.Add(detobj);
2213 }
2214 }
2040 } 2215 }
2041 else 2216 else
2042 { 2217 {
@@ -2048,19 +2223,52 @@ namespace OpenSim.Region.Framework.Scenes
2048 2223
2049 if (av.LocalId == localId) 2224 if (av.LocalId == localId)
2050 { 2225 {
2051 DetectedObject detobj = new DetectedObject(); 2226 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2052 detobj.keyUUID = av.UUID; 2227 {
2053 detobj.nameStr = av.Name; 2228 string data = "";
2054 detobj.ownerUUID = av.UUID; 2229 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2055 detobj.posVector = av.AbsolutePosition; 2230 //If it is 1, it is to accept ONLY collisions from this avatar
2056 detobj.rotQuat = av.Rotation; 2231 if(data != "")
2057 detobj.velVector = av.Velocity; 2232 {
2058 detobj.colliderType = 0; 2233 DetectedObject detobj = new DetectedObject();
2059 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2234 detobj.keyUUID = av.UUID;
2060 colliding.Add(detobj); 2235 detobj.nameStr = av.ControllingClient.Name;
2236 detobj.ownerUUID = av.UUID;
2237 detobj.posVector = av.AbsolutePosition;
2238 detobj.rotQuat = av.Rotation;
2239 detobj.velVector = av.Velocity;
2240 detobj.colliderType = 0;
2241 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2242 colliding.Add(detobj);
2243 }
2244 //If it is 0, it is to not accept collisions from this avatar
2245 else
2246 {
2247 }
2248 }
2249 else
2250 {
2251 string data = "";
2252 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2253 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2254 if(data == "")
2255 {
2256 DetectedObject detobj = new DetectedObject();
2257 detobj.keyUUID = av.UUID;
2258 detobj.nameStr = av.ControllingClient.Name;
2259 detobj.ownerUUID = av.UUID;
2260 detobj.posVector = av.AbsolutePosition;
2261 detobj.rotQuat = av.Rotation;
2262 detobj.velVector = av.Velocity;
2263 detobj.colliderType = 0;
2264 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2265 colliding.Add(detobj);
2266 }
2267 }
2061 } 2268 }
2062 } 2269 }
2063 } 2270 }
2271 #endregion
2064 } 2272 }
2065 2273
2066 if (colliding.Count > 0) 2274 if (colliding.Count > 0)