aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs334
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs16
5 files changed, 412 insertions, 67 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)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3a229c2..f0d73d3 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)
@@ -8323,11 +8331,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8323 8331
8324 return -1; 8332 return -1;
8325 } 8333 }
8326 8334
8327 public void llSetInventoryPermMask(string item, int mask, int value) 8335 public void llSetInventoryPermMask(string item, int mask, int value)
8328 { 8336 {
8329 m_host.AddScriptLPS(1); 8337 m_host.AddScriptLPS(1);
8330 NotImplemented("llSetInventoryPermMask"); 8338 if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false))
8339 {
8340 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
8341 {
8342 lock (m_host.TaskInventory)
8343 {
8344 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
8345 {
8346 if (inv.Value.Name == item)
8347 {
8348 switch (mask)
8349 {
8350 case 0:
8351 inv.Value.BasePermissions = (uint)value;
8352 break;
8353 case 1:
8354 inv.Value.CurrentPermissions = (uint)value;
8355 break;
8356 case 2:
8357 inv.Value.GroupPermissions = (uint)value;
8358 break;
8359 case 3:
8360 inv.Value.EveryonePermissions = (uint)value;
8361 break;
8362 case 4:
8363 inv.Value.NextPermissions = (uint)value;
8364 break;
8365 }
8366 }
8367 }
8368 }
8369 }
8370 }
8331 } 8371 }
8332 8372
8333 public LSL_String llGetInventoryCreator(string item) 8373 public LSL_String llGetInventoryCreator(string item)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index bd09534..b6fc0a4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1987,5 +1987,82 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1987 1987
1988 return (int)pws; 1988 return (int)pws;
1989 } 1989 }
1990 public void osSetSpeed(string UUID, float SpeedModifier)
1991 {
1992 CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed");
1993 m_host.AddScriptLPS(1);
1994 ScenePresence avatar = World.GetScenePresence(new UUID(UUID));
1995 avatar.SpeedModifier = SpeedModifier;
1996 }
1997 public void osKickAvatar(string FirstName,string SurName,string alert)
1998 {
1999 CheckThreatLevel(ThreatLevel.Severe, "osKickAvatar");
2000 if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID))
2001 {
2002 foreach (ScenePresence presence in World.GetAvatars())
2003 {
2004 if ((presence.Firstname == FirstName) &&
2005 presence.Lastname == SurName)
2006 {
2007 // kick client...
2008 if (alert != null)
2009 presence.ControllingClient.Kick(alert);
2010
2011 // ...and close on our side
2012 presence.Scene.IncomingCloseAgent(presence.UUID);
2013 }
2014 }
2015 }
2016 }
2017 public void osCauseDamage(string avatar, double damage)
2018 {
2019 CheckThreatLevel(ThreatLevel.High, "osCauseDamage");
2020 m_host.AddScriptLPS(1);
2021
2022 UUID avatarId = new UUID(avatar);
2023 Vector3 pos = m_host.GetWorldPosition();
2024
2025 ScenePresence presence = World.GetScenePresence(avatarId);
2026 if (presence != null)
2027 {
2028 LandData land = World.GetLandData((float)pos.X, (float)pos.Y);
2029 if ((land.Flags & (uint)ParcelFlags.AllowDamage) == (uint)ParcelFlags.AllowDamage)
2030 {
2031 float health = presence.Health;
2032 health -= (float)damage;
2033 presence.setHealthWithUpdate(health);
2034 if (health <= 0)
2035 {
2036 float healthliveagain = 100;
2037 presence.ControllingClient.SendAgentAlertMessage("You died!", true);
2038 presence.setHealthWithUpdate(healthliveagain);
2039 presence.Scene.TeleportClientHome(presence.UUID, presence.ControllingClient);
2040 }
2041 }
2042 }
2043 }
2044 public void osCauseHealing(string avatar, double healing)
2045 {
2046 CheckThreatLevel(ThreatLevel.High, "osCauseHealing");
2047 m_host.AddScriptLPS(1);
2048
2049 UUID avatarId = new UUID(avatar);
2050 ScenePresence presence = World.GetScenePresence(avatarId);
2051 Vector3 pos = m_host.GetWorldPosition();
2052 bool result = World.ScriptDanger(m_host.LocalId, new Vector3((float)pos.X, (float)pos.Y, (float)pos.Z));
2053 if (result)
2054 {
2055 if (presence != null)
2056 {
2057 float health = presence.Health;
2058 health += (float)healing;
2059 if (health >= 100)
2060 {
2061 health = 100;
2062 }
2063 presence.setHealthWithUpdate(health);
2064 }
2065 }
2066 }
1990 } 2067 }
1991} 2068}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index d943b59..5e20f7d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -165,5 +165,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
165 LSL_List osGetRegionStats(); 165 LSL_List osGetRegionStats();
166 166
167 int osGetSimulatorMemory(); 167 int osGetSimulatorMemory();
168 void osKickAvatar(string FirstName,string SurName,string alert);
169 void osSetSpeed(string UUID, float SpeedModifier);
170 void osCauseHealing(string avatar, double healing);
171 void osCauseDamage(string avatar, double damage);
168 } 172 }
169} 173}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 2876ad6..2ec6226 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -647,5 +647,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
647 { 647 {
648 return m_OSSL_Functions.osGetSimulatorMemory(); 648 return m_OSSL_Functions.osGetSimulatorMemory();
649 } 649 }
650 public void osKickAvatar(string FirstName,string SurName,string alert)
651 {
652 m_OSSL_Functions.osKickAvatar( FirstName, SurName, alert);
653 }
654 public void osSetSpeed(string UUID, float SpeedModifier)
655 {
656 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
657 }
658 public void osCauseDamage(string avatar, double damage)
659 {
660 m_OSSL_Functions.osCauseDamage(avatar, damage);
661 }
662 public void osCauseHealing(string avatar, double healing)
663 {
664 m_OSSL_Functions.osCauseHealing(avatar, healing);
665 }
650 } 666 }
651} 667}