aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 c0243a5..8ac4c37 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};
@@ -451,6 +454,15 @@ namespace OpenSim.Region.Framework.Scenes
451 ParentGroup.HasGroupChanged = true; 454 ParentGroup.HasGroupChanged = true;
452 } 455 }
453 } 456 }
457
458 public Dictionary<int, string> CollisionFilter
459 {
460 get { return m_CollisionFilter; }
461 set
462 {
463 m_CollisionFilter = value;
464 }
465 }
454 466
455 public ulong RegionHandle 467 public ulong RegionHandle
456 { 468 {
@@ -1874,20 +1886,52 @@ namespace OpenSim.Region.Framework.Scenes
1874 1886
1875 if (m_parentGroup.Scene == null) 1887 if (m_parentGroup.Scene == null)
1876 return; 1888 return;
1877 1889 #region collision Filter
1878 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 1890 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
1879 if (obj != null) 1891 if (obj != null)
1880 { 1892 {
1881 DetectedObject detobj = new DetectedObject(); 1893 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1882 detobj.keyUUID = obj.UUID; 1894 {
1883 detobj.nameStr = obj.Name; 1895 string data = "";
1884 detobj.ownerUUID = obj._ownerID; 1896 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1885 detobj.posVector = obj.AbsolutePosition; 1897 //If it is 1, it is to accept ONLY collisions from this object
1886 detobj.rotQuat = obj.GetWorldRotation(); 1898 if(data != "")
1887 detobj.velVector = obj.Velocity; 1899 {
1888 detobj.colliderType = 0; 1900 DetectedObject detobj = new DetectedObject();
1889 detobj.groupUUID = obj._groupID; 1901 detobj.keyUUID = obj.UUID;
1890 colliding.Add(detobj); 1902 detobj.nameStr = obj.Name;
1903 detobj.ownerUUID = obj._ownerID;
1904 detobj.posVector = obj.AbsolutePosition;
1905 detobj.rotQuat = obj.GetWorldRotation();
1906 detobj.velVector = obj.Velocity;
1907 detobj.colliderType = 0;
1908 detobj.groupUUID = obj._groupID;
1909 colliding.Add(detobj);
1910 }
1911 //If it is 0, it is to not accept collisions from this object
1912 else
1913 {
1914 }
1915 }
1916 else
1917 {
1918 string data = "";
1919 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1920 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1921 if(data == "")
1922 {
1923 DetectedObject detobj = new DetectedObject();
1924 detobj.keyUUID = obj.UUID;
1925 detobj.nameStr = obj.Name;
1926 detobj.ownerUUID = obj._ownerID;
1927 detobj.posVector = obj.AbsolutePosition;
1928 detobj.rotQuat = obj.GetWorldRotation();
1929 detobj.velVector = obj.Velocity;
1930 detobj.colliderType = 0;
1931 detobj.groupUUID = obj._groupID;
1932 colliding.Add(detobj);
1933 }
1934 }
1891 } 1935 }
1892 else 1936 else
1893 { 1937 {
@@ -1899,19 +1943,52 @@ namespace OpenSim.Region.Framework.Scenes
1899 1943
1900 if (av.LocalId == localId) 1944 if (av.LocalId == localId)
1901 { 1945 {
1902 DetectedObject detobj = new DetectedObject(); 1946 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1903 detobj.keyUUID = av.UUID; 1947 {
1904 detobj.nameStr = av.ControllingClient.Name; 1948 string data = "";
1905 detobj.ownerUUID = av.UUID; 1949 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1906 detobj.posVector = av.AbsolutePosition; 1950 //If it is 1, it is to accept ONLY collisions from this avatar
1907 detobj.rotQuat = av.Rotation; 1951 if(data != "")
1908 detobj.velVector = av.Velocity; 1952 {
1909 detobj.colliderType = 0; 1953 DetectedObject detobj = new DetectedObject();
1910 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1954 detobj.keyUUID = av.UUID;
1911 colliding.Add(detobj); 1955 detobj.nameStr = av.ControllingClient.Name;
1956 detobj.ownerUUID = av.UUID;
1957 detobj.posVector = av.AbsolutePosition;
1958 detobj.rotQuat = av.Rotation;
1959 detobj.velVector = av.Velocity;
1960 detobj.colliderType = 0;
1961 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
1962 colliding.Add(detobj);
1963 }
1964 //If it is 0, it is to not accept collisions from this avatar
1965 else
1966 {
1967 }
1968 }
1969 else
1970 {
1971 string data = "";
1972 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1973 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1974 if(data == "")
1975 {
1976 DetectedObject detobj = new DetectedObject();
1977 detobj.keyUUID = av.UUID;
1978 detobj.nameStr = av.ControllingClient.Name;
1979 detobj.ownerUUID = av.UUID;
1980 detobj.posVector = av.AbsolutePosition;
1981 detobj.rotQuat = av.Rotation;
1982 detobj.velVector = av.Velocity;
1983 detobj.colliderType = 0;
1984 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
1985 colliding.Add(detobj);
1986 }
1987 }
1912 } 1988 }
1913 } 1989 }
1914 } 1990 }
1991 #endregion
1915 } 1992 }
1916 if (colliding.Count > 0) 1993 if (colliding.Count > 0)
1917 { 1994 {
@@ -1945,41 +2022,105 @@ namespace OpenSim.Region.Framework.Scenes
1945 2022
1946 if (m_parentGroup.Scene == null) 2023 if (m_parentGroup.Scene == null)
1947 return; 2024 return;
1948 2025 #region collision Filter
1949 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2026 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
1950 if (obj != null) 2027 if (obj != null)
1951 { 2028 {
1952 DetectedObject detobj = new DetectedObject(); 2029 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1953 detobj.keyUUID = obj.UUID; 2030 {
1954 detobj.nameStr = obj.Name; 2031 string data = "";
1955 detobj.ownerUUID = obj._ownerID; 2032 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1956 detobj.posVector = obj.AbsolutePosition; 2033 //If it is 1, it is to accept ONLY collisions from this object
1957 detobj.rotQuat = obj.GetWorldRotation(); 2034 if(data != "")
1958 detobj.velVector = obj.Velocity; 2035 {
1959 detobj.colliderType = 0; 2036 DetectedObject detobj = new DetectedObject();
1960 detobj.groupUUID = obj._groupID; 2037 detobj.keyUUID = obj.UUID;
1961 colliding.Add(detobj); 2038 detobj.nameStr = obj.Name;
2039 detobj.ownerUUID = obj._ownerID;
2040 detobj.posVector = obj.AbsolutePosition;
2041 detobj.rotQuat = obj.GetWorldRotation();
2042 detobj.velVector = obj.Velocity;
2043 detobj.colliderType = 0;
2044 detobj.groupUUID = obj._groupID;
2045 colliding.Add(detobj);
2046 }
2047 //If it is 0, it is to not accept collisions from this object
2048 else
2049 {
2050 }
2051 }
2052 else
2053 {
2054 string data = "";
2055 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2056 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2057 if(data == "")
2058 {
2059 DetectedObject detobj = new DetectedObject();
2060 detobj.keyUUID = obj.UUID;
2061 detobj.nameStr = obj.Name;
2062 detobj.ownerUUID = obj._ownerID;
2063 detobj.posVector = obj.AbsolutePosition;
2064 detobj.rotQuat = obj.GetWorldRotation();
2065 detobj.velVector = obj.Velocity;
2066 detobj.colliderType = 0;
2067 detobj.groupUUID = obj._groupID;
2068 colliding.Add(detobj);
2069 }
2070 }
1962 } 2071 }
1963 else 2072 else
1964 { 2073 {
1965 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); 2074 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
1966 2075
1967 for (int i = 0; i < avlist.Length; i++) 2076 for (int i = 0; i < avlist.Length; i++)
1968 { 2077 {
1969 ScenePresence av = avlist[i]; 2078 ScenePresence av = avlist[i];
1970 2079
1971 if (av.LocalId == localId) 2080 if (av.LocalId == localId)
1972 { 2081 {
1973 DetectedObject detobj = new DetectedObject(); 2082 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1974 detobj.keyUUID = av.UUID; 2083 {
1975 detobj.nameStr = av.Name; 2084 string data = "";
1976 detobj.ownerUUID = av.UUID; 2085 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1977 detobj.posVector = av.AbsolutePosition; 2086 //If it is 1, it is to accept ONLY collisions from this avatar
1978 detobj.rotQuat = av.Rotation; 2087 if(data != "")
1979 detobj.velVector = av.Velocity; 2088 {
1980 detobj.colliderType = 0; 2089 DetectedObject detobj = new DetectedObject();
1981 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2090 detobj.keyUUID = av.UUID;
1982 colliding.Add(detobj); 2091 detobj.nameStr = av.ControllingClient.Name;
2092 detobj.ownerUUID = av.UUID;
2093 detobj.posVector = av.AbsolutePosition;
2094 detobj.rotQuat = av.Rotation;
2095 detobj.velVector = av.Velocity;
2096 detobj.colliderType = 0;
2097 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2098 colliding.Add(detobj);
2099 }
2100 //If it is 0, it is to not accept collisions from this avatar
2101 else
2102 {
2103 }
2104 }
2105 else
2106 {
2107 string data = "";
2108 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2109 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2110 if(data == "")
2111 {
2112 DetectedObject detobj = new DetectedObject();
2113 detobj.keyUUID = av.UUID;
2114 detobj.nameStr = av.ControllingClient.Name;
2115 detobj.ownerUUID = av.UUID;
2116 detobj.posVector = av.AbsolutePosition;
2117 detobj.rotQuat = av.Rotation;
2118 detobj.velVector = av.Velocity;
2119 detobj.colliderType = 0;
2120 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2121 colliding.Add(detobj);
2122 }
2123 }
1983 } 2124 }
1984 } 2125 }
1985 } 2126 }
@@ -1997,6 +2138,7 @@ namespace OpenSim.Region.Framework.Scenes
1997 m_parentGroup.Scene.EventManager.TriggerScriptColliding(LocalId, CollidingMessage); 2138 m_parentGroup.Scene.EventManager.TriggerScriptColliding(LocalId, CollidingMessage);
1998 } 2139 }
1999 } 2140 }
2141 #endregion
2000 } 2142 }
2001 2143
2002 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_end) != 0) 2144 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.collision_end) != 0)
@@ -2015,19 +2157,52 @@ namespace OpenSim.Region.Framework.Scenes
2015 return; 2157 return;
2016 if (m_parentGroup.Scene == null) 2158 if (m_parentGroup.Scene == null)
2017 return; 2159 return;
2160 #region collision Filter
2018 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2161 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2019 if (obj != null) 2162 if (obj != null)
2020 { 2163 {
2021 DetectedObject detobj = new DetectedObject(); 2164 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2022 detobj.keyUUID = obj.UUID; 2165 {
2023 detobj.nameStr = obj.Name; 2166 string data = "";
2024 detobj.ownerUUID = obj._ownerID; 2167 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2025 detobj.posVector = obj.AbsolutePosition; 2168 //If it is 1, it is to accept ONLY collisions from this object
2026 detobj.rotQuat = obj.GetWorldRotation(); 2169 if(data != "")
2027 detobj.velVector = obj.Velocity; 2170 {
2028 detobj.colliderType = 0; 2171 DetectedObject detobj = new DetectedObject();
2029 detobj.groupUUID = obj._groupID; 2172 detobj.keyUUID = obj.UUID;
2030 colliding.Add(detobj); 2173 detobj.nameStr = obj.Name;
2174 detobj.ownerUUID = obj._ownerID;
2175 detobj.posVector = obj.AbsolutePosition;
2176 detobj.rotQuat = obj.GetWorldRotation();
2177 detobj.velVector = obj.Velocity;
2178 detobj.colliderType = 0;
2179 detobj.groupUUID = obj._groupID;
2180 colliding.Add(detobj);
2181 }
2182 //If it is 0, it is to not accept collisions from this object
2183 else
2184 {
2185 }
2186 }
2187 else
2188 {
2189 string data = "";
2190 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2191 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2192 if(data == "")
2193 {
2194 DetectedObject detobj = new DetectedObject();
2195 detobj.keyUUID = obj.UUID;
2196 detobj.nameStr = obj.Name;
2197 detobj.ownerUUID = obj._ownerID;
2198 detobj.posVector = obj.AbsolutePosition;
2199 detobj.rotQuat = obj.GetWorldRotation();
2200 detobj.velVector = obj.Velocity;
2201 detobj.colliderType = 0;
2202 detobj.groupUUID = obj._groupID;
2203 colliding.Add(detobj);
2204 }
2205 }
2031 } 2206 }
2032 else 2207 else
2033 { 2208 {
@@ -2039,19 +2214,52 @@ namespace OpenSim.Region.Framework.Scenes
2039 2214
2040 if (av.LocalId == localId) 2215 if (av.LocalId == localId)
2041 { 2216 {
2042 DetectedObject detobj = new DetectedObject(); 2217 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2043 detobj.keyUUID = av.UUID; 2218 {
2044 detobj.nameStr = av.Name; 2219 string data = "";
2045 detobj.ownerUUID = av.UUID; 2220 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2046 detobj.posVector = av.AbsolutePosition; 2221 //If it is 1, it is to accept ONLY collisions from this avatar
2047 detobj.rotQuat = av.Rotation; 2222 if(data != "")
2048 detobj.velVector = av.Velocity; 2223 {
2049 detobj.colliderType = 0; 2224 DetectedObject detobj = new DetectedObject();
2050 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2225 detobj.keyUUID = av.UUID;
2051 colliding.Add(detobj); 2226 detobj.nameStr = av.ControllingClient.Name;
2227 detobj.ownerUUID = av.UUID;
2228 detobj.posVector = av.AbsolutePosition;
2229 detobj.rotQuat = av.Rotation;
2230 detobj.velVector = av.Velocity;
2231 detobj.colliderType = 0;
2232 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2233 colliding.Add(detobj);
2234 }
2235 //If it is 0, it is to not accept collisions from this avatar
2236 else
2237 {
2238 }
2239 }
2240 else
2241 {
2242 string data = "";
2243 m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2244 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2245 if(data == "")
2246 {
2247 DetectedObject detobj = new DetectedObject();
2248 detobj.keyUUID = av.UUID;
2249 detobj.nameStr = av.ControllingClient.Name;
2250 detobj.ownerUUID = av.UUID;
2251 detobj.posVector = av.AbsolutePosition;
2252 detobj.rotQuat = av.Rotation;
2253 detobj.velVector = av.Velocity;
2254 detobj.colliderType = 0;
2255 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2256 colliding.Add(detobj);
2257 }
2258 }
2052 } 2259 }
2053 } 2260 }
2054 } 2261 }
2262 #endregion
2055 } 2263 }
2056 2264
2057 if (colliding.Count > 0) 2265 if (colliding.Count > 0)