aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-01 01:11:52 +0100
committerJustin Clark-Casey (justincc)2010-09-01 01:11:52 +0100
commit6cbf66827ba3cb878ab70b75fc4e3221b71d820e (patch)
tree59ba0c53b3672bd5b2a44bb321663df709de4098 /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-6cbf66827ba3cb878ab70b75fc4e3221b71d820e.zip
opensim-SC_OLD-6cbf66827ba3cb878ab70b75fc4e3221b71d820e.tar.gz
opensim-SC_OLD-6cbf66827ba3cb878ab70b75fc4e3221b71d820e.tar.bz2
opensim-SC_OLD-6cbf66827ba3cb878ab70b75fc4e3221b71d820e.tar.xz
refactor: move SOG.AttachToAgent() into AttachmentsModule
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs81
1 files changed, 74 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index de65460..6555b54 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -192,12 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
192 192
193 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group); 193 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
194 194
195 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); 195 AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
196
197 // In case it is later dropped again, don't let
198 // it get cleaned up
199 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
200 group.HasGroupChanged = false;
201 } 196 }
202 else 197 else
203 { 198 {
@@ -525,6 +520,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
525 remoteClient.SendInventoryItemCreateUpdate(item, 0); 520 remoteClient.SendInventoryItemCreateUpdate(item, 0);
526 } 521 }
527 } 522 }
528 } 523 }
524
525 /// <summary>
526 /// Attach this scene object to the given avatar.
527 /// </summary>
528 ///
529 /// This isn't publicly available since attachments should always perform the corresponding inventory
530 /// operation (to show the attach in user inventory and update the asset with positional information).
531 ///
532 /// <param name="sp"></param>
533 /// <param name="so"></param>
534 /// <param name="attachmentpoint"></param>
535 /// <param name="AttachOffset"></param>
536 /// <param name="silent"></param>
537 protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 AttachOffset, bool silent)
538 {
539 // don't attach attachments to child agents
540 if (avatar.IsChildAgent) return;
541
542// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1}", Name, avatar.Name);
543
544 so.DetachFromBackup();
545
546 // Remove from database and parcel prim count
547 m_scene.DeleteFromStorage(so.UUID);
548 m_scene.EventManager.TriggerParcelPrimCountTainted();
549
550 so.RootPart.AttachedAvatar = avatar.UUID;
551
552 //Anakin Lohner bug #3839
553 lock (so.Children)
554 {
555 foreach (SceneObjectPart p in so.Children.Values)
556 {
557 p.AttachedAvatar = avatar.UUID;
558 }
559 }
560
561 if (so.RootPart.PhysActor != null)
562 {
563 m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor);
564 so.RootPart.PhysActor = null;
565 }
566
567 so.AbsolutePosition = AttachOffset;
568 so.RootPart.AttachedPos = AttachOffset;
569 so.RootPart.IsAttachment = true;
570
571 so.RootPart.SetParentLocalId(avatar.LocalId);
572 so.SetAttachmentPoint(Convert.ToByte(attachmentpoint));
573
574 avatar.AddAttachment(so);
575
576 if (!silent)
577 {
578 // Killing it here will cause the client to deselect it
579 // It then reappears on the avatar, deselected
580 // through the full update below
581 //
582 if (so.IsSelected)
583 {
584 m_scene.SendKillObject(so.RootPart.LocalId);
585 }
586
587 so.IsSelected = false; // fudge....
588 so.ScheduleGroupForFullUpdate();
589 }
590
591 // In case it is later dropped again, don't let
592 // it get cleaned up
593 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
594 so.HasGroupChanged = false;
595 }
529 } 596 }
530} \ No newline at end of file 597} \ No newline at end of file