aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorCharles Krinke2009-06-29 18:07:30 +0000
committerCharles Krinke2009-06-29 18:07:30 +0000
commit7bb070be55d0efe3a272f170055bdf02ee41aa65 (patch)
treed24437108a7ae8fab611bb8b1706db967ac8f719 /OpenSim/Region
parent* Changing List to Dictionary in PacketQueue.Dequeue for great justice (and p... (diff)
downloadopensim-SC-7bb070be55d0efe3a272f170055bdf02ee41aa65.zip
opensim-SC-7bb070be55d0efe3a272f170055bdf02ee41aa65.tar.gz
opensim-SC-7bb070be55d0efe3a272f170055bdf02ee41aa65.tar.bz2
opensim-SC-7bb070be55d0efe3a272f170055bdf02ee41aa65.tar.xz
Thank you kindly, Snowdrop/Snowcrash for a patch that:
This patch makes the worn attachments accessible to MRM scripting
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs20
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs28
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs35
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
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 33namespace 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
28using System; 28using System;
29using System.Reflection;
30using System.Collections;
31using System.Collections.Generic;
32
29using OpenMetaverse; 33using OpenMetaverse;
30using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
31 35
36using log4net;
37
32namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 38namespace 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 @@
1using System;
2
3using OpenMetaverse;
4using OpenSim.Region.Framework.Scenes;
5
6namespace 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}