add osRemoveAllAttachmentsFromAvatar()

master
Christopher 2020-07-11 14:34:47 +02:00
parent e4bb40d6ee
commit 2b38d0987f
1 changed files with 34 additions and 0 deletions

View File

@ -61,6 +61,7 @@ namespace OpenSim.Modules.Appearance2Avatar
m_scriptModule = scene.RequestModuleInterface<IScriptModuleComms>();
if (m_scriptModule != null)
{
m_scriptModule.RegisterScriptInvocation(this, "osRemoveAllAttachmentsFromAvatar");
m_scriptModule.RegisterScriptInvocation(this, "osAppearance2Avatar");
}
@ -74,6 +75,39 @@ namespace OpenSim.Modules.Appearance2Avatar
}
[ScriptInvocation]
public void osRemoveAllAttachmentsFromAvatar(UUID hostID, UUID scriptID, String targetAvatar)
{
ScenePresence sp = m_scene.GetScenePresence(UUID.Parse(targetAvatar));
if (sp != null)
{
//Remove all attachments
List<SceneObjectGroup> _allAttachments = sp.GetAttachments();
foreach (SceneObjectGroup _attachment in _allAttachments)
m_scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, _attachment);
if (m_scene.AttachmentsModule != null)
m_scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false);
//Remove current outfit from inventory
InventoryFolderBase _outfitFolder = m_scene.InventoryService.GetFolderForType(sp.UUID, FolderType.CurrentOutfit);
if (_outfitFolder != null)
{
InventoryCollection _outfitFolderContend = m_scene.InventoryService.GetFolderContent(sp.UUID, _outfitFolder.ID);
List<UUID> _itemIDs = new List<UUID>();
foreach (InventoryItemBase item in _outfitFolderContend.Items)
if (item.InvType == (int)AssetType.Object)
_itemIDs.Add(item.ID);
m_scene.InventoryService.DeleteItems(sp.UUID, _itemIDs);
m_scene.InventoryService.UpdateFolder(_outfitFolder);
}
}
}
[ScriptInvocation]
public void osAppearance2Avatar(UUID hostID, UUID scriptID, String notecard, String targetAvatar)
{