diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a5c0b0d..ceb4395 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Xml; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Timers; | 32 | using System.Timers; |
@@ -3963,6 +3964,32 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
3963 | return; | 3964 | return; |
3964 | } | 3965 | } |
3965 | 3966 | ||
3967 | XmlDocument doc = new XmlDocument(); | ||
3968 | string stateData = String.Empty; | ||
3969 | |||
3970 | IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>(); | ||
3971 | if (attServ != null) | ||
3972 | { | ||
3973 | m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service"); | ||
3974 | stateData = attServ.Get(ControllingClient.AgentId.ToString()); | ||
3975 | doc.LoadXml(stateData); | ||
3976 | } | ||
3977 | |||
3978 | Dictionary<UUID, string> itemData = new Dictionary<UUID, string>(); | ||
3979 | |||
3980 | XmlNodeList nodes = doc.GetElementsByTagName("Attachment"); | ||
3981 | if (nodes.Count > 0) | ||
3982 | { | ||
3983 | foreach (XmlNode n in nodes) | ||
3984 | { | ||
3985 | XmlElement elem = (XmlElement)n; | ||
3986 | string itemID = elem.GetAttribute("ItemID"); | ||
3987 | string xml = elem.InnerXml; | ||
3988 | |||
3989 | itemData[new UUID(itemID)] = xml; | ||
3990 | } | ||
3991 | } | ||
3992 | |||
3966 | List<int> attPoints = m_appearance.GetAttachedPoints(); | 3993 | List<int> attPoints = m_appearance.GetAttachedPoints(); |
3967 | foreach (int p in attPoints) | 3994 | foreach (int p in attPoints) |
3968 | { | 3995 | { |
@@ -3982,9 +4009,17 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
3982 | 4009 | ||
3983 | try | 4010 | try |
3984 | { | 4011 | { |
4012 | string xmlData; | ||
4013 | XmlDocument d = new XmlDocument(); | ||
4014 | if (itemData.TryGetValue(itemID, out xmlData)) | ||
4015 | { | ||
4016 | d.LoadXml(xmlData); | ||
4017 | m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID); | ||
4018 | } | ||
4019 | |||
3985 | // Rez from inventory | 4020 | // Rez from inventory |
3986 | UUID asset | 4021 | UUID asset |
3987 | = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null); | 4022 | = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d); |
3988 | 4023 | ||
3989 | m_log.InfoFormat( | 4024 | m_log.InfoFormat( |
3990 | "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", | 4025 | "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", |