From 7bb070be55d0efe3a272f170055bdf02ee41aa65 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 29 Jun 2009 18:07:30 +0000 Subject: Thank you kindly, Snowdrop/Snowcrash for a patch that: This patch makes the worn attachments accessible to MRM scripting --- .../Scripting/Minimodule/SPAvatar.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 8fed89c..6fd36bf 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs @@ -26,15 +26,22 @@ */ using System; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; + using OpenMetaverse; using OpenSim.Region.Framework.Scenes; +using log4net; + namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { class SPAvatar : System.MarshalByRefObject, IAvatar { private readonly Scene m_rootScene; private readonly UUID m_ID; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public SPAvatar(Scene scene, UUID ID) { @@ -63,5 +70,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return GetSP().AbsolutePosition; } set { GetSP().TeleportWithMomentum(value); } } + + #region IAvatar implementation + public IAvatarAttachment[] Attachments + { + get { + List attachments = new List(); + + Hashtable internalAttachments = GetSP().Appearance.GetAttachments(); + if(internalAttachments != null) + { + foreach(DictionaryEntry element in internalAttachments) + { + Hashtable attachInfo = (Hashtable)element.Value; + attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int)element.Key, new UUID((string)attachInfo["item"]), new UUID((string)attachInfo["asset"]))); + } + } + + return attachments.ToArray(); + } + } + #endregion } } -- cgit v1.1