implementing osDropAttachment & osDropAttachmentAt
parent
e81e19a3b4
commit
35b7c80e0b
|
@ -406,6 +406,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
|
||||
public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId)
|
||||
{
|
||||
DetachSingleAttachmentToGround(sp, soLocalId, sp.AbsolutePosition, Quaternion.Identity);
|
||||
}
|
||||
|
||||
public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId, Vector3 absolutePos, Quaternion absoluteRot)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
@ -448,7 +453,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
so.FromItemID = UUID.Zero;
|
||||
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
so.AbsolutePosition = sp.AbsolutePosition;
|
||||
so.AbsolutePosition = absolutePos;
|
||||
if (absoluteRot != Quaternion.Identity)
|
||||
{
|
||||
so.UpdateGroupRotationR(absoluteRot);
|
||||
}
|
||||
so.AttachedAvatar = UUID.Zero;
|
||||
rootPart.SetParentLocalId(0);
|
||||
so.ClearPartAttachmentData();
|
||||
|
|
|
@ -108,6 +108,15 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
/// <param name="objectLocalID"></param>
|
||||
void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID);
|
||||
|
||||
/// <summary>
|
||||
/// Detach the given item to the ground at the specified coordinates & rotation
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="objectLocalID"></param>
|
||||
/// <param name="absolutePos"></param>
|
||||
/// <param name="absoluteRot"></param>
|
||||
void DetachSingleAttachmentToGround(IScenePresence sp, uint objectLocalID, Vector3 absolutePos, Quaternion absoluteRot);
|
||||
|
||||
/// <summary>
|
||||
/// Detach the given attachment so that it remains in the user's inventory.
|
||||
/// </summary>
|
||||
|
|
|
@ -3549,6 +3549,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (m_UrlModule != null)
|
||||
m_UrlModule.HttpContentType(new UUID(id),type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void osDropAttachment()
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
|
||||
|
||||
if (attachmentsModule != null && sp != null)
|
||||
{
|
||||
attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId);
|
||||
}
|
||||
}
|
||||
|
||||
public void osDropAttachmentAt(LSL_Vector pos, LSL_Rotation rot)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osDropAttachment");
|
||||
m_host.AddScriptLPS(1);
|
||||
|
||||
IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
|
||||
ScenePresence sp = attachmentsModule == null ? null : m_host.ParentGroup.Scene.GetScenePresence(m_host.ParentGroup.OwnerID);
|
||||
|
||||
if (attachmentsModule != null && sp != null)
|
||||
{
|
||||
Vector3 omvPos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
|
||||
Quaternion omvRot = LSL_Api.Rot2Quaternion(rot);
|
||||
attachmentsModule.DetachSingleAttachmentToGround(sp, m_host.ParentGroup.LocalId, omvPos, omvRot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -394,5 +394,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
void osSetContentType(LSL_Key id, string type);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment to the ground
|
||||
/// </summary>
|
||||
void osDropAttachment();
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to drop an attachment at the specified coordinates.
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <param name="rot"></param>
|
||||
void osDropAttachmentAt(vector pos, rotation rot);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -972,5 +972,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
|||
{
|
||||
m_OSSL_Functions.osSetContentType(id,type);
|
||||
}
|
||||
|
||||
public void osDropAttachment()
|
||||
{
|
||||
m_OSSL_Functions.osDropAttachment();
|
||||
}
|
||||
|
||||
public void osDropAttachmentAt(vector pos, rotation rot)
|
||||
{
|
||||
m_OSSL_Functions.osDropAttachmentAt(pos, rot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue