aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs327
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs19
3 files changed, 293 insertions, 64 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f8498c6..e63e8d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -412,6 +412,17 @@ namespace OpenSim.Region.Framework.Scenes
412 { 412 {
413 get { return true; } 413 get { return true; }
414 } 414 }
415
416 private bool m_passCollision;
417 public bool PassCollision
418 {
419 get { return m_passCollision; }
420 set
421 {
422 m_passCollision = value;
423 HasGroupChanged = true;
424 }
425 }
415 426
416 public bool IsSelected 427 public bool IsSelected
417 { 428 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6b562e5..3e330eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -140,6 +140,9 @@ namespace OpenSim.Region.Framework.Scenes
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID; 142 public UUID FromItemID;
143
144 [XmlIgnore]
145 private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>();
143 146
144 /// <value> 147 /// <value>
145 /// The UUID of the user inventory item from which this object was rezzed if this is a root part. 148 /// The UUID of the user inventory item from which this object was rezzed if this is a root part.
@@ -457,6 +460,17 @@ namespace OpenSim.Region.Framework.Scenes
457 } 460 }
458 } 461 }
459 462
463
464 [XmlIgnore]
465 public Dictionary<int, string> CollisionFilter
466 {
467 get { return m_CollisionFilter; }
468 set
469 {
470 m_CollisionFilter = value;
471 }
472 }
473
460 public ulong RegionHandle 474 public ulong RegionHandle
461 { 475 {
462 get { return m_regionHandle; } 476 get { return m_regionHandle; }
@@ -1885,18 +1899,49 @@ namespace OpenSim.Region.Framework.Scenes
1885 return; 1899 return;
1886 1900
1887 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 1901 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
1902 string data = "";
1888 if (obj != null) 1903 if (obj != null)
1889 { 1904 {
1890 DetectedObject detobj = new DetectedObject(); 1905 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1891 detobj.keyUUID = obj.UUID; 1906 {
1892 detobj.nameStr = obj.Name; 1907 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1893 detobj.ownerUUID = obj._ownerID; 1908 //If it is 1, it is to accept ONLY collisions from this object
1894 detobj.posVector = obj.AbsolutePosition; 1909 if(found)
1895 detobj.rotQuat = obj.GetWorldRotation(); 1910 {
1896 detobj.velVector = obj.Velocity; 1911 DetectedObject detobj = new DetectedObject();
1897 detobj.colliderType = 0; 1912 detobj.keyUUID = obj.UUID;
1898 detobj.groupUUID = obj._groupID; 1913 detobj.nameStr = obj.Name;
1899 colliding.Add(detobj); 1914 detobj.ownerUUID = obj._ownerID;
1915 detobj.posVector = obj.AbsolutePosition;
1916 detobj.rotQuat = obj.GetWorldRotation();
1917 detobj.velVector = obj.Velocity;
1918 detobj.colliderType = 0;
1919 detobj.groupUUID = obj._groupID;
1920 colliding.Add(detobj);
1921 }
1922 //If it is 0, it is to not accept collisions from this object
1923 else
1924 {
1925 }
1926 }
1927 else
1928 {
1929 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1930 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1931 if(found)
1932 {
1933 DetectedObject detobj = new DetectedObject();
1934 detobj.keyUUID = obj.UUID;
1935 detobj.nameStr = obj.Name;
1936 detobj.ownerUUID = obj._ownerID;
1937 detobj.posVector = obj.AbsolutePosition;
1938 detobj.rotQuat = obj.GetWorldRotation();
1939 detobj.velVector = obj.Velocity;
1940 detobj.colliderType = 0;
1941 detobj.groupUUID = obj._groupID;
1942 colliding.Add(detobj);
1943 }
1944 }
1900 } 1945 }
1901 else 1946 else
1902 { 1947 {
@@ -1908,16 +1953,47 @@ namespace OpenSim.Region.Framework.Scenes
1908 1953
1909 if (av.LocalId == localId) 1954 if (av.LocalId == localId)
1910 { 1955 {
1911 DetectedObject detobj = new DetectedObject(); 1956 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1912 detobj.keyUUID = av.UUID; 1957 {
1913 detobj.nameStr = av.ControllingClient.Name; 1958 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1914 detobj.ownerUUID = av.UUID; 1959 //If it is 1, it is to accept ONLY collisions from this avatar
1915 detobj.posVector = av.AbsolutePosition; 1960 if(found)
1916 detobj.rotQuat = av.Rotation; 1961 {
1917 detobj.velVector = av.Velocity; 1962 DetectedObject detobj = new DetectedObject();
1918 detobj.colliderType = 0; 1963 detobj.keyUUID = av.UUID;
1919 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 1964 detobj.nameStr = av.ControllingClient.Name;
1920 colliding.Add(detobj); 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 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1981 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1982 if(found)
1983 {
1984 DetectedObject detobj = new DetectedObject();
1985 detobj.keyUUID = av.UUID;
1986 detobj.nameStr = av.ControllingClient.Name;
1987 detobj.ownerUUID = av.UUID;
1988 detobj.posVector = av.AbsolutePosition;
1989 detobj.rotQuat = av.Rotation;
1990 detobj.velVector = av.Velocity;
1991 detobj.colliderType = 0;
1992 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
1993 colliding.Add(detobj);
1994 }
1995 }
1996
1921 } 1997 }
1922 } 1998 }
1923 } 1999 }
@@ -1931,7 +2007,10 @@ namespace OpenSim.Region.Framework.Scenes
1931 2007
1932 if (m_parentGroup.Scene == null) 2008 if (m_parentGroup.Scene == null)
1933 return; 2009 return;
1934 2010 if(m_parentGroup.PassCollision == true)
2011 {
2012 //TODO: Add pass to root prim!
2013 }
1935 m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); 2014 m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage);
1936 } 2015 }
1937 } 2016 }
@@ -1956,39 +2035,101 @@ namespace OpenSim.Region.Framework.Scenes
1956 return; 2035 return;
1957 2036
1958 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2037 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2038 string data = "";
1959 if (obj != null) 2039 if (obj != null)
1960 { 2040 {
1961 DetectedObject detobj = new DetectedObject(); 2041 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1962 detobj.keyUUID = obj.UUID; 2042 {
1963 detobj.nameStr = obj.Name; 2043 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1964 detobj.ownerUUID = obj._ownerID; 2044 //If it is 1, it is to accept ONLY collisions from this object
1965 detobj.posVector = obj.AbsolutePosition; 2045 if(found)
1966 detobj.rotQuat = obj.GetWorldRotation(); 2046 {
1967 detobj.velVector = obj.Velocity; 2047 DetectedObject detobj = new DetectedObject();
1968 detobj.colliderType = 0; 2048 detobj.keyUUID = obj.UUID;
1969 detobj.groupUUID = obj._groupID; 2049 detobj.nameStr = obj.Name;
1970 colliding.Add(detobj); 2050 detobj.ownerUUID = obj._ownerID;
2051 detobj.posVector = obj.AbsolutePosition;
2052 detobj.rotQuat = obj.GetWorldRotation();
2053 detobj.velVector = obj.Velocity;
2054 detobj.colliderType = 0;
2055 detobj.groupUUID = obj._groupID;
2056 colliding.Add(detobj);
2057 }
2058 //If it is 0, it is to not accept collisions from this object
2059 else
2060 {
2061 }
2062 }
2063 else
2064 {
2065 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2066 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2067 if(found)
2068 {
2069 DetectedObject detobj = new DetectedObject();
2070 detobj.keyUUID = obj.UUID;
2071 detobj.nameStr = obj.Name;
2072 detobj.ownerUUID = obj._ownerID;
2073 detobj.posVector = obj.AbsolutePosition;
2074 detobj.rotQuat = obj.GetWorldRotation();
2075 detobj.velVector = obj.Velocity;
2076 detobj.colliderType = 0;
2077 detobj.groupUUID = obj._groupID;
2078 colliding.Add(detobj);
2079 }
2080 }
1971 } 2081 }
1972 else 2082 else
1973 { 2083 {
1974 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); 2084 ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
1975 2085
1976 for (int i = 0; i < avlist.Length; i++) 2086 for (int i = 0; i < avlist.Length; i++)
1977 { 2087 {
1978 ScenePresence av = avlist[i]; 2088 ScenePresence av = avlist[i];
1979 2089
1980 if (av.LocalId == localId) 2090 if (av.LocalId == localId)
1981 { 2091 {
1982 DetectedObject detobj = new DetectedObject(); 2092 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
1983 detobj.keyUUID = av.UUID; 2093 {
1984 detobj.nameStr = av.Name; 2094 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1985 detobj.ownerUUID = av.UUID; 2095 //If it is 1, it is to accept ONLY collisions from this avatar
1986 detobj.posVector = av.AbsolutePosition; 2096 if(found)
1987 detobj.rotQuat = av.Rotation; 2097 {
1988 detobj.velVector = av.Velocity; 2098 DetectedObject detobj = new DetectedObject();
1989 detobj.colliderType = 0; 2099 detobj.keyUUID = av.UUID;
1990 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2100 detobj.nameStr = av.ControllingClient.Name;
1991 colliding.Add(detobj); 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 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2117 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2118 if(found)
2119 {
2120 DetectedObject detobj = new DetectedObject();
2121 detobj.keyUUID = av.UUID;
2122 detobj.nameStr = av.ControllingClient.Name;
2123 detobj.ownerUUID = av.UUID;
2124 detobj.posVector = av.AbsolutePosition;
2125 detobj.rotQuat = av.Rotation;
2126 detobj.velVector = av.Velocity;
2127 detobj.colliderType = 0;
2128 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2129 colliding.Add(detobj);
2130 }
2131 }
2132
1992 } 2133 }
1993 } 2134 }
1994 } 2135 }
@@ -2025,18 +2166,49 @@ namespace OpenSim.Region.Framework.Scenes
2025 if (m_parentGroup.Scene == null) 2166 if (m_parentGroup.Scene == null)
2026 return; 2167 return;
2027 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); 2168 SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId);
2169 string data = "";
2028 if (obj != null) 2170 if (obj != null)
2029 { 2171 {
2030 DetectedObject detobj = new DetectedObject(); 2172 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2031 detobj.keyUUID = obj.UUID; 2173 {
2032 detobj.nameStr = obj.Name; 2174 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2033 detobj.ownerUUID = obj._ownerID; 2175 //If it is 1, it is to accept ONLY collisions from this object
2034 detobj.posVector = obj.AbsolutePosition; 2176 if(found)
2035 detobj.rotQuat = obj.GetWorldRotation(); 2177 {
2036 detobj.velVector = obj.Velocity; 2178 DetectedObject detobj = new DetectedObject();
2037 detobj.colliderType = 0; 2179 detobj.keyUUID = obj.UUID;
2038 detobj.groupUUID = obj._groupID; 2180 detobj.nameStr = obj.Name;
2039 colliding.Add(detobj); 2181 detobj.ownerUUID = obj._ownerID;
2182 detobj.posVector = obj.AbsolutePosition;
2183 detobj.rotQuat = obj.GetWorldRotation();
2184 detobj.velVector = obj.Velocity;
2185 detobj.colliderType = 0;
2186 detobj.groupUUID = obj._groupID;
2187 colliding.Add(detobj);
2188 }
2189 //If it is 0, it is to not accept collisions from this object
2190 else
2191 {
2192 }
2193 }
2194 else
2195 {
2196 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2197 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2198 if(found)
2199 {
2200 DetectedObject detobj = new DetectedObject();
2201 detobj.keyUUID = obj.UUID;
2202 detobj.nameStr = obj.Name;
2203 detobj.ownerUUID = obj._ownerID;
2204 detobj.posVector = obj.AbsolutePosition;
2205 detobj.rotQuat = obj.GetWorldRotation();
2206 detobj.velVector = obj.Velocity;
2207 detobj.colliderType = 0;
2208 detobj.groupUUID = obj._groupID;
2209 colliding.Add(detobj);
2210 }
2211 }
2040 } 2212 }
2041 else 2213 else
2042 { 2214 {
@@ -2048,16 +2220,47 @@ namespace OpenSim.Region.Framework.Scenes
2048 2220
2049 if (av.LocalId == localId) 2221 if (av.LocalId == localId)
2050 { 2222 {
2051 DetectedObject detobj = new DetectedObject(); 2223 if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name))
2052 detobj.keyUUID = av.UUID; 2224 {
2053 detobj.nameStr = av.Name; 2225 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2054 detobj.ownerUUID = av.UUID; 2226 //If it is 1, it is to accept ONLY collisions from this avatar
2055 detobj.posVector = av.AbsolutePosition; 2227 if(found)
2056 detobj.rotQuat = av.Rotation; 2228 {
2057 detobj.velVector = av.Velocity; 2229 DetectedObject detobj = new DetectedObject();
2058 detobj.colliderType = 0; 2230 detobj.keyUUID = av.UUID;
2059 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2231 detobj.nameStr = av.ControllingClient.Name;
2060 colliding.Add(detobj); 2232 detobj.ownerUUID = av.UUID;
2233 detobj.posVector = av.AbsolutePosition;
2234 detobj.rotQuat = av.Rotation;
2235 detobj.velVector = av.Velocity;
2236 detobj.colliderType = 0;
2237 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2238 colliding.Add(detobj);
2239 }
2240 //If it is 0, it is to not accept collisions from this avatar
2241 else
2242 {
2243 }
2244 }
2245 else
2246 {
2247 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2248 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
2249 if(found)
2250 {
2251 DetectedObject detobj = new DetectedObject();
2252 detobj.keyUUID = av.UUID;
2253 detobj.nameStr = av.ControllingClient.Name;
2254 detobj.ownerUUID = av.UUID;
2255 detobj.posVector = av.AbsolutePosition;
2256 detobj.rotQuat = av.Rotation;
2257 detobj.velVector = av.Velocity;
2258 detobj.colliderType = 0;
2259 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2260 colliding.Add(detobj);
2261 }
2262 }
2263
2061 } 2264 }
2062 } 2265 }
2063 } 2266 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3a229c2..df8de19 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2812,7 +2812,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2812 public void llCollisionFilter(string name, string id, int accept) 2812 public void llCollisionFilter(string name, string id, int accept)
2813 { 2813 {
2814 m_host.AddScriptLPS(1); 2814 m_host.AddScriptLPS(1);
2815 NotImplemented("llCollisionFilter"); 2815 m_host.CollisionFilter.Clear();
2816 if(id != null)
2817 {
2818 m_host.CollisionFilter.Add(accept,id);
2819 }
2820 else
2821 {
2822 m_host.CollisionFilter.Add(accept,name);
2823 }
2816 } 2824 }
2817 2825
2818 public void llTakeControls(int controls, int accept, int pass_on) 2826 public void llTakeControls(int controls, int accept, int pass_on)
@@ -4333,7 +4341,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4333 public void llPassCollisions(int pass) 4341 public void llPassCollisions(int pass)
4334 { 4342 {
4335 m_host.AddScriptLPS(1); 4343 m_host.AddScriptLPS(1);
4336 NotImplemented("llPassCollisions"); 4344 if(pass == 0)
4345 {
4346 m_host.ParentGroup.PassCollision = false;
4347 }
4348 else
4349 {
4350 m_host.ParentGroup.PassCollision = true;
4351 }
4337 } 4352 }
4338 4353
4339 public LSL_String llGetScriptName() 4354 public LSL_String llGetScriptName()