diff options
Diffstat (limited to 'OpenSim/Region')
8 files changed, 51 insertions, 97 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2a21b02..0aec01a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3678,30 +3678,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3678 | 3678 | ||
3679 | #endregion Primitive Packet/Data Sending Methods | 3679 | #endregion Primitive Packet/Data Sending Methods |
3680 | 3680 | ||
3681 | /// <summary> | ||
3682 | /// | ||
3683 | /// </summary> | ||
3684 | /// <param name="localID"></param> | ||
3685 | /// <param name="rotation"></param> | ||
3686 | /// <param name="attachPoint"></param> | ||
3687 | public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
3688 | { | ||
3689 | if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD | ||
3690 | return; | ||
3691 | |||
3692 | ObjectAttachPacket attach = (ObjectAttachPacket)PacketPool.Instance.GetPacket(PacketType.ObjectAttach); | ||
3693 | // TODO: don't create new blocks if recycling an old packet | ||
3694 | attach.AgentData.AgentID = AgentId; | ||
3695 | attach.AgentData.SessionID = m_sessionId; | ||
3696 | attach.AgentData.AttachmentPoint = attachPoint; | ||
3697 | attach.ObjectData = new ObjectAttachPacket.ObjectDataBlock[1]; | ||
3698 | attach.ObjectData[0] = new ObjectAttachPacket.ObjectDataBlock(); | ||
3699 | attach.ObjectData[0].ObjectLocalID = localID; | ||
3700 | attach.ObjectData[0].Rotation = rotation; | ||
3701 | attach.Header.Zerocoded = true; | ||
3702 | OutPacket(attach, ThrottleOutPacketType.Task); | ||
3703 | } | ||
3704 | |||
3705 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) | 3681 | void HandleQueueEmpty(ThrottleOutPacketTypeFlags categories) |
3706 | { | 3682 | { |
3707 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) | 3683 | if ((categories & ThrottleOutPacketTypeFlags.Task) != 0) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 84c406a..527934d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -69,6 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
69 | get { return false; } | 69 | get { return false; } |
70 | } | 70 | } |
71 | 71 | ||
72 | // Called by client | ||
73 | // | ||
72 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) | 74 | public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) |
73 | { | 75 | { |
74 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); | 76 | m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); |
@@ -84,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
84 | return; | 86 | return; |
85 | 87 | ||
86 | // Calls attach with a Zero position | 88 | // Calls attach with a Zero position |
87 | if (AttachObject(remoteClient, objectLocalID, AttachmentPt, Vector3.Zero, false)) | 89 | if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false)) |
88 | { | 90 | { |
89 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | 91 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
90 | 92 | ||
@@ -106,72 +108,64 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
109 | public bool AttachObject( | 111 | public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent) |
110 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Vector3 attachPos, bool silent) | ||
111 | { | 112 | { |
112 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); | 113 | Vector3 attachPos = group.AbsolutePosition; |
113 | if (group != null) | 114 | |
115 | if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | ||
114 | { | 116 | { |
115 | if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) | 117 | // If the attachment point isn't the same as the one previously used |
118 | // set it's offset position = 0 so that it appears on the attachment point | ||
119 | // and not in a weird location somewhere unknown. | ||
120 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | ||
116 | { | 121 | { |
117 | // If the attachment point isn't the same as the one previously used | 122 | attachPos = Vector3.Zero; |
118 | // set it's offset position = 0 so that it appears on the attachment point | 123 | } |
119 | // and not in a weird location somewhere unknown. | ||
120 | if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) | ||
121 | { | ||
122 | attachPos = Vector3.Zero; | ||
123 | } | ||
124 | |||
125 | // AttachmentPt 0 means the client chose to 'wear' the attachment. | ||
126 | if (AttachmentPt == 0) | ||
127 | { | ||
128 | // Check object for stored attachment point | ||
129 | AttachmentPt = (uint)group.GetAttachmentPoint(); | ||
130 | } | ||
131 | |||
132 | // if we still didn't find a suitable attachment point....... | ||
133 | if (AttachmentPt == 0) | ||
134 | { | ||
135 | // Stick it on left hand with Zero Offset from the attachment point. | ||
136 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | ||
137 | attachPos = Vector3.Zero; | ||
138 | } | ||
139 | 124 | ||
140 | group.SetAttachmentPoint((byte)AttachmentPt); | 125 | // AttachmentPt 0 means the client chose to 'wear' the attachment. |
141 | group.AbsolutePosition = attachPos; | 126 | if (AttachmentPt == 0) |
127 | { | ||
128 | // Check object for stored attachment point | ||
129 | AttachmentPt = (uint)group.GetAttachmentPoint(); | ||
130 | } | ||
142 | 131 | ||
143 | // Saves and gets itemID | 132 | // if we still didn't find a suitable attachment point....... |
144 | UUID itemId; | 133 | if (AttachmentPt == 0) |
134 | { | ||
135 | // Stick it on left hand with Zero Offset from the attachment point. | ||
136 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | ||
137 | attachPos = Vector3.Zero; | ||
138 | } | ||
145 | 139 | ||
146 | if (group.GetFromItemID() == UUID.Zero) | 140 | group.SetAttachmentPoint((byte)AttachmentPt); |
147 | { | 141 | group.AbsolutePosition = attachPos; |
148 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | itemId = group.GetFromItemID(); | ||
153 | } | ||
154 | 142 | ||
155 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); | 143 | // Saves and gets itemID |
144 | UUID itemId; | ||
156 | 145 | ||
157 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | 146 | if (group.GetFromItemID() == UUID.Zero) |
158 | 147 | { | |
159 | // In case it is later dropped again, don't let | 148 | m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); |
160 | // it get cleaned up | ||
161 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
162 | group.HasGroupChanged = false; | ||
163 | } | 149 | } |
164 | else | 150 | else |
165 | { | 151 | { |
166 | remoteClient.SendAgentAlertMessage( | 152 | itemId = group.GetFromItemID(); |
167 | "You don't have sufficient permissions to attach this object", false); | ||
168 | |||
169 | return false; | ||
170 | } | 153 | } |
154 | |||
155 | SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); | ||
156 | |||
157 | group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); | ||
158 | |||
159 | // In case it is later dropped again, don't let | ||
160 | // it get cleaned up | ||
161 | group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); | ||
162 | group.HasGroupChanged = false; | ||
171 | } | 163 | } |
172 | else | 164 | else |
173 | { | 165 | { |
174 | m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID); | 166 | remoteClient.SendAgentAlertMessage( |
167 | "You don't have sufficient permissions to attach this object", false); | ||
168 | |||
175 | return false; | 169 | return false; |
176 | } | 170 | } |
177 | 171 | ||
@@ -237,8 +231,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
237 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) | 231 | if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) |
238 | tainted = true; | 232 | tainted = true; |
239 | 233 | ||
240 | AttachObject( | 234 | AttachObject(remoteClient, objatt, AttachmentPt, false); |
241 | remoteClient, objatt.LocalId, AttachmentPt, objatt.AbsolutePosition, false); | ||
242 | //objatt.ScheduleGroupForFullUpdate(); | 235 | //objatt.ScheduleGroupForFullUpdate(); |
243 | 236 | ||
244 | if (tainted) | 237 | if (tainted) |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index af9df45..f6e6163 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -536,10 +536,6 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
536 | { | 536 | { |
537 | } | 537 | } |
538 | 538 | ||
539 | public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
540 | { | ||
541 | } | ||
542 | |||
543 | public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) | 539 | public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) |
544 | { | 540 | { |
545 | } | 541 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index b1bc3bc..2af2548 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
57 | /// <param name="silent"></param> | 57 | /// <param name="silent"></param> |
58 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 58 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
59 | bool AttachObject( | 59 | bool AttachObject( |
60 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Vector3 attachPos, bool silent); | 60 | IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Rez an attachment from user inventory and change inventory status to match. | 63 | /// Rez an attachment from user inventory and change inventory status to match. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c47369b..b0f4ac0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2571,8 +2571,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2571 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2571 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2572 | 2572 | ||
2573 | if (AttachmentsModule != null) | 2573 | if (AttachmentsModule != null) |
2574 | AttachmentsModule.AttachObject( | 2574 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2575 | sp.ControllingClient, grp.LocalId, (uint)0, grp.AbsolutePosition, false); | ||
2576 | 2575 | ||
2577 | } | 2576 | } |
2578 | else | 2577 | else |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 754b925..ee7aa2da 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1055,11 +1055,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1055 | 1055 | ||
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | public void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
1059 | { | ||
1060 | |||
1061 | } | ||
1062 | |||
1063 | public void SendAvatarDataImmediate(ISceneEntity avatar) | 1058 | public void SendAvatarDataImmediate(ISceneEntity avatar) |
1064 | { | 1059 | { |
1065 | 1060 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 12d6643..2e0450c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -627,10 +627,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
627 | { | 627 | { |
628 | } | 628 | } |
629 | 629 | ||
630 | public virtual void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID) | ||
631 | { | ||
632 | } | ||
633 | |||
634 | public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) | 630 | public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) |
635 | { | 631 | { |
636 | } | 632 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c5226ba..dbea6ef 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2940,9 +2940,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2940 | 2940 | ||
2941 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; | 2941 | IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; |
2942 | if (attachmentsModule != null) | 2942 | if (attachmentsModule != null) |
2943 | attachmentsModule.AttachObject( | 2943 | attachmentsModule.AttachObject(presence.ControllingClient, |
2944 | presence.ControllingClient, grp.LocalId, | 2944 | grp, (uint)attachment, false); |
2945 | (uint)attachment, Quaternion.Identity, Vector3.Zero, false); | ||
2946 | } | 2945 | } |
2947 | } | 2946 | } |
2948 | 2947 | ||