diff options
author | UbitUmarov | 2016-12-14 16:08:25 +0000 |
---|---|---|
committer | UbitUmarov | 2016-12-14 16:08:25 +0000 |
commit | 553b326fb2dda6650e5992c06213c54e1730347e (patch) | |
tree | 0138dfedc0839e03e0bea314a303c67aad1250f4 /OpenSim/Region/ScriptEngine/Shared | |
parent | Add osDie(key) (diff) | |
download | opensim-SC_OLD-553b326fb2dda6650e5992c06213c54e1730347e.zip opensim-SC_OLD-553b326fb2dda6650e5992c06213c54e1730347e.tar.gz opensim-SC_OLD-553b326fb2dda6650e5992c06213c54e1730347e.tar.bz2 opensim-SC_OLD-553b326fb2dda6650e5992c06213c54e1730347e.tar.xz |
restrict osDie to objects rezzed by the script object group and a few more changes
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8ecbaba..87fe287 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1882,33 +1882,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1882 | 1882 | ||
1883 | public void osDie(LSL_Key objectUUID) | 1883 | public void osDie(LSL_Key objectUUID) |
1884 | { | 1884 | { |
1885 | CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); | 1885 | // CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); |
1886 | // if this is restricted to objects rezzed by this host level can be reduced | ||
1887 | |||
1888 | CheckThreatLevel(ThreatLevel.Low, "osDie"); | ||
1886 | m_host.AddScriptLPS(1); | 1889 | m_host.AddScriptLPS(1); |
1887 | 1890 | ||
1888 | UUID objUUID; | 1891 | UUID objUUID; |
1889 | if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. | 1892 | if (!UUID.TryParse(objectUUID, out objUUID)) |
1890 | { | 1893 | { |
1891 | OSSLShoutError("osDie() cannot delete objects with invalid UUIDs"); | 1894 | OSSLShoutError("osDie() cannot delete objects with invalid UUIDs"); |
1892 | return; | 1895 | return; |
1893 | } | 1896 | } |
1894 | 1897 | ||
1895 | DeleteObject(objUUID); | 1898 | // harakiri check |
1896 | } | 1899 | if(objUUID == UUID.Zero) |
1900 | throw new SelfDeleteException(); | ||
1897 | 1901 | ||
1898 | private void DeleteObject(UUID objUUID) | ||
1899 | { | ||
1900 | SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); | 1902 | SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); |
1901 | 1903 | ||
1902 | if (sceneOG == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. | 1904 | if (sceneOG == null || sceneOG.IsDeleted) |
1903 | { | 1905 | return; |
1904 | OSSLShoutError("osDie() cannot delete " + objUUID.ToString() + ", object was not found in scene."); | 1906 | |
1907 | if(sceneOG.IsAttachment) | ||
1905 | return; | 1908 | return; |
1906 | } | ||
1907 | 1909 | ||
1908 | if (sceneOG.OwnerID != m_host.OwnerID) | 1910 | if (sceneOG.OwnerID != m_host.OwnerID) |
1909 | return; | 1911 | return; |
1912 | |||
1913 | // harakiri check | ||
1914 | if(sceneOG.UUID == m_host.ParentGroup.UUID) | ||
1915 | throw new SelfDeleteException(); | ||
1910 | 1916 | ||
1911 | World.DeleteSceneObject(sceneOG, false); | 1917 | // restrict to objects rezzed by host |
1918 | if(sceneOG.RezzerID == m_host.ParentGroup.UUID) | ||
1919 | World.DeleteSceneObject(sceneOG, false); | ||
1912 | } | 1920 | } |
1913 | 1921 | ||
1914 | /// <summary> | 1922 | /// <summary> |