From 95d6396300d8788ac3b0e5a3ae2d184016eef9cc Mon Sep 17 00:00:00 2001 From: Jeff Kelley Date: Sun, 22 May 2016 00:57:30 +0200 Subject: Add osDie(key) Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/OSSL_Api.cs | 37 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 ++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 3 files changed, 49 insertions(+) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9742119..8ecbaba 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1874,6 +1874,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api "dataserver", resobj, new DetectParams[0])); } + + /// + /// Similar to llDie but given an object UUID + /// + /// + + public void osDie(LSL_Key objectUUID) + { + CheckThreatLevel(ThreatLevel.VeryHigh, "osDie"); + m_host.AddScriptLPS(1); + + UUID objUUID; + if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead. + { + OSSLShoutError("osDie() cannot delete objects with invalid UUIDs"); + return; + } + + DeleteObject(objUUID); + } + + private void DeleteObject(UUID objUUID) + { + SceneObjectGroup sceneOG = World.GetSceneObjectGroup(objUUID); + + if (sceneOG == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead. + { + OSSLShoutError("osDie() cannot delete " + objUUID.ToString() + ", object was not found in scene."); + return; + } + + if (sceneOG.OwnerID != m_host.OwnerID) + return; + + World.DeleteSceneObject(sceneOG, false); + } + /// /// Write a notecard directly to the prim's inventory. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index cf3e6df..7415fea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -317,6 +317,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osForceBreakAllLinks(); /// + /// Similar to llDie but given an object UUID + /// + /// + + void osDie(LSL_Key objectUUID); + + /// /// Check if the given key is an npc /// /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 2e8a76c..c34ccd0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -577,6 +577,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceBreakAllLinks(); } + public void osDie(LSL_Key objectUUID) + { + m_OSSL_Functions.osDie(objectUUID); + } + public LSL_Integer osIsNpc(LSL_Key npc) { return m_OSSL_Functions.osIsNpc(npc); -- cgit v1.1