aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Attachments
diff options
context:
space:
mode:
authorMelanie2012-08-14 01:45:02 +0100
committerMelanie2012-08-14 01:45:02 +0100
commit4bbdcfb5ee81f459df9ff9a2ac477f6419cfc279 (patch)
tree32139b9ae05e47f39ea6a1dbedbc4f4157cd4c60 /OpenSim/Region/OptionalModules/Avatar/Attachments
parentAs per lindn spec, disable detach and drop for temp attachments (diff)
downloadopensim-SC_OLD-4bbdcfb5ee81f459df9ff9a2ac477f6419cfc279.zip
opensim-SC_OLD-4bbdcfb5ee81f459df9ff9a2ac477f6419cfc279.tar.gz
opensim-SC_OLD-4bbdcfb5ee81f459df9ff9a2ac477f6419cfc279.tar.bz2
opensim-SC_OLD-4bbdcfb5ee81f459df9ff9a2ac477f6419cfc279.tar.xz
Implement the temp attachments. UNTESTED
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Attachments')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
index c1efd7c..e659ec0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Attachments/TempAttachmentsModule.cs
@@ -49,12 +49,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")] 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TempAttachmentsModule")]
50 public class TempAttachmentsModule : INonSharedRegionModule 50 public class TempAttachmentsModule : INonSharedRegionModule
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53
54 private Scene m_scene;
55
52 public void Initialise(IConfigSource configSource) 56 public void Initialise(IConfigSource configSource)
53 { 57 {
54 } 58 }
55 59
56 public void AddRegion(Scene scene) 60 public void AddRegion(Scene scene)
57 { 61 {
62 m_scene = scene;
63
64 IScriptModuleComms comms = scene.RequestModuleInterface<IScriptModuleComms>();
65 if (comms != null)
66 {
67 comms.RegisterScriptInvocation( this, "llAttachToAvatarTemp");
68 m_log.DebugFormat("[TEMP ATTACHS]: Registered script functions");
69 }
70 else
71 {
72 m_log.ErrorFormat("[TEMP ATTACHS]: Failed to register script functions");
73 }
58 } 74 }
59 75
60 public void RemoveRegion(Scene scene) 76 public void RemoveRegion(Scene scene)
@@ -78,5 +94,33 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
78 { 94 {
79 get { return "TempAttachmentsModule"; } 95 get { return "TempAttachmentsModule"; }
80 } 96 }
97
98 private void llAttachToAvatarTemp(UUID host, UUID script, int attachmentPoint)
99 {
100 SceneObjectPart hostPart = m_scene.GetSceneObjectPart(host);
101
102 if (hostPart == null)
103 return;
104
105 if (hostPart.ParentGroup.IsAttachment)
106 return;
107
108 IAttachmentsModule attachmentsModule = m_scene.RequestModuleInterface<IAttachmentsModule>();
109 if (attachmentsModule == null)
110 return;
111
112 TaskInventoryItem item = hostPart.Inventory.GetInventoryItem(script);
113 if (item == null)
114 return;
115
116 if ((item.PermsMask & 32) == 0) // PERMISSION_ATTACH
117 return;
118
119 ScenePresence target;
120 if (!m_scene.TryGetScenePresence(item.PermsGranter, out target))
121 return;
122
123 attachmentsModule.AttachObject(target, hostPart.ParentGroup, (uint)attachmentPoint, false, true);
124 }
81 } 125 }
82} 126}