aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
diff options
context:
space:
mode:
authorMelanie2010-04-19 07:00:40 +0100
committerMelanie2010-04-19 07:00:40 +0100
commit98cb4f74b265dfb8ca3eb8c8d3ad604249398df1 (patch)
tree1339d3707430a20662bdcd3eb4e9ef86abc6a4fd /OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentAll scripts are now created suspended and are only unsuspended when the object (diff)
downloadopensim-SC-98cb4f74b265dfb8ca3eb8c8d3ad604249398df1.zip
opensim-SC-98cb4f74b265dfb8ca3eb8c8d3ad604249398df1.tar.gz
opensim-SC-98cb4f74b265dfb8ca3eb8c8d3ad604249398df1.tar.bz2
opensim-SC-98cb4f74b265dfb8ca3eb8c8d3ad604249398df1.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs57
1 files changed, 56 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 23828ef..77e73fb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -30,6 +30,7 @@ using System.Reflection;
30using log4net; 30using log4net;
31using Nini.Config; 31using Nini.Config;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenMetaverse.Packets;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Region.Framework; 35using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
@@ -169,6 +170,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
169 return true; 170 return true;
170 } 171 }
171 172
173 public void RezMultipleAttachmentsFromInventory(
174 IClientAPI remoteClient,
175 RezMultipleAttachmentsFromInvPacket.HeaderDataBlock header,
176 RezMultipleAttachmentsFromInvPacket.ObjectDataBlock[] objects)
177 {
178 foreach (RezMultipleAttachmentsFromInvPacket.ObjectDataBlock obj in objects)
179 {
180 RezSingleAttachmentFromInventory(remoteClient, obj.ItemID, obj.AttachmentPt);
181 }
182 }
183
172 public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 184 public UUID RezSingleAttachmentFromInventory(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
173 { 185 {
174 m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name); 186 m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing single attachment from item {0} for {1}", itemID, remoteClient.Name);
@@ -238,6 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
238 itemID, remoteClient.Name, AttachmentPt); 250 itemID, remoteClient.Name, AttachmentPt);
239 } 251 }
240 252
253 objatt.ResumeScripts();
241 return objatt; 254 return objatt;
242 } 255 }
243 256
@@ -311,6 +324,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
311 } 324 }
312 } 325 }
313 326
327 public void DetachObject(uint objectLocalID, IClientAPI remoteClient)
328 {
329 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID);
330 if (group != null)
331 {
332 //group.DetachToGround();
333 ShowDetachInUserInventory(group.GetFromItemID(), remoteClient);
334 }
335 }
336
314 public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient) 337 public void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient)
315 { 338 {
316 ScenePresence presence; 339 ScenePresence presence;
@@ -329,6 +352,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
329 DetachSingleAttachmentToInv(itemID, remoteClient); 352 DetachSingleAttachmentToInv(itemID, remoteClient);
330 } 353 }
331 354
355 public void DetachSingleAttachmentToGround(UUID itemID, IClientAPI remoteClient)
356 {
357 SceneObjectPart part = m_scene.GetSceneObjectPart(itemID);
358 if (part == null || part.ParentGroup == null)
359 return;
360
361 UUID inventoryID = part.ParentGroup.GetFromItemID();
362
363 ScenePresence presence;
364 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
365 {
366 if (!m_scene.Permissions.CanRezObject(
367 part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition))
368 return;
369
370 presence.Appearance.DetachAttachment(itemID);
371
372 if (m_scene.AvatarFactory != null)
373 {
374 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
375 }
376 part.ParentGroup.DetachToGround();
377
378 List<UUID> uuids = new List<UUID>();
379 uuids.Add(inventoryID);
380 m_scene.InventoryService.DeleteItems(remoteClient.AgentId, uuids);
381 remoteClient.SendRemoveInventoryItem(inventoryID);
382 }
383
384 m_scene.EventManager.TriggerOnAttach(part.ParentGroup.LocalId, itemID, UUID.Zero);
385 }
386
332 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards. 387 // What makes this method odd and unique is it tries to detach using an UUID.... Yay for standards.
333 // To LocalId or UUID, *THAT* is the question. How now Brown UUID?? 388 // To LocalId or UUID, *THAT* is the question. How now Brown UUID??
334 protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient) 389 protected void DetachSingleAttachmentToInv(UUID itemID, IClientAPI remoteClient)
@@ -359,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
359 } 414 }
360 } 415 }
361 } 416 }
362} \ No newline at end of file 417}