diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 109 |
1 files changed, 2 insertions, 107 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5f3cd8c..dad0efd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1858,39 +1858,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1858 | 1858 | ||
1859 | if (att == null) | 1859 | if (att == null) |
1860 | { | 1860 | { |
1861 | DetachSingleAttachmentToInv(itemID, remoteClient); | 1861 | AttachmentsModule.ShowDetachInUserInventory(itemID, remoteClient); |
1862 | return UUID.Zero; | 1862 | return UUID.Zero; |
1863 | } | 1863 | } |
1864 | 1864 | ||
1865 | return RezSingleAttachment(att, remoteClient, itemID, AttachmentPt); | 1865 | return AttachmentsModule.SetAttachmentInventoryStatus(att, remoteClient, itemID, AttachmentPt); |
1866 | } | ||
1867 | |||
1868 | /// <summary> | ||
1869 | /// Update the user inventory to reflect an attachment | ||
1870 | /// </summary> | ||
1871 | /// <param name="att"></param> | ||
1872 | /// <param name="remoteClient"></param> | ||
1873 | /// <param name="itemID"></param> | ||
1874 | /// <param name="AttachmentPt"></param> | ||
1875 | /// <returns></returns> | ||
1876 | public UUID RezSingleAttachment(SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) | ||
1877 | { | ||
1878 | m_log.DebugFormat( | ||
1879 | "[USER INVENTORY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | ||
1880 | remoteClient.Name, att.Name, itemID); | ||
1881 | |||
1882 | if (!att.IsDeleted) | ||
1883 | AttachmentPt = att.RootPart.AttachmentPoint; | ||
1884 | |||
1885 | ScenePresence presence; | ||
1886 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1887 | { | ||
1888 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
1889 | item = InventoryService.GetItem(item); | ||
1890 | |||
1891 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
1892 | } | ||
1893 | return att.UUID; | ||
1894 | } | 1866 | } |
1895 | 1867 | ||
1896 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, | 1868 | public void RezMultipleAttachments(IClientAPI remoteClient, RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header, |
@@ -1902,65 +1874,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1902 | } | 1874 | } |
1903 | } | 1875 | } |
1904 | 1876 | ||
1905 | /// <summary> | ||
1906 | /// Attach an object. | ||
1907 | /// </summary> | ||
1908 | /// <param name="controllingClient"></param> | ||
1909 | /// <param name="localID"></param> | ||
1910 | /// <param name="attachPoint"></param> | ||
1911 | /// <param name="rot"></param> | ||
1912 | /// <param name="pos"></param> | ||
1913 | /// <param name="silent"></param> | ||
1914 | /// <returns>true if the object was successfully attached, false otherwise</returns> | ||
1915 | public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) | ||
1916 | { | ||
1917 | return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); | ||
1918 | } | ||
1919 | |||
1920 | /// <summary> | ||
1921 | /// This registers the item as attached in a user's inventory | ||
1922 | /// </summary> | ||
1923 | /// <param name="remoteClient"></param> | ||
1924 | /// <param name="AttachmentPt"></param> | ||
1925 | /// <param name="itemID"></param> | ||
1926 | /// <param name="att"></param> | ||
1927 | public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) | ||
1928 | { | ||
1929 | // m_log.DebugFormat( | ||
1930 | // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", | ||
1931 | // att.Name, remoteClient.Name, AttachmentPt, itemID); | ||
1932 | |||
1933 | if (UUID.Zero == itemID) | ||
1934 | { | ||
1935 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error inventory item ID."); | ||
1936 | return; | ||
1937 | } | ||
1938 | |||
1939 | if (0 == AttachmentPt) | ||
1940 | { | ||
1941 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment. Error attachment point."); | ||
1942 | return; | ||
1943 | } | ||
1944 | |||
1945 | if (null == att.RootPart) | ||
1946 | { | ||
1947 | m_log.Error("[SCENE INVENTORY]: Unable to save attachment for a prim without the rootpart!"); | ||
1948 | return; | ||
1949 | } | ||
1950 | |||
1951 | ScenePresence presence; | ||
1952 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1953 | { | ||
1954 | // XXYY!! | ||
1955 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | ||
1956 | item = InventoryService.GetItem(item); | ||
1957 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /* att.UUID */); | ||
1958 | |||
1959 | if (m_AvatarFactory != null) | ||
1960 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
1961 | } | ||
1962 | } | ||
1963 | |||
1964 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) | 1877 | public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient) |
1965 | { | 1878 | { |
1966 | SceneObjectPart part = GetSceneObjectPart(itemID); | 1879 | SceneObjectPart part = GetSceneObjectPart(itemID); |
@@ -1991,24 +1904,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1991 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); | 1904 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); |
1992 | } | 1905 | } |
1993 | 1906 | ||
1994 | public void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) | ||
1995 | { | ||
1996 | ScenePresence presence; | ||
1997 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | ||
1998 | { | ||
1999 | presence.Appearance.DetachAttachment(itemID); | ||
2000 | |||
2001 | // Save avatar attachment information | ||
2002 | if (m_AvatarFactory != null) | ||
2003 | { | ||
2004 | m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); | ||
2005 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
2006 | } | ||
2007 | } | ||
2008 | |||
2009 | m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); | ||
2010 | } | ||
2011 | |||
2012 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) | 1907 | public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) |
2013 | { | 1908 | { |
2014 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); | 1909 | EventManager.TriggerGetScriptRunning(controllingClient, objectID, itemID); |