aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-12 22:39:15 +0000
committerJustin Clark-Casey (justincc)2010-03-12 22:39:15 +0000
commitb9f5cd75bc9b46b067d151a1a13d4e95cc98cedb (patch)
treea9cbf02470f359f998bb76a76b0c37fd9b42d15d /OpenSim
parentstart laoding griduser local connector, though it isn't invoked by anything yet (diff)
downloadopensim-SC_OLD-b9f5cd75bc9b46b067d151a1a13d4e95cc98cedb.zip
opensim-SC_OLD-b9f5cd75bc9b46b067d151a1a13d4e95cc98cedb.tar.gz
opensim-SC_OLD-b9f5cd75bc9b46b067d151a1a13d4e95cc98cedb.tar.bz2
opensim-SC_OLD-b9f5cd75bc9b46b067d151a1a13d4e95cc98cedb.tar.xz
refactor: move client invoked AttachObject from SceneGraph to AttachmentsModule
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs32
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs35
4 files changed, 53 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 3b7fe88..3c2cc42 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -67,6 +67,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
67 get { return false; } 67 get { return false; }
68 } 68 }
69 69
70 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
71 {
72 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
73
74 // If we can't take it, we can't attach it!
75 SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
76 if (part == null)
77 return;
78
79 if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
80 return;
81
82 // Calls attach with a Zero position
83 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
84 {
85 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
86
87 // Save avatar attachment information
88 ScenePresence presence;
89 if (m_scene.AvatarFactory != null && m_scene.TryGetAvatar(remoteClient.AgentId, out presence))
90 {
91 m_log.Info(
92 "[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
93 + ", AttachmentPoint: " + AttachmentPt);
94
95 m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
96 }
97 }
98 }
99
70 public bool AttachObject( 100 public bool AttachObject(
71 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) 101 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
72 { 102 {
@@ -143,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
143 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 173 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
144 { 174 {
145 m_log.DebugFormat( 175 m_log.DebugFormat(
146 "[ATTACHMENTS MODULEY]: Updating inventory of {0} to show attachment of {1} (item ID {2})", 176 "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})",
147 remoteClient.Name, att.Name, itemID); 177 remoteClient.Name, att.Name, itemID);
148 178
149 if (!att.IsDeleted) 179 if (!att.IsDeleted)
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 6cf2a2e..21c1056 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -35,17 +35,28 @@ namespace OpenSim.Region.Framework.Interfaces
35 public interface IAttachmentsModule 35 public interface IAttachmentsModule
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Attach an object to an avatar from the world.
39 /// </summary>
40 /// <param name="controllingClient"></param>
41 /// <param name="localID"></param>
42 /// <param name="attachPoint"></param>
43 /// <param name="rot"></param>
44 /// <param name="silent"></param>
45 void AttachObject(
46 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent);
47
48 /// <summary>
38 /// Attach an object to an avatar. 49 /// Attach an object to an avatar.
39 /// </summary> 50 /// </summary>
40 /// <param name="controllingClient"></param> 51 /// <param name="controllingClient"></param>
41 /// <param name="localID"></param> 52 /// <param name="localID"></param>
42 /// <param name="attachPoint"></param> 53 /// <param name="attachPoint"></param>
43 /// <param name="rot"></param> 54 /// <param name="rot"></param>
44 /// <param name="pos"></param> 55 /// <param name="attachPos"></param>
45 /// <param name="silent"></param> 56 /// <param name="silent"></param>
46 /// <returns>true if the object was successfully attached, false otherwise</returns> 57 /// <returns>true if the object was successfully attached, false otherwise</returns>
47 bool AttachObject( 58 bool AttachObject(
48 IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent); 59 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent);
49 60
50 /// <summary> 61 /// <summary>
51 /// Update the user inventory to the attachment of an item 62 /// Update the user inventory to the attachment of an item
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 87a753e..d4d134f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2644,12 +2644,14 @@ namespace OpenSim.Region.Framework.Scenes
2644 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) 2644 public virtual void SubscribeToClientAttachmentEvents(IClientAPI client)
2645 { 2645 {
2646 client.OnRezSingleAttachmentFromInv += RezSingleAttachment; 2646 client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
2647 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; 2647 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments;
2648 client.OnObjectAttach += m_sceneGraph.AttachObject;
2649 client.OnObjectDetach += m_sceneGraph.DetachObject; 2648 client.OnObjectDetach += m_sceneGraph.DetachObject;
2650 2649
2651 if (AttachmentsModule != null) 2650 if (AttachmentsModule != null)
2651 {
2652 client.OnObjectAttach += AttachmentsModule.AttachObject;
2652 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory; 2653 client.OnDetachAttachmentIntoInv += AttachmentsModule.ShowDetachInUserInventory;
2654 }
2653 } 2655 }
2654 2656
2655 public virtual void SubscribeToClientTeleportEvents(IClientAPI client) 2657 public virtual void SubscribeToClientTeleportEvents(IClientAPI client)
@@ -2774,7 +2776,6 @@ namespace OpenSim.Region.Framework.Scenes
2774 client.OnRezObject -= RezObject; 2776 client.OnRezObject -= RezObject;
2775 } 2777 }
2776 2778
2777
2778 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) 2779 public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client)
2779 { 2780 {
2780 client.OnCreateNewInventoryItem -= CreateNewInventoryItem; 2781 client.OnCreateNewInventoryItem -= CreateNewInventoryItem;
@@ -2799,12 +2800,14 @@ namespace OpenSim.Region.Framework.Scenes
2799 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) 2800 public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client)
2800 { 2801 {
2801 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; 2802 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments;
2802 client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; 2803 client.OnRezSingleAttachmentFromInv -= RezSingleAttachment;
2803 client.OnObjectAttach -= m_sceneGraph.AttachObject;
2804 client.OnObjectDetach -= m_sceneGraph.DetachObject; 2804 client.OnObjectDetach -= m_sceneGraph.DetachObject;
2805 2805
2806 if (AttachmentsModule != null) 2806 if (AttachmentsModule != null)
2807 {
2808 client.OnObjectAttach -= AttachmentsModule.AttachObject;
2807 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory; 2809 client.OnDetachAttachmentIntoInv -= AttachmentsModule.ShowDetachInUserInventory;
2810 }
2808 } 2811 }
2809 2812
2810 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) 2813 public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 380722d..a88d456 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -487,41 +487,6 @@ namespace OpenSim.Region.Framework.Scenes
487 } 487 }
488 488
489 /// <summary> 489 /// <summary>
490 /// Event Handling routine for Attach Object
491 /// </summary>
492 /// <param name="remoteClient"></param>
493 /// <param name="objectLocalID"></param>
494 /// <param name="AttachmentPt"></param>
495 /// <param name="rot"></param>
496 protected internal void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
497 {
498 // If we can't take it, we can't attach it!
499 SceneObjectPart part = m_parentScene.GetSceneObjectPart(objectLocalID);
500 if (part == null)
501 return;
502
503 if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
504 return;
505
506 // Calls attach with a Zero position
507 if (m_parentScene.AttachmentsModule.AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
508 {
509 m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
510
511 // Save avatar attachment information
512 ScenePresence presence;
513 if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
514 {
515 m_log.Info(
516 "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
517 + ", AttachmentPoint: " + AttachmentPt);
518
519 m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
520 }
521 }
522 }
523
524 /// <summary>
525 /// Rez an attachment 490 /// Rez an attachment
526 /// </summary> 491 /// </summary>
527 /// <param name="remoteClient"></param> 492 /// <param name="remoteClient"></param>