Use the saved script states

avinationmerge
Melanie Thielker 2010-04-24 18:59:34 +02:00
parent 27b3f23ff3
commit 899d521ab4
2 changed files with 36 additions and 2 deletions

View File

@ -524,7 +524,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
else else
{ {
throw new Exception("AttachTracer");
group.SetFromItemID(itemID); group.SetFromItemID(itemID);
} }

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Xml;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Timers; using System.Timers;
@ -3963,6 +3964,32 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
return; return;
} }
XmlDocument doc = new XmlDocument();
string stateData = String.Empty;
IAttachmentsService attServ = m_scene.RequestModuleInterface<IAttachmentsService>();
if (attServ != null)
{
m_log.DebugFormat("[ATTACHMENT]: Loading attachment data from attachment service");
stateData = attServ.Get(ControllingClient.AgentId.ToString());
doc.LoadXml(stateData);
}
Dictionary<UUID, string> itemData = new Dictionary<UUID, string>();
XmlNodeList nodes = doc.GetElementsByTagName("Attachment");
if (nodes.Count > 0)
{
foreach (XmlNode n in nodes)
{
XmlElement elem = (XmlElement)n;
string itemID = elem.GetAttribute("ItemID");
string xml = elem.InnerXml;
itemData[new UUID(itemID)] = xml;
}
}
List<int> attPoints = m_appearance.GetAttachedPoints(); List<int> attPoints = m_appearance.GetAttachedPoints();
foreach (int p in attPoints) foreach (int p in attPoints)
{ {
@ -3982,9 +4009,17 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
try try
{ {
string xmlData;
XmlDocument d = new XmlDocument();
if (itemData.TryGetValue(itemID, out xmlData))
{
d.LoadXml(xmlData);
m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID);
}
// Rez from inventory // Rez from inventory
UUID asset UUID asset
= m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null); = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d);
m_log.InfoFormat( m_log.InfoFormat(
"[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",