Add osDie(key)

Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
melanie
Jeff Kelley 2016-05-22 00:57:30 +02:00 committed by UbitUmarov
parent 7a31a85408
commit 95d6396300
3 changed files with 49 additions and 0 deletions

View File

@ -1874,6 +1874,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
"dataserver", resobj, new DetectParams[0]));
}
/// <summary>
/// Similar to llDie but given an object UUID
/// </summary>
/// <param name="objectUUID"></param>
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);
}
/// <summary>
/// Write a notecard directly to the prim's inventory.
/// </summary>

View File

@ -316,6 +316,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// </summary>
void osForceBreakAllLinks();
/// <summary>
/// Similar to llDie but given an object UUID
/// </summary>
/// <param name="objectUUID"></param>
void osDie(LSL_Key objectUUID);
/// <summary>
/// Check if the given key is an npc
/// </summary>

View File

@ -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);