diff options
Diffstat (limited to '')
3 files changed, 81 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs index fef85dd..51ba36c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs | |||
@@ -32,8 +32,24 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
34 | { | 34 | { |
35 | public interface IAvatar : IEntity | 35 | public interface IAvatarAttachment |
36 | { | 36 | { |
37 | 37 | //// <value> | |
38 | /// Describes where on the avatar the attachment is located | ||
39 | /// </value> | ||
40 | int Location { get ; } | ||
41 | |||
42 | //// <value> | ||
43 | /// Accessor to the rez'ed asset, representing the attachment | ||
44 | /// </value> | ||
45 | IObject Asset { get; } | ||
46 | } | ||
47 | |||
48 | public interface IAvatar : IEntity | ||
49 | { | ||
50 | //// <value> | ||
51 | /// Array of worn attachments, empty but not null, if no attachments are worn | ||
52 | /// </value> | ||
53 | IAvatarAttachment[] Attachments { get; } | ||
38 | } | 54 | } |
39 | } | 55 | } |
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 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | |||
29 | using OpenMetaverse; | 33 | using OpenMetaverse; |
30 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
31 | 35 | ||
36 | using log4net; | ||
37 | |||
32 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 38 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
33 | { | 39 | { |
34 | class SPAvatar : System.MarshalByRefObject, IAvatar | 40 | class SPAvatar : System.MarshalByRefObject, IAvatar |
35 | { | 41 | { |
36 | private readonly Scene m_rootScene; | 42 | private readonly Scene m_rootScene; |
37 | private readonly UUID m_ID; | 43 | private readonly UUID m_ID; |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
38 | 45 | ||
39 | public SPAvatar(Scene scene, UUID ID) | 46 | public SPAvatar(Scene scene, UUID ID) |
40 | { | 47 | { |
@@ -63,5 +70,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
63 | get { return GetSP().AbsolutePosition; } | 70 | get { return GetSP().AbsolutePosition; } |
64 | set { GetSP().TeleportWithMomentum(value); } | 71 | set { GetSP().TeleportWithMomentum(value); } |
65 | } | 72 | } |
73 | |||
74 | #region IAvatar implementation | ||
75 | public IAvatarAttachment[] Attachments | ||
76 | { | ||
77 | get { | ||
78 | List<IAvatarAttachment> attachments = new List<IAvatarAttachment>(); | ||
79 | |||
80 | Hashtable internalAttachments = GetSP().Appearance.GetAttachments(); | ||
81 | if(internalAttachments != null) | ||
82 | { | ||
83 | foreach(DictionaryEntry element in internalAttachments) | ||
84 | { | ||
85 | Hashtable attachInfo = (Hashtable)element.Value; | ||
86 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int)element.Key, new UUID((string)attachInfo["item"]), new UUID((string)attachInfo["asset"]))); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | return attachments.ToArray(); | ||
91 | } | ||
92 | } | ||
93 | #endregion | ||
66 | } | 94 | } |
67 | } | 95 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs new file mode 100644 index 0000000..5581fc3 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs | |||
@@ -0,0 +1,35 @@ | |||
1 | using System; | ||
2 | |||
3 | using OpenMetaverse; | ||
4 | using OpenSim.Region.Framework.Scenes; | ||
5 | |||
6 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
7 | { | ||
8 | public class SPAvatarAttachment : IAvatarAttachment | ||
9 | { | ||
10 | private readonly Scene m_rootScene; | ||
11 | private readonly IAvatar m_parent; | ||
12 | private readonly int m_location; | ||
13 | private readonly UUID m_itemId; | ||
14 | private readonly UUID m_assetId; | ||
15 | |||
16 | public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId) | ||
17 | { | ||
18 | m_rootScene = rootScene; | ||
19 | m_parent = self; | ||
20 | m_location = location; | ||
21 | m_itemId = itemId; | ||
22 | m_assetId = assetId; | ||
23 | } | ||
24 | |||
25 | public int Location { get { return m_location; } } | ||
26 | |||
27 | public IObject Asset | ||
28 | { | ||
29 | get | ||
30 | { | ||
31 | return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId); | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | } | ||