diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1e8b51be80..119c2ac7e8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2895,6 +2895,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } }); } + + public LSL_Float osGetHealth(string avatar) + { + CheckThreatLevel(ThreatLevel.None, "osGetHealth"); + m_host.AddScriptLPS(1); + + LSL_Float health = new LSL_Float(-1); + ScenePresence presence = World.GetScenePresence(new UUID(avatar)); + if (presence != null) health = presence.Health; + return health; + } public void osCauseDamage(string avatar, double damage) { @@ -3333,5 +3344,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } + + public void osRezDuplicate(LSL_Vector offset, LSL_Rotation rot) + { + CheckThreatLevel(ThreatLevel.High, "osRezDuplicate"); + m_host.AddScriptLPS(1); + + Vector3 v = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + Quaternion r = new Quaternion( + (float)rot.x, + (float)rot.y, + (float)rot.z, + (float)rot.s + ); + + Vector3 destination = m_host.ParentGroup.AbsolutePosition + v; + + if (!World.Permissions.CanRezObject( + m_host.ParentGroup.PrimCount, + m_host.OwnerID, + destination + )) + { + OSSLShoutError("Cannot duplicate object to destination, owner cannot rez objects at destination parcel."); + + ScriptSleep(100); + } + else + { + SceneObjectGroup duplicate = World.SceneGraph.DuplicateObject( + m_host.ParentGroup.LocalId, + v, + m_host.ParentGroup.RootPart.GetEffectiveObjectFlags(), + m_host.OwnerID, + m_host.GroupID, + r + ); + + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + duplicate.RootPart.UUID.ToString()) }, + new DetectParams[0])); + + ScriptSleep(100); + m_ScriptEngine.PostObjectEvent(duplicate.LocalId, new EventParams( + "on_rez", new Object[]{ + new LSL_Integer(0)}, + new DetectParams[0])); + } + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f000a3e77..8c90df438b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -258,6 +258,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces int osGetSimulatorMemory(); void osKickAvatar(string FirstName,string SurName,string alert); void osSetSpeed(string UUID, LSL_Float SpeedModifier); + LSL_Float osGetHealth(string avatar); void osCauseHealing(string avatar, double healing); void osCauseDamage(string avatar, double damage); LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules); @@ -305,5 +306,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. LSL_Key osGetRezzingObject(); + + /// + /// Duplicates an object as if the owner duplicated it. + /// + /// + /// + void osRezDuplicate(vector offset, rotation rot); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 94405d2b5d..9a2f859e23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -865,7 +865,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } - + + public LSL_Float osGetHealth(string avatar) + { + return m_OSSL_Functions.osGetHealth(avatar); + } + public void osCauseDamage(string avatar, double damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); @@ -950,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetRezzingObject(); } + + public void osRezDuplicate(vector offset, rotation rot) + { + m_OSSL_Functions.osRezDuplicate(offset, rot); + } } }