aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs56
1 files changed, 40 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index fbd11c6..7bd4329 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -479,25 +479,35 @@ namespace OpenSim.Region.Framework.Scenes
479 if (part == null) 479 if (part == null)
480 return; 480 return;
481 481
482 if (!m_parentScene.Permissions.CanTakeObject( 482 if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
483 part.UUID, remoteClient.AgentId))
484 return; 483 return;
485 484
486 // Calls attach with a Zero position 485 // Calls attach with a Zero position
487 AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); 486 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
488 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
489
490 // Save avatar attachment information
491 ScenePresence presence;
492 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
493 { 487 {
494 m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); 488 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
495 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); 489
490 // Save avatar attachment information
491 ScenePresence presence;
492 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
493 {
494 m_log.Info(
495 "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
496 + ", AttachmentPoint: " + AttachmentPt);
497
498 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
499 }
496 } 500 }
497 } 501 }
498 502
499 public SceneObjectGroup RezSingleAttachment( 503 /// <summary>
500 IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 504 /// Rez an attachment
505 /// </summary>
506 /// <param name="remoteClient"></param>
507 /// <param name="itemID"></param>
508 /// <param name="AttachmentPt"></param>
509 /// <returns>The scene object that was attached. Null if the scene object could not be found</returns>
510 public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
501 { 511 {
502 IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>(); 512 IInventoryAccessModule invAccess = m_parentScene.RequestModuleInterface<IInventoryAccessModule>();
503 if (invAccess != null) 513 if (invAccess != null)
@@ -560,7 +570,17 @@ namespace OpenSim.Region.Framework.Scenes
560 } 570 }
561 } 571 }
562 572
563 protected internal void AttachObject( 573 /// <summary>
574 /// Attach a scene object to an avatar.
575 /// </summary>
576 /// <param name="remoteClient"></param>
577 /// <param name="objectLocalID"></param>
578 /// <param name="AttachmentPt"></param>
579 /// <param name="rot"></param>
580 /// <param name="attachPos"></param>
581 /// <param name="silent"></param>
582 /// <returns>true if the attachment was successful, false otherwise</returns>
583 protected internal bool AttachObject(
564 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) 584 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
565 { 585 {
566 SceneObjectGroup group = GetGroupByPrim(objectLocalID); 586 SceneObjectGroup group = GetGroupByPrim(objectLocalID);
@@ -589,10 +609,8 @@ namespace OpenSim.Region.Framework.Scenes
589 // Stick it on left hand with Zero Offset from the attachment point. 609 // Stick it on left hand with Zero Offset from the attachment point.
590 AttachmentPt = (uint)AttachmentPoint.LeftHand; 610 AttachmentPt = (uint)AttachmentPoint.LeftHand;
591 attachPos = Vector3.Zero; 611 attachPos = Vector3.Zero;
592
593 } 612 }
594 613
595
596 group.SetAttachmentPoint((byte)AttachmentPt); 614 group.SetAttachmentPoint((byte)AttachmentPt);
597 group.AbsolutePosition = attachPos; 615 group.AbsolutePosition = attachPos;
598 616
@@ -615,15 +633,21 @@ namespace OpenSim.Region.Framework.Scenes
615 // it get cleaned up 633 // it get cleaned up
616 // 634 //
617 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 635 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
618 group.HasGroupChanged = false; 636 group.HasGroupChanged = false;
619 } 637 }
620 else 638 else
621 { 639 {
622 remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); 640 remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
641 return false;
623 } 642 }
624 } 643 }
625 else 644 else
645 {
626 m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); 646 m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
647 return false;
648 }
649
650 return true;
627 } 651 }
628 652
629 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) 653 protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)